# Managed by Ansible — do not edit manually services: gitea: image: gitea/gitea:{{ gitea_version }} container_name: gitea restart: unless-stopped environment: # Database - GITEA__database__DB_TYPE=postgres - GITEA__database__HOST=gitea-db:5432 - GITEA__database__NAME=gitea - GITEA__database__USER=gitea - GITEA__database__PASSWD={{ gitea_db_password }} # Server - GITEA__server__DOMAIN={{ domain_gitea }} - GITEA__server__ROOT_URL=https://{{ domain_gitea }} - GITEA__server__HTTP_PORT=3000 - GITEA__server__SSH_DOMAIN={{ domain_gitea }} - GITEA__server__SSH_PORT=2222 # Security - GITEA__security__SECRET_KEY={{ gitea_secret_key }} - GITEA__security__INTERNAL_TOKEN={{ gitea_internal_token }} # Allow account creation only via external auth (OAuth2/SSO). # DISABLE_REGISTRATION=false is explicit because the setup wizard writes true to app.ini; # ALLOW_ONLY_EXTERNAL_REGISTRATION then hides the sign-up form so only SSO accounts work. - GITEA__service__DISABLE_REGISTRATION=false - GITEA__service__ALLOW_ONLY_EXTERNAL_REGISTRATION=true # Disable legacy OpenID 2.0 sign-in (distinct from the Keycloak OAuth2 integration) - GITEA__openid__ENABLE_OPENID_SIGNIN=false - GITEA__openid__ENABLE_OPENID_SIGNUP=false volumes: - {{ gitea_data_dir }}/data:/data ports: - "2222:22" networks: - traefik_public - gitea_internal labels: - "traefik.enable=true" - "traefik.http.routers.gitea.rule=Host(`{{ domain_gitea }}`)" - "traefik.http.routers.gitea.entrypoints=websecure" - "traefik.http.routers.gitea.tls.certresolver=letsencrypt" - "traefik.http.services.gitea.loadbalancer.server.port=3000" depends_on: gitea-db: condition: service_healthy gitea-db: image: postgres:{{ gitea_db_version }} container_name: gitea-db restart: unless-stopped environment: - POSTGRES_USER=gitea - POSTGRES_PASSWORD={{ gitea_db_password }} - POSTGRES_DB=gitea volumes: - {{ gitea_data_dir }}/db:/var/lib/postgresql/data networks: - gitea_internal healthcheck: test: ["CMD-SHELL", "pg_isready -U gitea"] interval: 10s timeout: 5s retries: 5 networks: traefik_public: external: true gitea_internal: internal: true