WIP: Migrate from Docker to NixOS Containers. #67
|
@ -1,19 +1,17 @@
|
|||
{ pkgs
|
||||
, storage
|
||||
{ storage
|
||||
, domain
|
||||
, mkContainer
|
||||
, mkContainerConfig
|
||||
, mkContainerDir
|
||||
, ... } @args: let
|
||||
address = "10.1.0.41";
|
||||
path = "${storage}/change";
|
||||
in {
|
||||
systemd.tmpfiles.rules = map (
|
||||
dirName: "d '${path}/${dirName}' 1777 root root - -"
|
||||
) [ "data" ];
|
||||
|
||||
containers.change = mkContainer {
|
||||
autoStart = true;
|
||||
localAddress = "10.1.0.41";
|
||||
privateNetwork = true;
|
||||
systemd.tmpfiles.rules = map (dir: mkContainerDir "${path}/${dir}") [
|
||||
"data"
|
||||
];
|
||||
|
||||
containers.change = mkContainer address {
|
||||
bindMounts = {
|
||||
"/var/lib/changedetection-io" = {
|
||||
hostPath = "${path}/data";
|
||||
|
@ -21,10 +19,12 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = { config, lib, pkgs, ... }: mkContainerConfig {
|
||||
config = { ... }: mkContainerConfig {
|
||||
services.changedetection-io = {
|
||||
enable = true;
|
||||
baseURL = "https://change.${domain}";
|
||||
behindProxy = true;
|
||||
listenAddress = address;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,26 +2,24 @@
|
|||
, storage
|
||||
, const
|
||||
, domain
|
||||
, host
|
||||
, util
|
||||
, mkContainer
|
||||
, mkContainerConfig
|
||||
, mkContainerDir
|
||||
, mkServer
|
||||
, ... } @args: let
|
||||
path = "${storage}/paste";
|
||||
package = (pkgs.callPackage ./pastebin args);
|
||||
address = "10.1.0.14";
|
||||
fqdn = "paste.${domain}";
|
||||
package = (pkgs.callPackage ./pastebin args);
|
||||
path = "${storage}/paste";
|
||||
in {
|
||||
systemd.tmpfiles.rules = map (
|
||||
dirName: "d '${path}/${dirName}' 1777 root root - -"
|
||||
) [ "data" "tmp" "nginxtmp" "config" ];
|
||||
|
||||
containers.paste = mkContainer {
|
||||
autoStart = true;
|
||||
hostAddress = host;
|
||||
localAddress = "10.1.0.14";
|
||||
privateNetwork = true;
|
||||
systemd.tmpfiles.rules = map (dir: mkContainerDir "${path}/${dir}") [
|
||||
"data"
|
||||
"tmp"
|
||||
"nginxtmp"
|
||||
];
|
||||
|
||||
containers.paste = mkContainer address {
|
||||
bindMounts = {
|
||||
"/srv/data" = {
|
||||
hostPath = "${path}/data";
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
{ pkgs
|
||||
, storage
|
||||
{ storage
|
||||
, const
|
||||
, host
|
||||
, mkContainer
|
||||
, mkContainerConfig
|
||||
, mkContainerDir
|
||||
, ... } @args: let
|
||||
address = "10.1.0.3";
|
||||
path = "${storage}/postgres";
|
||||
in {
|
||||
systemd.tmpfiles.rules = map (
|
||||
dirName: "d '${path}/${dirName}' 1777 root root - -"
|
||||
) [ "data" ];
|
||||
|
||||
containers.postgres = mkContainer {
|
||||
autoStart = true;
|
||||
localAddress = "10.1.0.3";
|
||||
privateNetwork = true;
|
||||
systemd.tmpfiles.rules = map (dir: mkContainerDir "${path}/${dir}") [
|
||||
"data"
|
||||
];
|
||||
|
||||
containers.postgres = mkContainer address {
|
||||
bindMounts = {
|
||||
"/var/lib/postgresql/data" = {
|
||||
hostPath = "${path}/data";
|
||||
|
@ -23,7 +20,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = { config, lib, pkgs, ... }: mkContainerConfig {
|
||||
config = { lib, pkgs, ... }: mkContainerConfig {
|
||||
system.stateVersion = const.stateVersion;
|
||||
|
||||
users.users.root.password = "";
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
{ pkgs
|
||||
, storage
|
||||
{ storage
|
||||
, const
|
||||
, host
|
||||
, util
|
||||
, domain
|
||||
, mkContainer
|
||||
, mkContainerConfig
|
||||
, mkContainerDir
|
||||
, ... } @args: let
|
||||
address = "10.1.0.2";
|
||||
path = "${storage}/proxy";
|
||||
virtualHosts = util.catSet (util.ls ./proxy/host) args;
|
||||
in {
|
||||
systemd.tmpfiles.rules = map (
|
||||
dirName: "d '${path}/${dirName}' 1777 root root - -"
|
||||
) [ "challenge" "letsencrypt" ];
|
||||
|
||||
containers.proxy = mkContainer {
|
||||
autoStart = true;
|
||||
hostAddress = host;
|
||||
localAddress = "10.1.0.2";
|
||||
privateNetwork = true;
|
||||
systemd.tmpfiles.rules = map (dir: mkContainerDir "${path}/${dir}") [
|
||||
"challenge"
|
||||
"letsencrypt"
|
||||
];
|
||||
|
||||
containers.proxy = mkContainer address {
|
||||
bindMounts = {
|
||||
"/etc/letsencrypt" = {
|
||||
hostPath = "${path}/letsencrypt";
|
||||
|
@ -31,7 +27,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = { config, lib, pkgs, ... }: mkContainerConfig {
|
||||
config = { lib, pkgs, ... }: mkContainerConfig {
|
||||
system.stateVersion = const.stateVersion;
|
||||
|
||||
users.users.root.password = "";
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
{ domain, util, mkServer, ... }: {
|
||||
}
|
|
@ -6,8 +6,11 @@
|
|||
in {
|
||||
inherit storage domain host pkgs const lib config util;
|
||||
|
||||
mkContainer = cfg: lib.recursiveUpdate cfg {
|
||||
mkContainer = address: cfg: lib.recursiveUpdate cfg {
|
||||
autoStart = true;
|
||||
hostAddress = host;
|
||||
localAddress = address;
|
||||
privateNetwork = true;
|
||||
};
|
||||
|
||||
mkContainerConfig = cfg: lib.recursiveUpdate cfg {
|
||||
|
@ -22,6 +25,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
mkContainerDir = path: "d '${path}' 1777 root root - -";
|
||||
|
||||
mkServer = cfg: lib.recursiveUpdate cfg {
|
||||
forceSSL = false;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue