diff --git a/service/snowcord/build/Dockerfile b/service/snowcord/build/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..24dc3d45b29868377ab4398fde9d5e7b8ffe11e9 --- /dev/null +++ b/service/snowcord/build/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.io/library/node:26.13.1-bookworm@sha256:b7087bc4d973034b30854b378ba107f9fab622b47514cb7e2592e41b8bab8d49 +COPY start.sh /start.sh +CMD ["/start.sh"] diff --git a/service/snowcord/build/start.sh b/service/snowcord/build/start.sh new file mode 100755 index 0000000000000000000000000000000000000000..a8d01e7f2ee5d8bf2dbc0e6c478e28e371674e01 --- /dev/null +++ b/service/snowcord/build/start.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +rm -rf /work/src +mkdir -p /work/src +git -c safe.directory='*' --git-dir /source.git archive "$BRANCH" services/snowcord | tar -x -C /work/src +cd /work/src/services/snowcord +npm ci --include=dev +npm run build +exec node dist/src/main.js diff --git a/service/snowcord/service.pkl b/service/snowcord/service.pkl new file mode 100644 index 0000000000000000000000000000000000000000..c44a5621c792f19654f711773c3f60f33a816f3e --- /dev/null +++ b/service/snowcord/service.pkl @@ -0,0 +1,46 @@ +amends "../../config/Service.pkl" + +import "../../config/site.pkl" as site + +local host = module.container.http.hostname + +name = "Snowcord" +tagline = "Plugin record sync for the Articuno Discord mod" +launcher = false +healthyDeadline = "5m" + +requiredSecrets { "discord_client_secret"; "session_encryption_key" } + +container { + build = "build" + cpu = 500 + memory = 768 + + http { + containerPort = 8787 + subdomain = "snowcord" + } + + volumes { + ["/data"] {} + ["/work"] {} + // Articuno's Shale repository, which keeps it under its UUID through renames. + ["/source.git"] { src = "\(site.root)/prod/shale/repositories_owned/006ABG3FTYNV0FMR55QPHGY9G1"; readOnly = true } + } + + env { + ["BRANCH"] = "clover/sync-api" + ["HOME"] = "/work" + ["NODE_ENV"] = "production" + ["DISCORD_CLIENT_ID"] = "1573069861699981404" + ["DISCORD_CLIENT_SECRET"] = "${secret.own.discord_client_secret}" + ["DISCORD_REDIRECT_URI"] = "https://\(host)/oauth/discord" + ["SESSION_ENCRYPTION_KEY"] = "${secret.own.session_encryption_key}" + ["DB_PATH"] = "/data/snowcord.sqlite" + ["HOST"] = "0.0.0.0" + ["PORT"] = "8787" + // Caddy as seen across the Podman bridge. + ["TRUST_PROXY_IP"] = "10.88.0.1" + ["CORS_ORIGINS"] = "https://discord.com,https://canary.discord.com,https://ptb.discord.com" + } +}