Skip to content

Commit ddf56f4

Browse files
committed
ci: move to new infra
1 parent 7f81e89 commit ddf56f4

File tree

5 files changed

+70
-18
lines changed

5 files changed

+70
-18
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@v4
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 medusa
21-
uses: dokku/[email protected]
22-
with:
23-
ssh_private_key: ${{ secrets.MEDUSA_GLOBAL_DEPLOY_KEY }}
24-
git_remote_url: ssh://[email protected]/pandora
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 }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ RUN ln -s _vendor vendor && chown -R www:www /app
2929
EXPOSE 8000
3030

3131
USER root
32-
CMD ["/app/run.sh"]
32+
ENTRYPOINT ["sh", "-c", "php artisan serve --host=0.0.0.0 --port=$PORT"]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Pandora
22

3+
> [!WARNING]
4+
> Migrations not run in production env
5+
36
PHP Laravel application that handles bookings. Live at https://bokning.datasektionen.se.
47

58
## API

compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- LOGIN_FRONTEND_URL=http://localhost:7002
2020
- PLS_API_URL=https://pls.datasektionen.se/api
2121
- HODIS_API_URL=https://hodis.datasektionen.se
22+
- PORT=8000
2223
depends_on:
2324
db:
2425
condition: service_healthy

job.nomad.hcl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
ob "pandora" {
2+
type = "service"
3+
4+
group "pandora" {
5+
network {
6+
port "http" { }
7+
}
8+
9+
service {
10+
name = "pandora"
11+
port = "http"
12+
provider = "nomad"
13+
tags = [
14+
"traefik.enable=true",
15+
"traefik.http.routers.pandora.rule=Host(`bokning.datasektionen.se`)",
16+
"traefik.http.routers.pandora.tls.certresolver=default",
17+
]
18+
}
19+
20+
task "pandora" {
21+
driver = "docker"
22+
23+
config {
24+
image = var.image_tag
25+
ports = ["http"]
26+
}
27+
28+
template {
29+
data = <<ENV
30+
{{ with nomadVar "nomad/jobs/pandora" }}
31+
DATABASE_URL=postgres://pandora:{{ .db_password }}@postgres.dsekt.internal:5432/pandora
32+
APP_KEY={{ .app_key }}
33+
LOGIN_API_KEY={{ .login_api_key }}
34+
SPAM_API_KEY={{ .spam_api_key }}
35+
{{ end }}
36+
PORT={{ env "NOMAD_PORT_http" }}
37+
APP_DEBUG=false
38+
APP_ENV=production
39+
DB_CONNECTION=pgsql
40+
LOGIN_API_URL=https://login.datasektionen.se
41+
LOGIN_FRONTEND_URL=https://login.datasektionen.se
42+
PLS_API_URL=https://pls.datasektionen.se/api
43+
SPAM_API_URL=https://spam.datasektionen.se/api/sendmail
44+
ENV
45+
destination = "local/.env"
46+
env = true
47+
}
48+
49+
resources {
50+
memory = 120
51+
}
52+
}
53+
}
54+
}
55+
56+
variable "image_tag" {
57+
type = string
58+
default = "ghcr.io/datasektionen/pandora:latest"
59+
}

0 commit comments

Comments
 (0)