nixos-config/hosts/chunk/ghost.nix

53 lines
1.3 KiB
Nix
Raw Normal View History

2024-12-17 02:09:57 -05:00
{
pkgs,
config,
...
2024-12-19 02:32:58 -05:00
}:
{
2024-12-17 00:55:28 -05:00
virtualisation.oci-containers.containers.ghost = {
2024-12-17 02:09:57 -05:00
image = "ghost:5-alpine";
2024-12-17 00:55:28 -05:00
autoStart = true;
2024-12-19 02:32:58 -05:00
ports = [ "127.0.0.1:8084:2368" ];
2024-12-17 02:09:57 -05:00
pull = "newer";
2024-12-17 00:55:28 -05:00
environment = {
database__client = "mysql";
database__connection__host = "ghost-db";
database__connection__user = "root";
database__connection__password = "example";
database__connection__databse = "ghost";
url = "https://cything.io";
NODE_ENV = "production";
};
volumes = [
"/opt/ghost/data:/var/lib/ghost/content"
];
2024-12-19 02:32:58 -05:00
networks = [ "ghost-net" ];
dependsOn = [ "ghost-db" ];
2024-12-17 00:55:28 -05:00
};
virtualisation.oci-containers.containers.ghost-db = {
image = "mysql:8.0";
autoStart = true;
2024-12-17 02:09:57 -05:00
pull = "newer";
2024-12-17 00:55:28 -05:00
environment = {
MYSQL_ROOT_PASSWORD = "example";
};
volumes = [
"/opt/ghost/db:/var/lib/mysql"
];
2024-12-19 02:32:58 -05:00
networks = [ "ghost-net" ];
2024-12-17 02:09:57 -05:00
};
systemd.services.create-ghost-net = {
serviceConfig.Type = "oneshot";
wantedBy = with config.virtualisation.oci-containers; [
"${backend}-ghost.service"
"${backend}-ghost-db.service"
2024-12-17 00:55:28 -05:00
];
2024-12-17 02:09:57 -05:00
script = ''
${pkgs.podman}/bin/podman network exists ghost-net || \
${pkgs.podman}/bin/podman network create ghost-net
'';
2024-12-17 00:55:28 -05:00
};
}