deployment/stacks/gitea.yml

100 lines
2.2 KiB
YAML

version: '3.4'
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'
configs:
- source: gitea_v2
target: /data/gitea/conf/app.ini
environment:
- 'DB_TYPE=postgres'
- 'DB_HOST=db:5432'
- 'DB_NAME=gitea'
- 'DB_USER=gitea'
- 'DB_PASSWD=gitea'
- 'LFS_START_SERVER=true'
- 'DISABLE_REGISTRATION=true'
- 'LFS_JWT_SECRET_FILE=/run/secrets/gitea_lfs_jwt_secret'
- 'SECRET_KEY_FILE=/run/secrets/gitea_secret_key'
- 'INTERNAL_TOKEN_FILE=/run/secrets/gitea_internal_token'
- 'JWT_SECRET_FILE=/run/secrets/gitea_jwt_secret'
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'
secrets:
- gitea_internal_token
- gitea_jwt_secret
- gitea_lfs_jwt_secret
- gitea_secret_key
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'
configs:
gitea_v2:
external: true
networks:
public:
external: true
secrets:
gitea_internal_token:
external: true
gitea_jwt_secret:
external: true
gitea_lfs_jwt_secret:
external: true
gitea_secret_key:
external: true
volumes:
data:
db-data:
repos:
lfs: