From fd85f1cd211ac286fcc176476ba710299b6a0d27 Mon Sep 17 00:00:00 2001 From: wizzdom Date: Sat, 21 Feb 2026 14:35:48 +0000 Subject: [PATCH 1/2] =?UTF-8?q?add=20kylmc=20STONKS=20=F0=9F=93=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jobs/user-projects/general/kylmc-stonks.hcl | 226 ++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 jobs/user-projects/general/kylmc-stonks.hcl diff --git a/jobs/user-projects/general/kylmc-stonks.hcl b/jobs/user-projects/general/kylmc-stonks.hcl new file mode 100644 index 0000000..b3064a9 --- /dev/null +++ b/jobs/user-projects/general/kylmc-stonks.hcl @@ -0,0 +1,226 @@ +job "kylmc-stonks" { + datacenters = ["aperture"] + type = "service" + + meta { + domain = "kylmc-stonks.rb.dcu.ie" + stonks = "stonks" + } + + group "stonks" { + network { + mode = "bridge" + port "http" {} + } + + update { + max_parallel = 1 + health_check = "checks" + min_healthy_time = "10s" + healthy_deadline = "5m" + } + + service { + name = "kylmc-stonks" + port = "http" + + check { + type = "http" + path = "/" + interval = "10s" + timeout = "2s" + } + + tags = [ + "traefik.enable=true", + "traefik.port=${NOMAD_PORT_http}", + "traefik.http.routers.kylmc-stonks.entrypoints=web,websecure", + "traefik.http.routers.kylmc-stonks.rule=Host(`${NOMAD_META_domain}`)", + "traefik.http.routers.kylmc-stonks.tls=true", + "traefik.http.routers.kylmc-stonks.tls.certresolver=rb", + ] + } + + task "app" { + driver = "docker" + + config { + image = "ghcr.io/kylemc32532/stock-portfolio-tracker:latest" + ports = ["http"] + force_pull = true + auth { + username = "${DOCKER_USER}" + password = "${DOCKER_PASS}" + } + + # volumes = [ + # "/storage/nomad/${NOMAD_JOB_NAME}/uploads:/uploads", + # ] + } + + resources { + cpu = 1000 + memory = 500 + } + + template { + destination = "local/.env" + env = true + data = < 0), + PRIMARY KEY (portfolio_uuid, currency) +); + +CREATE TABLE IF NOT EXISTS holdings ( + portfolio_uuid UUID NOT NULL REFERENCES portfolios(uuid) ON DELETE CASCADE, + symbol TEXT NOT NULL, + shares NUMERIC NOT NULL CHECK (shares > 0), + PRIMARY KEY (portfolio_uuid, symbol) +); + +CREATE TABLE IF NOT EXISTS price_history ( + symbol TEXT NOT NULL, + date DATE NOT NULL, + close NUMERIC NOT NULL, + PRIMARY KEY (symbol, date) +); + +CREATE TABLE IF NOT EXISTS watchlist ( + portfolio_uuid UUID NOT NULL REFERENCES portfolios(uuid) ON DELETE CASCADE, + symbol TEXT NOT NULL, + PRIMARY KEY (portfolio_uuid, symbol) +); + +CREATE TABLE IF NOT EXISTS fx_rates ( + base TEXT NOT NULL, + target TEXT NOT NULL, + rate NUMERIC NOT NULL, + fetched_at TIMESTAMPTZ NOT NULL, + PRIMARY KEY (base, target) +); +EOH + } + } + } +} From 10e7515fb3fdc83d3c91c0d09433cc91a022207a Mon Sep 17 00:00:00 2001 From: wizzdom Date: Sat, 21 Feb 2026 14:39:27 +0000 Subject: [PATCH 2/2] cleanup --- jobs/user-projects/general/kylmc-stonks.hcl | 37 +++++++++------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/jobs/user-projects/general/kylmc-stonks.hcl b/jobs/user-projects/general/kylmc-stonks.hcl index b3064a9..862bdb3 100644 --- a/jobs/user-projects/general/kylmc-stonks.hcl +++ b/jobs/user-projects/general/kylmc-stonks.hcl @@ -4,7 +4,6 @@ job "kylmc-stonks" { meta { domain = "kylmc-stonks.rb.dcu.ie" - stonks = "stonks" } group "stonks" { @@ -52,34 +51,30 @@ job "kylmc-stonks" { username = "${DOCKER_USER}" password = "${DOCKER_PASS}" } - - # volumes = [ - # "/storage/nomad/${NOMAD_JOB_NAME}/uploads:/uploads", - # ] } resources { - cpu = 1000 - memory = 500 + cpu = 300 + memory = 300 } template { destination = "local/.env" env = true data = <