Compare commits

..

3 Commits

Author SHA1 Message Date
b63abca296 Add MAILGUN_URL for EU region
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 22:29:08 +00:00
1311aadffb Remove phaseflow-cron batch job
No longer needed - cron scheduling now handled by instrumentation.ts
inside the main phaseflow app.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 22:16:20 +00:00
f903ddeee5 Update phaseflow secrets for Mailgun email provider
Switch from resend_api_key to mailgun_api_key and mailgun_domain.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 19:37:45 +00:00
2 changed files with 5 additions and 54 deletions

View File

@@ -1,52 +0,0 @@
# ABOUTME: Periodic batch job for PhaseFlow Garmin sync.
# ABOUTME: Triggers daily sync at 6 AM to fetch fitness data and generate training recommendations.
job "phaseflow-cron" {
datacenters = ["alo"]
type = "batch"
periodic {
crons = ["0 8 * * *"]
prohibit_overlap = true
time_zone = "Europe/Lisbon"
}
group "garmin-sync" {
task "trigger" {
driver = "raw_exec"
config {
command = "/bin/sh"
args = ["local/script.sh"]
}
template {
destination = "local/script.sh"
data = <<EOH
set -e
RESPONSE=$(/run/current-system/sw/bin/curl -s -w "\n%%{http_code}" -X POST \
-H "Authorization: Bearer $CRON_SECRET" \
https://phaseflow.v.paler.net/api/cron/garmin-sync)
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
echo "$BODY"
if [ "$HTTP_CODE" -ge 400 ]; then
echo "HTTP error: $HTTP_CODE" >&2
exit 1
fi
EOH
}
template {
destination = "secrets/env.env"
env = true
data = <<EOH
{{- with nomadVar "secrets/phaseflow" -}}CRON_SECRET="{{ .cron_secret }}"{{- end -}}
EOH
}
}
}
}

View File

@@ -4,7 +4,8 @@
# Setup required before running:
# sudo mkdir -p /data/services/phaseflow/pb_data && sudo chown 1000:1000 /data/services/phaseflow /data/services/phaseflow/pb_data
# nomad var put secrets/phaseflow \
# resend_api_key="re_xxxx" \
# mailgun_api_key="key-xxxx" \
# mailgun_domain="paler.net" \
# encryption_key="$(openssl rand -hex 16)" \
# cron_secret="$(openssl rand -hex 32)" \
# pocketbase_admin_email="admin@example.com" \
@@ -89,6 +90,7 @@ job "phaseflow" {
NEXT_PUBLIC_POCKETBASE_URL = "https://pocketbase-phaseflow.v.paler.net"
APP_URL = "https://phaseflow.v.paler.net"
EMAIL_FROM = "phaseflow@paler.net"
MAILGUN_URL = "https://api.eu.mailgun.net"
}
# Secrets from Nomad variables
@@ -96,7 +98,8 @@ job "phaseflow" {
destination = "secrets/env.env"
env = true
data = <<EOH
RESEND_API_KEY={{ with nomadVar "secrets/phaseflow" }}{{ .resend_api_key }}{{ end }}
MAILGUN_API_KEY={{ with nomadVar "secrets/phaseflow" }}{{ .mailgun_api_key }}{{ end }}
MAILGUN_DOMAIN={{ with nomadVar "secrets/phaseflow" }}{{ .mailgun_domain }}{{ end }}
ENCRYPTION_KEY={{ with nomadVar "secrets/phaseflow" }}{{ .encryption_key }}{{ end }}
CRON_SECRET={{ with nomadVar "secrets/phaseflow" }}{{ .cron_secret }}{{ end }}
POCKETBASE_ADMIN_EMAIL={{ with nomadVar "secrets/phaseflow" }}{{ .pocketbase_admin_email }}{{ end }}