2024-09-09 00:22:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-09-13 01:50:53 +00:00
|
|
|
with lib; let
|
2024-09-09 00:22:14 +00:00
|
|
|
cfg = config.custom.settings.containers.mastodon;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
options.custom.settings.containers.mastodon.enable = mkOption {default = false;};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-09-13 01:50:53 +00:00
|
|
|
age.secrets = let
|
|
|
|
secret = filename: {
|
|
|
|
file = "${inputs.self}/secrets/${filename}";
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
"${config.custom.profile}/mastodon/.env" = secret "${config.custom.profile}/mastodon/.env";
|
|
|
|
"${config.custom.profile}/mastodon/db.env" = secret "${config.custom.profile}/mastodon/db.env";
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
#?? arion-mastodon pull
|
|
|
|
environment.shellAliases.arion-mastodon = "sudo arion --prebuilt-file ${config.virtualisation.arion.projects.mastodon.settings.out.dockerComposeYaml}";
|
|
|
|
|
|
|
|
virtualisation.arion.projects.mastodon = {
|
|
|
|
serviceName = "mastodon";
|
|
|
|
|
|
|
|
settings.services = {
|
|
|
|
# https://github.com/linuxserver/docker-mastodon
|
|
|
|
# https://github.com/mastodon/mastodon/blob/main/docker-compose.yml
|
|
|
|
mastodon.service = {
|
|
|
|
container_name = "mastodon";
|
2024-09-13 01:50:53 +00:00
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/mastodon/.env".path];
|
2024-09-09 00:22:14 +00:00
|
|
|
image = "lscr.io/linuxserver/mastodon:4.2.12";
|
2024-09-13 01:50:53 +00:00
|
|
|
ports = ["3000:443"];
|
2024-09-09 00:22:14 +00:00
|
|
|
restart = "unless-stopped";
|
2024-09-13 01:50:53 +00:00
|
|
|
volumes = ["${config.custom.settings.containers.directory}/mastodon/config:/config"];
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
depends_on = [
|
|
|
|
"cache"
|
|
|
|
"db"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
cache.service = {
|
|
|
|
container_name = "mastodon-cache";
|
|
|
|
image = "redis:latest";
|
|
|
|
restart = "unless-stopped";
|
2024-09-13 01:50:53 +00:00
|
|
|
volumes = ["${config.custom.settings.containers.directory}/mastodon/cache:/data"];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
db.service = {
|
|
|
|
container_name = "mastodon-db";
|
2024-09-13 01:50:53 +00:00
|
|
|
env_file = [config.age.secrets."${config.custom.profile}/mastodon/db.env".path];
|
2024-09-09 00:22:14 +00:00
|
|
|
image = "postgres:15";
|
|
|
|
restart = "unless-stopped";
|
2024-09-13 01:50:53 +00:00
|
|
|
volumes = ["${config.custom.settings.containers.directory}/mastodon/db:/var/lib/postgresql/data"];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|