From f6ed76d01d68ddcb1ad43188f13db54204c15607 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 24 Dec 2021 11:52:32 +0100 Subject: [PATCH 1/4] Added healthcheck to gitea postgres --- stacks/gitea.yml | 113 +++++++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/stacks/gitea.yml b/stacks/gitea.yml index af1720b..fc83675 100644 --- a/stacks/gitea.yml +++ b/stacks/gitea.yml @@ -1,63 +1,70 @@ version: '3' services: - app: - # Latest contains a development version - image: 'gitea/gitea:1.15.8' - - deploy: - mode: 'replicated' - replicas: 1 - placement: - constraints: - - 'node.labels.class==gitea' - labels: - - 'traefik.enable=true' - - 'traefik.http.routers.gitea.rule=Host(`git.rustybever.be`)' - - 'traefik.http.routers.gitea.tls=true' - - 'traefik.http.routers.gitea.tls.certresolver=letsEncrypt' - - 'traefik.http.services.gitea.loadbalancer.server.port=3000' - - environment: - - 'DB_TYPE=postgres' - - 'DB_HOST=db:5432' - - 'DB_NAME=gitea' - - 'DB_USER=gitea' - - 'DB_PASSWD=gitea' - - 'LFS_START_SERVER=true' - - 'DISABLE_REGISTRATION=true' - networks: - - 'default' - - 'public' - ports: - - '22:22' - volumes: - - 'data:/data' - - 'repos:/data/git/repositories' - - 'lfs:/data/git/lfs' - - '/etc/timezone:/etc/timezone:ro' - - '/etc/localtime:/etc/localtime:ro' + app: + # Latest contains a development version + image: 'gitea/gitea:1.15.8' - db: - image: 'postgres:14.1-alpine' - - deploy: - mode: 'replicated' - replicas: 1 - placement: - constraints: - - 'node.labels.class==gitea' + deploy: + mode: 'replicated' + replicas: 1 + placement: + constraints: + - 'node.labels.class==gitea' + labels: + - 'traefik.enable=true' + - 'traefik.http.routers.gitea.rule=Host(`git.rustybever.be`)' + - 'traefik.http.routers.gitea.tls=true' + - 'traefik.http.routers.gitea.tls.certresolver=letsEncrypt' + - 'traefik.http.services.gitea.loadbalancer.server.port=3000' - environment: - - 'POSTGRES_USER=gitea' - - 'POSTGRES_PASSWORD=gitea' - - 'POSTGRES_DB=gitea' - volumes: - - 'db-data:/var/lib/postgresql/data' + environment: + - 'DB_TYPE=postgres' + - 'DB_HOST=db:5432' + - 'DB_NAME=gitea' + - 'DB_USER=gitea' + - 'DB_PASSWD=gitea' + - 'LFS_START_SERVER=true' + - 'DISABLE_REGISTRATION=true' + networks: + - 'default' + - 'public' + ports: + - '22:22' + volumes: + - 'data:/data' + - 'repos:/data/git/repositories' + - 'lfs:/data/git/lfs' + - '/etc/timezone:/etc/timezone:ro' + - '/etc/localtime:/etc/localtime:ro' + + db: + image: 'postgres:14.1-alpine' + + deploy: + mode: 'replicated' + replicas: 1 + placement: + constraints: + - 'node.labels.class==gitea' + + healthcheck: + test: pg_isready + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s + + environment: + - 'POSTGRES_USER=gitea' + - 'POSTGRES_PASSWORD=gitea' + - 'POSTGRES_DB=gitea' + volumes: + - 'db-data:/var/lib/postgresql/data' networks: - public: - external: true + public: + external: true volumes: data: From 78d88fb7a3707683b53f8d6324fd15dce2b234d0 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 24 Dec 2021 11:55:13 +0100 Subject: [PATCH 2/4] Fixed faulty indentation --- stacks/gitea.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stacks/gitea.yml b/stacks/gitea.yml index fc83675..1fea21d 100644 --- a/stacks/gitea.yml +++ b/stacks/gitea.yml @@ -11,12 +11,12 @@ services: placement: constraints: - 'node.labels.class==gitea' - labels: - - 'traefik.enable=true' - - 'traefik.http.routers.gitea.rule=Host(`git.rustybever.be`)' - - 'traefik.http.routers.gitea.tls=true' - - 'traefik.http.routers.gitea.tls.certresolver=letsEncrypt' - - 'traefik.http.services.gitea.loadbalancer.server.port=3000' + labels: + - 'traefik.enable=true' + - 'traefik.http.routers.gitea.rule=Host(`git.rustybever.be`)' + - 'traefik.http.routers.gitea.tls=true' + - 'traefik.http.routers.gitea.tls.certresolver=letsEncrypt' + - 'traefik.http.services.gitea.loadbalancer.server.port=3000' environment: - 'DB_TYPE=postgres' From 049352e53c0dcec570b1e492351d40b6d23a78e7 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 24 Dec 2021 11:56:14 +0100 Subject: [PATCH 3/4] Bumped compose file version --- stacks/gitea.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stacks/gitea.yml b/stacks/gitea.yml index 1fea21d..6c05c83 100644 --- a/stacks/gitea.yml +++ b/stacks/gitea.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.4' services: app: From 84e157a05b0f6d9e9f4e593753783d1423e2d98e Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 24 Dec 2021 11:59:05 +0100 Subject: [PATCH 4/4] Added healthchecks to matrix postgres containers --- stacks/matrix.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stacks/matrix.yml b/stacks/matrix.yml index 2efe251..3a12c01 100644 --- a/stacks/matrix.yml +++ b/stacks/matrix.yml @@ -59,6 +59,13 @@ services: placement: constraints: - 'node.labels.class==matrix' + + healthcheck: + test: pg_isready + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s environment: - 'POSTGRES_DB=matrix_fb' @@ -109,6 +116,13 @@ services: constraints: - 'node.labels.class==matrix' + healthcheck: + test: pg_isready + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s + environment: - 'POSTGRES_DB=matrix_signal' - 'POSTGRES_USER=matrix_signal'