Skip to content

Commit 244c9e3

Browse files
committed
chore: migrate to new infrastructure
1 parent edd38c2 commit 244c9e3

File tree

2 files changed

+72
-17
lines changed

2 files changed

+72
-17
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,10 @@ on:
88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11-
1211
steps:
13-
- name: Git checkout
14-
uses: actions/checkout@v3
15-
with:
16-
fetch-depth: 0
17-
18-
# See the following link for documentation:
19-
# https://github.com/marketplace/actions/dokku
20-
- name: Push to hermes
21-
uses: dokku/[email protected]
22-
with:
23-
ssh_private_key: ${{ secrets.HERMES_GLOBAL_DEPLOY_KEY }}
24-
git_remote_url: ssh://[email protected]/cashflow
25-
# force might feel risky, but there is no good reason why the server
26-
# should ever not be a mirror of the deploy branch. And the errors we
27-
# could get otherwise would probably be nasty to deal with
28-
git_push_flags: --force
12+
- name: Deploy to Nomad
13+
uses: datasektionen/nomad-deploy@v1
14+
with:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
nomad-token: ${{ secrets.NOMAD_TOKEN }}
17+
nomad-addr: ${{ vars.NOMAD_ADDR }}

job.nomad.hcl

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
job "cashflow" {
2+
namespace = "money"
3+
4+
type = "service"
5+
6+
group "cashflow" {
7+
network {
8+
port "http" {
9+
to = 8000 # hardcoded in Dockerfile
10+
}
11+
}
12+
13+
service {
14+
name = "cashflow"
15+
port = "http"
16+
provider = "nomad"
17+
tags = [
18+
"traefik.enable=true",
19+
"traefik.http.routers.cashflow.rule=Host(`cashflow.datasektionen.se`)",
20+
"traefik.http.routers.cashflow.tls.certresolver=default",
21+
]
22+
}
23+
24+
task "cashflow" {
25+
driver = "docker"
26+
27+
config {
28+
image = var.image_tag
29+
ports = ["http"]
30+
}
31+
32+
template {
33+
data = <<ENV
34+
{{ with nomadVar "nomad/jobs/cashflow" }}
35+
DATABASE_URL=postgres://cashflow:{{ .db_password }}@postgres.dsekt.internal:5432/cashflow
36+
SECRET_KEY={{ .secret_key }}
37+
LOGIN_KEY={{ .login_key }}
38+
SPAM_API_KEY={{ .spam_api_key }}
39+
S3_HOST={{ .s3_host }}
40+
S3_BUCKET_NAME={{ .s3_bucket }}
41+
S3_ACCESS_KEY_ID={{ .s3_access_key_id }}
42+
S3_SECRET_ACCESS_KEY={{ .s3_secret_access_key }}
43+
{{ end }}
44+
S3_USE_SIGV4=False
45+
GOOGLE_ANALYTICS_KEY=UA-96183461-2
46+
DEBUG=False
47+
SEND_EMAILS=True
48+
PLS_URL=https://pls.datasektionen.se
49+
LOGIN_API_URL=https://login.datasektionen.se # TODO: migrate to sso (internal)
50+
LOGIN_FRONTEND_URL=https://login.datasektionen.se # TODO: migrate to sso
51+
SPAM_URL=https://spam.datasektionen.se
52+
BUDGET_URL=https://budget.datasektionen.se
53+
GIT_REV=please-delete-from-code
54+
PYTHONUNBUFFERED=1
55+
ENV
56+
destination = "local/.env"
57+
env = true
58+
}
59+
}
60+
}
61+
}
62+
63+
variable "image_tag" {
64+
type = string
65+
default = "ghcr.io/datasektionen/cashflow:latest"
66+
}

0 commit comments

Comments
 (0)