take ghost to titan
This commit is contained in:
parent
b6a16534ea
commit
bfb5a13e34
5 changed files with 108 additions and 16 deletions
25
hosts/titan/Caddyfile
Normal file
25
hosts/titan/Caddyfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
acme_ca https://acme.zerossl.com/v2/DV90
|
||||
acme_eab {
|
||||
key_id {$EAB_KEY_ID}
|
||||
mac_key {$EAB_MAC_KEY}
|
||||
}
|
||||
}
|
||||
|
||||
(common) {
|
||||
encode zstd gzip
|
||||
header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
|
||||
}
|
||||
|
||||
cything.io {
|
||||
import common
|
||||
reverse_proxy localhost:8084
|
||||
|
||||
respond /.well-known/matrix/server {"m.server":"chat.cything.io:443"}
|
||||
respond /.well-known/matrix/client {"m.server":{"base_url":"https://chat.cything.io"},"m.homeserver":{"base_url":"https://chat.cything.io"},"org.matrix.msc3575.proxy":{"url":"https://chat.cything.io"}}
|
||||
}
|
||||
|
||||
www.cything.io {
|
||||
import common
|
||||
redir https://cything.io{uri} permanent
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{ modulesPath, lib, pkgs, ...}:
|
||||
{ modulesPath, config, lib, pkgs, ...}:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
|
@ -8,6 +8,13 @@
|
|||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
sops.age.keyFile = "/root/.config/sops/age/keys.txt";
|
||||
sops.secrets = {
|
||||
"caddy/env" = {
|
||||
sopsFile = ../../secrets/services/caddy.yaml;
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
|
@ -62,4 +69,25 @@
|
|||
443
|
||||
];
|
||||
};
|
||||
|
||||
# container stuff
|
||||
virtualisation.containers.enable = true;
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
# create 'docker' alias for podman, to use as
|
||||
# drop-in replacement
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings = {
|
||||
dns_enabled = true;
|
||||
ipv6_enabled = true;
|
||||
};
|
||||
};
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
configFile = ./Caddyfile;
|
||||
environmentFile = config.sops.secrets."caddy/env".path;
|
||||
logFormat = lib.mkForce "level INFO";
|
||||
};
|
||||
}
|
||||
|
|
52
hosts/titan/ghost.nix
Normal file
52
hosts/titan/ghost.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
virtualisation.oci-containers.containers.ghost = {
|
||||
image = "ghost:5-alpine";
|
||||
autoStart = true;
|
||||
ports = [ "127.0.0.1:8084:2368" ];
|
||||
pull = "newer";
|
||||
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"
|
||||
];
|
||||
networks = [ "ghost-net" ];
|
||||
dependsOn = [ "ghost-db" ];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.ghost-db = {
|
||||
image = "mysql:8.0";
|
||||
autoStart = true;
|
||||
pull = "newer";
|
||||
environment = {
|
||||
MYSQL_ROOT_PASSWORD = "example";
|
||||
};
|
||||
volumes = [
|
||||
"/opt/ghost/db:/var/lib/mysql"
|
||||
];
|
||||
networks = [ "ghost-net" ];
|
||||
};
|
||||
|
||||
systemd.services.create-ghost-net = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = with config.virtualisation.oci-containers; [
|
||||
"${backend}-ghost.service"
|
||||
"${backend}-ghost-db.service"
|
||||
];
|
||||
script = ''
|
||||
${pkgs.podman}/bin/podman network exists ghost-net || \
|
||||
${pkgs.podman}/bin/podman network create ghost-net
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue