Skip to content

Commit

Permalink
Add ferry api docker role
Browse files Browse the repository at this point in the history
  • Loading branch information
trickeydan committed Dec 1, 2024
1 parent e35141a commit c9bce50
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 5 deletions.
4 changes: 3 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@
tags: docker
- role: docker_traefik
tags: docker-traefik
- role: docker_ferry
tags: docker-ferry
- role: docker_kmibot
tags: docker-kmibot
tags: docker-kmibot
2 changes: 1 addition & 1 deletion group_vars/all/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ docker_compose_directory_mask: "775"
# Run this task manually, as version comparisons usually fail
docker_compose_url: https://github.com/docker/compose-switch/releases/latest/download/docker-compose-linux-amd64

docker_update_command: docker-compose pull && docker-compose down --remove-orphans && docker-compose rm && docker-compose up -d
docker_update_command: docker-compose pull && docker-compose down && docker-compose rm && docker-compose up -d --build
33 changes: 33 additions & 0 deletions roles/docker_ferry/files/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
nginx:
restart: always
networks:
- traefik
- default
labels:
- traefik.enable=true
- traefik.http.routers.ferry.rule=Host(`ferry.containers-dev.sown.org.uk`)
- traefik.http.services.ferry.loadbalancer.server.port=80
- traefik.http.routers.ferry.tls.certresolver=le

web:
restart: always
environment:
- SQL_DATABASE=ferry
- SQL_USER=ferry
- SQL_PASSWORD=ferry
- SQL_HOST=db
- SQL_PORT=5432
- SECRET_KEY={{ docker_ferry_django_secret_key }}
- DISCORD_GUILD={{ docker_ferry_discord_guild_id }}
- DISCORD_TOKEN={{ docker_ferry_discord_api_token }}
- SSO_OIDC_CONFIGURATION_URL=https://sso.sown.org.uk/application/o/ferry/.well-known/openid-configuration
- SSO_OIDC_CLIENT_ID={{ docker_ferry_sso_oidc_client_id }}
- SSO_OIDC_CLIENT_SECRET={{ docker_ferry_sso_oidc_client_secret }}

db:
restart: always

networks:
traefik:
external: true
4 changes: 4 additions & 0 deletions roles/docker_ferry/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Restart ferry-service # noqa: no-changed-when
command:
chdir: /opt/ferry-api
cmd: "{{ docker_update_command }}"
14 changes: 14 additions & 0 deletions roles/docker_ferry/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: Checkout ferry-api into /opt/ferry
git:
repo: https://github.com/trickeydan/ferry-api.git
dest: /opt/ferry-api
version: 82d5e5e7963ee853827bb07a6dd299ba9d9c6798
notify: Restart ferry-service

- name: Install compose file
template:
src: files/docker-compose.override.yml
dest: /opt/ferry-api/docker-compose.override.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
notify: Restart ferry-service
41 changes: 41 additions & 0 deletions roles/docker_ferry/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
docker_ferry_discord_guild_id: 1041048471559491611
docker_ferry_discord_api_token: !vault |
$ANSIBLE_VAULT;1.1;AES256
30613030383830313461396234336639616137313937333838383937616434663035663365393939
3231333338643836396137353135303264363434636666660a353937323264303137663933623132
31636266383838343230623335306133643836656434613936333231613431303435396438336538
3234376630323238340a383736633261363061383538366236663034363937353431623638613432
65653432353934396537663533626662353839613439333232303066623963346266626339613331
38663835326431646135636537623633663131613031666237653833663562623632646535633864
61633064343431373665343661376566373132666237303737316231323530373738663535616137
38306663646337623062
docker_ferry_django_secret_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
64623234303231663864373266343963353139636166323566643333656236653734643866383436
6336626339643830366236663839376436653861626462650a653834373232336334616565366365
32336631326130383364383834363632643862343536343137383361363963313262616363353532
6531303832353032390a316538386439333437303963373461633332316334643137623939346262
62663462626435373334623030373764303835636632653332326639616462333161383362383934
65353039326237633466373762386130353839613436326336333466373262623937643464323439
356337383062653737346130376162386537
docker_ferry_sso_oidc_client_id: !vault |
$ANSIBLE_VAULT;1.1;AES256
65326561316661333361356366633936306639643732306261383532306432636137643738663138
3535336632313234343335666365343636383964386232660a653265366232653635393637313938
30623032346164333035623836643266336563383263656437323265376539626331323635373334
6161643734623061350a616535613133346566323539326465346665393230626465623932396437
31336561383366653133306335376331613633336436646337333335346631376432323264306261
3233663639373232373637663535326636386338616630626464
docker_ferry_sso_oidc_client_secret: !vault |
$ANSIBLE_VAULT;1.1;AES256
35316135623963656232653130646236363730303434646436623138366561363831313466303434
6132313263303739653531616561663133303636313537610a333938626361366331353031343939
63333563663338383463666431623535653330313839363462653032326136626639613736353133
3238336464326238640a653965393136303133613665353063313336316131383236653563303265
30386639383638663764363739333763333166663433643364363130653665623536386438303130
39343162366362623631646266333566393662346436376163373336386333363965356638623731
32656666663163383133653930626439636236323132356238383964323632376332313830316339
30623536303534336534326436663935393666613939366132613234376430643166653433373362
33663935323138306437613437666333626434653734616566386339366336616464383936303231
34373539633935303936336562313663323365376334396136646639633531653431623133383133
323037353935333230636363363939303761
3 changes: 2 additions & 1 deletion roles/docker_kmibot/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
- name: checkout kmibot into /opt/kmibot
- name: Checkout kmibot into /opt/kmibot
git:
repo: https://github.com/sown/kmibot.git
dest: /opt/kmibot
version: c288f25f8224452ecc2641a74bb79177597e53e3
notify: Restart KMIBot

- name: Install extra config
template:
Expand Down
3 changes: 1 addition & 2 deletions roles/docker_kmibot/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

docker_kmibot_discord_guild_id: 1041048471559491611
docker_kmibot_discord_ferry_channel_id: 1041087057419841688
docker_kmibot_discord_pub_channel_id: 1041051486945300510
Expand All @@ -19,4 +18,4 @@ docker_kmibot_ferry_api_token: !vault |
38363335316434353937306563643235616330613436313933376633636335356165313831313037
3133373963373761630a393832653862633930343666396630383638333333366435313438653833
39363665303937623134313233316161656261613737313233306430363839303238653638613837
3766306434666335383537316337666236626266616635393734
3766306434666335383537316337666236626266616635393734

0 comments on commit c9bce50

Please sign in to comment.