Files
ansible/roles/docker/templates/gitea-compose.yml.j2
T
PhilandClaude Opus 5.5 e569a56417 Reserve fixed IPs on the lava network so Caddy can always start
lava was created by hand without an ip_range, so any container could be
given Caddy's fixed IP (172.20.0.5). After a reboot the containers race
for the low addresses and Caddy often fails with "Address already in use".

- The docker role now creates lava as 172.20.0.0/16 with dynamic
  addresses limited to 172.20.128.0/17, so 172.20.0.x is free for fixed
  IPs, and warns if the network still has the old layout.
- Gitea gets fixed IP 172.20.0.6 once the network has the reserved range,
  since its ufw-docker SSH rule points at its IP.
- ufw-docker allow rules for Caddy (80, 443) and Gitea SSH are managed by
  the playbook and follow IP changes.
- migrate-lava-network.yml recreates the existing network once: it takes
  down every compose project on lava (volumes kept), recreates the
  network, and brings them back up, Caddy first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:04:22 -06:00

67 lines
1.9 KiB
Django/Jinja

version: "3"
services:
server:
image: gitea/gitea:1
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__mailer__ENABLED=true
- GITEA__mailer__FROM=git@{{ email_domains.updates }}
- GITEA__mailer__PROTOCOL=smtps
- GITEA__mailer__SMTP_ADDR={{ smtp.host }}
- GITEA__mailer__SMTP_PORT=465
- GITEA__mailer__USER={{ smtp.username }}
- GITEA__mailer__PASSWD={{ vault_smtp.password }}
restart: unless-stopped
labels:
glance.name: Gitea
glance.icon: si:gitea
glance.url: https://{{ subdomains.git }}/
glance.description: Code repo
glance.id: gitea
mag37.dockcheck.update: true
volumes:
- gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 222:22
extra_hosts:
- '{{ subdomains.auth }}:{{ docker.hairpin_ip }}'
- '{{ subdomains.git }}:{{ docker.hairpin_ip }}'
{% if lava_reserved | default(false) | bool %}
networks:
default:
ipv4_address: {{ docker.gitea_ip }}
{% endif %}
runner:
image: gitea/act_runner:nightly
restart: unless-stopped
depends_on:
- server
environment:
- CONFIG_FILE=/config.yaml
- GITEA_INSTANCE_URL=http://gitea:3000
- GITEA_RUNNER_REGISTRATION_TOKEN={{ vault_infrastructure.gitea_runner_key }}
- GITEA_RUNNER_NAME=runner_1
- GITEA_RUNNER_LABELS=docker
extra_hosts:
- '{{ subdomains.auth }}:{{ docker.hairpin_ip }}'
- '{{ subdomains.git }}:{{ docker.hairpin_ip }}'
labels:
glance.parent: gitea
glance.name: Worker
mag37.dockcheck.update: true
volumes:
- ./runner-config.yaml:/config.yaml
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
- {{ paths.stacks }}/caddy/site:/sites
volumes:
gitea:
driver: local
networks:
default:
external: true
name: {{ docker.network_name }}