mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 19:51:34 +01:00
Shorten the subdomains of hosted services
This commit is contained in:
parent
18bbe1fd27
commit
4db060800b
6 changed files with 50 additions and 24 deletions
|
|
@ -1,42 +1,46 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
serviceName = "actualbudget";
|
||||
subdomain = "budget";
|
||||
in
|
||||
{
|
||||
sops.secrets."container/actualbudget/tailscale-auth-key" = { };
|
||||
sops.secrets."container/${serviceName}/tailscale-auth-key" = { };
|
||||
|
||||
virtualisation.oci-containers.containers = {
|
||||
actualbudget = {
|
||||
${serviceName} = {
|
||||
image = "ghcr.io/actualbudget/actual-server:latest";
|
||||
volumes = [ "/data/actualbudget:/data" ];
|
||||
volumes = [ "/data/${serviceName}:/data" ];
|
||||
};
|
||||
|
||||
tailscale-actualbudget =
|
||||
"tailscale-${serviceName}" =
|
||||
let
|
||||
configPath = pkgs.writeTextFile {
|
||||
name = "config";
|
||||
destination = "/tailscale-serve.json";
|
||||
text = builtins.toJSON {
|
||||
TCP."443".HTTPS = true;
|
||||
Web."actualbudget.${config.networking.domain}:443".Handlers."/".Proxy = "http://127.0.0.1:5006";
|
||||
Web."${subdomain}.${config.networking.domain}:443".Handlers."/".Proxy = "http://127.0.0.1:5006";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
image = "ghcr.io/tailscale/tailscale:latest";
|
||||
environment = {
|
||||
TS_HOSTNAME = "actualbudget";
|
||||
TS_HOSTNAME = subdomain;
|
||||
TS_STATE_DIR = "/var/lib/tailscale";
|
||||
TS_SERVE_CONFIG = "/config/tailscale-serve.json";
|
||||
TS_USERSPACE = "true"; # https://github.com/tailscale/tailscale/issues/11372
|
||||
};
|
||||
environmentFiles = [
|
||||
# Contains "TS_AUTHKEY=<token>"
|
||||
config.sops.secrets."container/actualbudget/tailscale-auth-key".path
|
||||
config.sops.secrets."container/${serviceName}/tailscale-auth-key".path
|
||||
];
|
||||
volumes = [
|
||||
"/var/lib/tailscale-actualbudget:/var/lib/tailscale"
|
||||
"/var/lib/tailscale-${serviceName}:/var/lib/tailscale"
|
||||
"${configPath}:/config"
|
||||
];
|
||||
extraOptions = [ "--network=container:actualbudget" ];
|
||||
dependsOn = [ "actualbudget" ];
|
||||
extraOptions = [ "--network=container:${serviceName}" ];
|
||||
dependsOn = [ serviceName ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,52 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
serviceName = "onlyoffice";
|
||||
subdomain = "office";
|
||||
in
|
||||
{
|
||||
sops.secrets = {
|
||||
"container/onlyoffice/tailscale-auth-key" = { };
|
||||
"container/onlyoffice/jwt-secret" = { };
|
||||
"container/${serviceName}/tailscale-auth-key" = { };
|
||||
"container/${serviceName}/jwt-secret" = { };
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers = {
|
||||
onlyoffice = {
|
||||
${serviceName} = {
|
||||
image = "onlyoffice/documentserver";
|
||||
environmentFiles = [
|
||||
# Contains "JWT_SECRET=<token>"
|
||||
config.sops.secrets."container/onlyoffice/jwt-secret".path
|
||||
config.sops.secrets."container/${serviceName}/jwt-secret".path
|
||||
];
|
||||
};
|
||||
|
||||
tailscale-onlyoffice =
|
||||
"tailscale-${serviceName}" =
|
||||
let
|
||||
configPath = pkgs.writeTextFile {
|
||||
name = "config";
|
||||
destination = "/tailscale-serve.json";
|
||||
text = builtins.toJSON {
|
||||
TCP."443".HTTPS = true;
|
||||
Web."onlyoffice.${config.networking.domain}:443".Handlers."/".Proxy = "http://127.0.0.1:80";
|
||||
Web."${subdomain}.${config.networking.domain}:443".Handlers."/".Proxy = "http://127.0.0.1:80";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
image = "ghcr.io/tailscale/tailscale:latest";
|
||||
environment = {
|
||||
TS_HOSTNAME = "onlyoffice";
|
||||
TS_HOSTNAME = subdomain;
|
||||
TS_STATE_DIR = "/var/lib/tailscale";
|
||||
TS_SERVE_CONFIG = "/config/tailscale-serve.json";
|
||||
TS_USERSPACE = "true"; # https://github.com/tailscale/tailscale/issues/11372
|
||||
};
|
||||
environmentFiles = [
|
||||
# Contains "TS_AUTHKEY=<token>"
|
||||
config.sops.secrets."container/onlyoffice/tailscale-auth-key".path
|
||||
config.sops.secrets."container/${serviceName}/tailscale-auth-key".path
|
||||
];
|
||||
volumes = [
|
||||
"/var/lib/tailscale-onlyoffice:/var/lib/tailscale"
|
||||
"/var/lib/tailscale-${serviceName}:/var/lib/tailscale"
|
||||
"${configPath}:/config"
|
||||
];
|
||||
extraOptions = [ "--network=container:onlyoffice" ];
|
||||
dependsOn = [ "onlyoffice" ];
|
||||
extraOptions = [ "--network=container:${serviceName}" ];
|
||||
dependsOn = [ serviceName ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue