upgrade mastodon, needed to swap postgres ports as masto postgres does no longer allow for port control

This commit is contained in:
Cyryl Płotnicki 2023-05-08 12:03:29 +01:00
parent 8f33fb5ef4
commit 8a9b3e3763
5 changed files with 107 additions and 116 deletions

View file

@ -131,7 +131,7 @@
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv"; skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky"; thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty"; bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty";
vpsfree1 = mkServer nixpkgs-stable "x86_64-linux" "vpsfree1"; vpsfree1 = mkServer nixpkgs-nixos-unstable "x86_64-linux" "vpsfree1";
mb1 = mkServer nixpkgs-stable "x86_64-linux" "mb1"; mb1 = mkServer nixpkgs-stable "x86_64-linux" "mb1";
yoga = mkKiosk nixpkgs-stable "x86_64-linux" "yoga"; yoga = mkKiosk nixpkgs-stable "x86_64-linux" "yoga";
homescreen = mkRaspi nixpkgs-stable "homescreen"; homescreen = mkRaspi nixpkgs-stable "homescreen";

View file

@ -8,7 +8,6 @@
./backups.nix ./backups.nix
./blog.cyplo.net.nix ./blog.cyplo.net.nix
./cryptpad.nix ./cryptpad.nix
./fossil.nix
./foundryvtt.nix ./foundryvtt.nix
./gitea.nix ./gitea.nix
./mastodon.nix ./mastodon.nix
@ -17,7 +16,6 @@
./search.nix ./search.nix
./ssh.nix ./ssh.nix
./syncthing-relay.nix ./syncthing-relay.nix
./woodpecker.nix
]; ];
systemd.extraConfig = '' systemd.extraConfig = ''

View file

