---
version: "{{ skylab_compose_version }}"


networks:
  gitea:
    name: gitea
    driver: overlay
    ipam:
      driver: default
      config:
        - subnet: {{ app.networks.ext }}


volumes:
{% for key, value in app.volumes.items() %}
  gitea-{{ key }}:
    name: datastore{{ value }}
    driver: glusterfs
{% endfor %}


services:
  server:
    image: gitea/gitea:{{ app.versions.server }}
    hostname: gitea
    networks:
      - gitea
    ports:
      - published: {{ app.ports.3000 }}
        target: 3000
        protocol: tcp
        mode: ingress
      - published: {{ app.ports.22 }}
        target: 22
        protocol: tcp
        mode: ingress
    volumes:
      - type: volume
        source: gitea-data
        target: /data
        read_only: false
    environment:
      USER_UID: "{{ _app_account.uid }}"
      USER_GID: "{{ _app_account.uid }}"
      APP_NAME: ENP Version Control System
      RUN_MODE: prod
      ROOT_URL: https://{{ app.publish.domain }}/
      DB_TYPE: sqlite3
      DISABLE_REGISTRATION: "true"
    deploy:
      replicas: 1
