Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Introduce Zero downtime deployments #20

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/aosus-wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
MARIADB_PASSWORD: ${{ secrets.aosus_wordpress_mariadb_password }}
MARIADB_ROOT_PASSWORD: ${{ secrets.aosus_wordpress_mariadb_root_password }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: aosus-wordpress/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/caddy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
env:
EMAIL: ${{ secrets.email }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: caddy/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-mailserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: Start Deployment
uses: FarisZR/docker-compose-gitops-action@v1
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: docker-mailserver/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gnulinuxsa-wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
env:
MARIADB_PASSWORD: ${{ secrets.gnulinuxsa_wordpress_mariadb_password }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: gnulinuxsa-wordpress/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
MATRIX_HOOKSHOT_GITHUB_PRIVATE_KEY: ${{ secrets.matrix_hookshot_github_private_key }}
MATRIX_HOOKSHOT_PASS_KEY: ${{ secrets.matrix_hookshot_pass_key }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: matrix/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/plausible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
GOOGLE_CLIENT_SECRET: ${{ secrets.plausible_google_client_secret }}
POSTGRES_PASSWORD: ${{ secrets.plausible_postgres_password }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: plausible/docker-compose.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scribe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
env:
SECRET_KEY_BASE: ${{ secrets.scribe_secret_key_base }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
compose_file_path: scribe/docker-compose.yml
Expand Down
30 changes: 30 additions & 0 deletions aosus-wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ services:
configs:
- source: custom-ini
target: /usr/local/etc/php/conf.d/custom.ini
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

mariadb:
image: mariadb:10.11.2@sha256:9ff479f244cc596aed9794d035a9f352662f2caed933238c533024df64569853
Expand All @@ -35,6 +50,21 @@ services:
MARIADB_ROOT_PASSWORD:
volumes:
- /home/aosus/aosus-wordpress/mariadb:/var/lib/mysql
deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

configs:
custom-ini:
Expand Down
23 changes: 23 additions & 0 deletions caddy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ services:
networks:
web:
discourse:
healthcheck:
# https://ryanblunden.com/for-those-looking-for-a-http-health-check-in-alpine-images-wget-is-available-from-the-base-image-a07997be8699
test: ["CMD", "wget", "--spider", "-q", "http://localhost"]
interval: 5s
timeout: 10s
retries: 3
start_period: 10s
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 30s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

configs:
Caddyfile:
file: /home/aosus/caddy/Caddyfile
Expand Down
15 changes: 15 additions & 0 deletions docker-mailserver/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ services:
retries: 0
networks:
discourse:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

volumes:
mail-data:
Expand Down
30 changes: 30 additions & 0 deletions gnulinuxsa-wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ services:
configs:
- source: custom-ini
target: /usr/local/etc/php/conf.d/custom.ini
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

mariadb:
image: mariadb:10.11.2@sha256:9ff479f244cc596aed9794d035a9f352662f2caed933238c533024df64569853
Expand All @@ -35,6 +50,21 @@ services:
MARIADB_AUTO_UPGRADE: true
volumes:
- /home/aosus/gnulinuxsa-wordpress/mariadb:/var/lib/mysql:rw
deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

configs:
custom-ini:
Expand Down
61 changes: 60 additions & 1 deletion matrix/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ services:
- /home/aosus/matrix/postgresql:/var/lib/postgresql/data:rw
networks:
default:
deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s


synapse:
Expand Down Expand Up @@ -61,6 +76,21 @@ services:
networks:
default:
web:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s


synapse-admin:
Expand All @@ -81,6 +111,21 @@ services:
networks:
default:
telegram:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s


postgres-telegram:
Expand All @@ -95,7 +140,21 @@ services:
- /home/aosus/matrix/telegram/postgresql:/var/lib/postgresql/data:rw
networks:
telegram:

deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

matrix-hookshot:
image: halfshot/matrix-hookshot:3.1.1@sha256:bb3b7c924a6e6b2ee014a3a13347dc44ec72e47876464c507b661be493f35ecc
Expand Down
45 changes: 45 additions & 0 deletions plausible/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
- /home/aosus/plausible/postgresql:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD
deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

plausible_events_db:
restart: unless-stopped
Expand All @@ -26,6 +41,21 @@ services:
nofile:
soft: 262144
hard: 262144
deploy:
mode: global
update_config:
parallelism: 0
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

plausible:
restart: unless-stopped
Expand Down Expand Up @@ -53,6 +83,21 @@ services:
networks:
default:
web:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

volumes:
geoip:
Expand Down
15 changes: 15 additions & 0 deletions scribe/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,18 @@ services:
- SECRET_KEY_BASE
networks:
web:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s