sparky but broken testing
This commit is contained in:
@@ -76,6 +76,8 @@ let
|
||||
settings = {
|
||||
installed = true;
|
||||
overwrite.cli.url = "https://cloud.mjallen.dev";
|
||||
overwriteprotocol = "https";
|
||||
overwritehost = "cloud.mjallen.dev";
|
||||
log_type = "file";
|
||||
default_phone_region = "US";
|
||||
trusted_proxies = [ "10.0.1.3" ];
|
||||
|
||||
121
modules/nixos/services/sparky-fitness/default.nix
Normal file
121
modules/nixos/services/sparky-fitness/default.nix
Normal file
@@ -0,0 +1,121 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
name = "sparky-fitness-server";
|
||||
cfg = config.${namespace}.services.${name};
|
||||
|
||||
sparky-fitness-server = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
serviceName = "podman-${name}";
|
||||
description = "sparky-fitness-server";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers.${name} = {
|
||||
autoStart = true;
|
||||
image = "codewithcj/sparkyfitness_server";
|
||||
ports = [ "${toString cfg.port}:3010" ];
|
||||
volumes = [
|
||||
"${cfg.configDir}/sparky-fitness/server/backup:/app/SparkyFitnessServer/backup"
|
||||
"${cfg.configDir}/sparky-fitness/server/uploads:/app/SparkyFitnessServer/uploads"
|
||||
];
|
||||
# environmentFiles = [
|
||||
# "${cfg.configDir}/lubelogger/lubelogger.env"
|
||||
# ];
|
||||
environment = {
|
||||
SPARKY_FITNESS_LOG_LEVEL = "0";
|
||||
ALLOW_PRIVATE_NETWORK_CORS = "false";
|
||||
SPARKY_FITNESS_EXTRA_TRUSTED_ORIGINS = "";
|
||||
SPARKY_FITNESS_DB_USER = "sparkyfitness";
|
||||
SPARKY_FITNESS_DB_HOST = "10.0.1.3"; # Use the service name 'sparkyfitness-db' for inter-container communication
|
||||
SPARKY_FITNESS_DB_NAME = "sparkyfitness";
|
||||
SPARKY_FITNESS_DB_PASSWORD = "sparkyfitness";
|
||||
SPARKY_FITNESS_APP_DB_USER = "sparkyfitness";
|
||||
SPARKY_FITNESS_APP_DB_PASSWORD = "sparkyfitness";
|
||||
SPARKY_FITNESS_DB_PORT = "${toString dbCfg.port}";
|
||||
SPARKY_FITNESS_API_ENCRYPTION_KEY = "088ab2c6487ca1048c1fe74a4d8bd906e88db56953406769426b615d6df2407b";
|
||||
# Uncomment the line below and comment the line above to use a file-based secret
|
||||
# SPARKY_FITNESS_API_ENCRYPTION_KEY_FILE: /run/secrets/sparkyfitness_api_key
|
||||
|
||||
BETTER_AUTH_SECRET = "a0304bda5a9efd0d92595c8d46526e33d58f436408f6b70ea37c2b84308d9abe";
|
||||
# Uncomment the line below and comment the line above to use a file-based secret
|
||||
# BETTER_AUTH_SECRET_FILE: /run/secrets/sparkyfitness_better_auth_secret
|
||||
SPARKY_FITNESS_FRONTEND_URL = "http://10.0.1.3:${toString frontendCfg.port}";
|
||||
SPARKY_FITNESS_DISABLE_SIGNUP = "false";
|
||||
SPARKY_FITNESS_ADMIN_EMAIL = "jalle008@proton.me"; #User with this email can access the admin panel
|
||||
# SPARKY_FITNESS_EMAIL_HOST = "${SPARKY_FITNESS_EMAIL_HOST}";
|
||||
# SPARKY_FITNESS_EMAIL_PORT = "${SPARKY_FITNESS_EMAIL_PORT}";
|
||||
# SPARKY_FITNESS_EMAIL_SECURE = "${SPARKY_FITNESS_EMAIL_SECURE}";
|
||||
# SPARKY_FITNESS_EMAIL_USER = "${SPARKY_FITNESS_EMAIL_USER}";
|
||||
# SPARKY_FITNESS_EMAIL_PASS = "${SPARKY_FITNESS_EMAIL_PASS}";
|
||||
# SPARKY_FITNESS_EMAIL_FROM = "${SPARKY_FITNESS_EMAIL_FROM}";
|
||||
PUID = toString config.users.users.nix-apps.uid;
|
||||
PGID = toString config.users.groups.jallen-nas.gid;
|
||||
TZ = "America/Chicago";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fontendName = "sparky-fitness";
|
||||
frontendCfg = config.${namespace}.services.${fontendName};
|
||||
|
||||
sparky-fitness-frontend = lib.${namespace}.mkModule {
|
||||
inherit config;
|
||||
name = fontendName;
|
||||
serviceName = "podman-${fontendName}";
|
||||
description = "sparky-fitness";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers.${fontendName} = {
|
||||
autoStart = true;
|
||||
image = "codewithcj/sparkyfitness";
|
||||
ports = [ "${toString frontendCfg.port}:80" ];
|
||||
environment = {
|
||||
SPARKY_FITNESS_FRONTEND_URL = "http://10.0.1.3:${toString frontendCfg.port}";
|
||||
SPARKY_FITNESS_SERVER_HOST = "10.0.1.3";
|
||||
SPARKY_FITNESS_SERVER_PORT = "${toString cfg.port}";
|
||||
PUID = toString config.users.users.nix-apps.uid;
|
||||
PGID = toString config.users.groups.jallen-nas.gid;
|
||||
TZ = "America/Chicago";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dbName = "sparky-fitness-db";
|
||||
dbCfg = config.${namespace}.services.${dbName};
|
||||
|
||||
sparky-fitness-db = lib.${namespace}.mkModule {
|
||||
inherit config;
|
||||
name = dbName;
|
||||
serviceName = "podman-${dbName}";
|
||||
description = "sparky-fitness-db";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers.${dbName} = {
|
||||
autoStart = true;
|
||||
image = "postgres:15-alpine";
|
||||
ports = [ "${toString dbCfg.port}:5432" ];
|
||||
volumes = [
|
||||
"${dbCfg.configDir}/sparky-fitness/db:/var/lib/postgresql/data"
|
||||
];
|
||||
environment = {
|
||||
POSTGRES_DB = "sparkyfitness-db";
|
||||
POSTGRES_USER = "sparkyfitness";
|
||||
POSTGRES_PASSWORD = "sparkyfitness";
|
||||
PUID = toString config.users.users.nix-apps.uid;
|
||||
PGID = toString config.users.groups.jallen-nas.gid;
|
||||
TZ = "America/Chicago";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ sparky-fitness-server sparky-fitness-frontend sparky-fitness-db ];
|
||||
}
|
||||
@@ -192,6 +192,18 @@ in
|
||||
enable = true;
|
||||
port = 8008;
|
||||
};
|
||||
sparky-fitness-db = {
|
||||
enable = false;
|
||||
port = 5433;
|
||||
};
|
||||
sparky-fitness-server = {
|
||||
enable = true;
|
||||
port = 3010;
|
||||
};
|
||||
sparky-fitness = {
|
||||
enable = true;
|
||||
port = 3004;
|
||||
};
|
||||
sunshine = {
|
||||
enable = true;
|
||||
port = 47989;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"nextcloud"
|
||||
"onlyoffice"
|
||||
"synapse"
|
||||
"sparkyfitness"
|
||||
];
|
||||
ensureUsers = [
|
||||
{
|
||||
@@ -66,6 +67,10 @@
|
||||
name = "synapse";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "sparkyfitness";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
# Allow access via pg_hba.conf rules:10.88.0.63
|
||||
authentication = pkgs.lib.mkOverride 50 ''
|
||||
@@ -79,6 +84,11 @@
|
||||
host onlyoffice onlyoffice 10.0.1.0/24 trust
|
||||
local synapse synapse trust
|
||||
host synapse synapse ::1/128 trust
|
||||
local sparkyfitness sparkyfitness trust
|
||||
host sparkyfitness sparkyfitness ::1/128 trust
|
||||
'';
|
||||
initialScript = pkgs.writeText "init-sql-script" ''
|
||||
alter user sparkyfitness with password 'sparkyfitness';
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user