@ -1,10 +1,5 @@
{ { config, pkgs, inputs, lib, ... }:
config, let
pkgs,
inputs,
lib,
...
}: let
port = 8081; port = 8081;
domain = "fossil.cyplo.dev"; domain = "fossil.cyplo.dev";
baseurl = "https://${domain}"; baseurl = "https://${domain}";
@ -24,27 +19,22 @@ in {
containers.fossil = { containers.fossil = {
autoStart = true; autoStart = true;
forwardPorts = [ forwardPorts = [{
{
containerPort = port; containerPort = port;
hostPort = port; hostPort = port;
} }];
];
bindMounts = { bindMounts = {
"${path}" = { "${path}" = {
hostPath = "${path}"; hostPath = "${path}";
isReadOnly = false; isReadOnly = false;
}; };
}; };
config = { config = { config, pkgs, ... }:
config, let
pkgs,
...
}: let
user = "fossil"; user = "fossil";
group = "fossil"; group = "fossil";
in { in {
system.stateVersion = "22.05"; system.stateVersion = "22.11";
environment.systemPackages = [ pkgs.fossil ]; environment.systemPackages = [ pkgs.fossil ];
users.groups = { "${group}" = { }; }; users.groups = { "${group}" = { }; };
users.users = { users.users = {
@ -69,13 +59,9 @@ in {
Group = group; Group = group;
WorkingDirectory = path; WorkingDirectory = path;
ReadWritePaths = [ path ]; ReadWritePaths = [ path ];
ExecStart = ExecStart = "${pkgs.fossil}/bin/fossil server" + " --localhost"
"${pkgs.fossil}/bin/fossil server" + " --https" + " --port ${toString port}"
+ " --localhost" + " --baseurl ${baseurl}" + " --repolist ${path}";
+ " --https"
+ " --port ${toString port}"
+ " --baseurl ${baseurl}"
+ " --repolist ${path}";
Restart = "always"; Restart = "always";
RestartSec = 3; RestartSec = 3;
}; };

View file

@ -1,9 +1,11 @@
{ config, pkgs, inputs, lib, ... }: { config, pkgs, inputs, lib, ... }:
let let
unstablePkgs = inputs.nixpkgs-nixos-unstable.legacyPackages.${pkgs.system};
package = unstablePkgs.mastodon;
domain = "peninsula.industries"; domain = "peninsula.industries";
streamingPort = 55000; streamingPort = 55000;
webPort = 55001; webPort = 55001;
postgresPort = 5433; postgresPort = 5432;
path = "/var/lib/mastodon/"; path = "/var/lib/mastodon/";
mailgunSmtpSecretName = "mastodon-mailgun-smtp-password"; mailgunSmtpSecretName = "mastodon-mailgun-smtp-password";
mailgunSmtpPasswordPath = "/run/secrets/${mailgunSmtpSecretName}"; mailgunSmtpPasswordPath = "/run/secrets/${mailgunSmtpSecretName}";
@ -30,9 +32,9 @@ let
group = systemGroupName; group = systemGroupName;
}; };
publicPath = "${path}/public-system/"; publicPath = "${path}/public-system/";
package = inputs.nixpkgs-stable.legacyPackages."${pkgs.system}".mastodon;
in { in {
imports = [ ../nginx.nix ]; imports = [ ../nginx.nix ];
system.stateVersion = "22.11";
services.nginx = { services.nginx = {
virtualHosts = { virtualHosts = {
@ -109,18 +111,32 @@ in {
}; };
}; };
config = { config, pkgs, lib, ... }: { config = { config, pkgs, lib, ... }: {
system.stateVersion = "22.05"; system.stateVersion = "22.11";
services.postgresql.port = postgresPort; services.postgresql.port = postgresPort;
users = users // { users = users // {
mutableUsers = false; mutableUsers = false;
allowNoPasswordLogin = true; allowNoPasswordLogin = true;
}; };
systemd.services.mastodon-media-auto-remove = {
description = "Mastodon media auto remove";
serviceConfig = {
Type = "oneshot";
EnvironmentFile = "/var/lib/mastodon/.secrets_env";
};
script = ''
/run/current-system/sw/bin/mastodon-tootctl media remove --days=8 --prune-profiles --include-follows -c1
/run/current-system/sw/bin/mastodon-tootctl media remove --days=8 --remove-headers --include-follows -c1
/run/current-system/sw/bin/mastodon-tootctl preview_cards remove --days=8
'';
startAt = "daily";
};
services.mastodon = { services.mastodon = {
enable = true; enable = true;
inherit package; inherit package;
localDomain = "${domain}"; localDomain = "${domain}";
user = systemUserName; user = systemUserName;
group = systemGroupName; group = systemGroupName;
mediaAutoRemove.enable = false;
smtp = { smtp = {
host = "smtp.eu.mailgun.org"; host = "smtp.eu.mailgun.org";
port = 465; port = 465;
@ -130,7 +146,7 @@ in {
createLocally = false; createLocally = false;
passwordFile = "${mailgunSmtpPasswordPath}"; passwordFile = "${mailgunSmtpPasswordPath}";
}; };
sidekiqThreads = 32; sidekiqThreads = 8;
extraConfig = { extraConfig = {
SMTP_TLS = "true"; SMTP_TLS = "true";
SMTP_ENABLE_STARTTLS_AUTO = "true"; SMTP_ENABLE_STARTTLS_AUTO = "true";

View file

@ -1,12 +1,8 @@
{ { config, pkgs, inputs, lib, ... }:
config, let
pkgs,
inputs,
lib,
...
}: let
port = 8080; port = 8080;
domain = "news.cyplo.dev"; domain = "news.cyplo.dev";
postgresPort = 5435;
in { in {
imports = [ ../nginx.nix ]; imports = [ ../nginx.nix ];
@ -22,38 +18,33 @@ in {
containers.rss = { containers.rss = {
autoStart = true; autoStart = true;
forwardPorts = [ forwardPorts = [{
{
containerPort = port; containerPort = port;
hostPort = port; hostPort = port;
} }];
]; config = { config, pkgs, ... }:
config = { let
config,
pkgs,
...
}: let
inherit (config.services.tt-rss) pool; inherit (config.services.tt-rss) pool;
inherit (config.services.tt-rss) root; inherit (config.services.tt-rss) root;
in { in {
system.stateVersion = "22.05"; system.stateVersion = "22.11";
services.postgresql.port = postgresPort;
services.tt-rss = { services.tt-rss = {
enable = true; enable = true;
selfUrlPath = "https://${domain}"; selfUrlPath = "https://${domain}";
virtualHost = null; virtualHost = null;
registration.enable = false; registration.enable = false;
simpleUpdateMode = true; simpleUpdateMode = true;
database.port = postgresPort;
}; };
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {
"${domain}" = { "${domain}" = {
listen = [ listen = [{
{
inherit port; inherit port;
addr = "0.0.0.0"; addr = "0.0.0.0";
} }];
];
root = "${root}/www"; root = "${root}/www";
locations."/" = { index = "index.php"; }; locations."/" = { index = "index.php"; };
locations."^~ /feed-icons" = { root = "${root}"; }; locations."^~ /feed-icons" = { root = "${root}"; };