Added healthcheck to gitea postgres

master
Jef Roosens 2021-12-24 11:52:32 +01:00
parent 417627385c
commit f6ed76d01d
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
1 changed files with 60 additions and 53 deletions

View File

@ -1,63 +1,70 @@
version: '3' version: '3'
services: services:
app: app:
# Latest contains a development version # Latest contains a development version
image: 'gitea/gitea:1.15.8' 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'
db: deploy:
image: 'postgres:14.1-alpine' mode: 'replicated'
replicas: 1
deploy: placement:
mode: 'replicated' constraints:
replicas: 1 - 'node.labels.class==gitea'
placement: labels:
constraints: - 'traefik.enable=true'
- 'node.labels.class==gitea' - '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: environment:
- 'POSTGRES_USER=gitea' - 'DB_TYPE=postgres'
- 'POSTGRES_PASSWORD=gitea' - 'DB_HOST=db:5432'
- 'POSTGRES_DB=gitea' - 'DB_NAME=gitea'
volumes: - 'DB_USER=gitea'
- 'db-data:/var/lib/postgresql/data' - '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: networks:
public: public:
external: true external: true
volumes: volumes:
data: data: