# documentation: https://www.redmine.org/
# slogan: Redmine is a flexible project management web application.
# tags: redmine,project management
# logo: svgs/redmine.svg
# port: 3000

services:
  redmine:
    image: redmine:6-alpine
    environment:
      - SERVICE_FQDN_REDMINE_3000
      - SECRET_KEY_BASE=${SERVICE_PASSWORD_64_REDMINE}
      - REDMINE_DB_POSTGRES=postgresql
      - REDMINE_DB_PORT=5432
      - REDMINE_DB_USERNAME=${SERVICE_USER_POSTGRES}
      - REDMINE_DB_PASSWORD=${SERVICE_PASSWORD_64_POSTGRES}
      - REDMINE_DB_DATABASE=${POSTGRES_DATABASE:-redmine-db}
    healthcheck:
      test:
        - CMD-SHELL
        - "wget -qO- http://127.0.0.1:3000/"
      interval: 5s
      timeout: 5s
      retries: 5
    volumes:
      - redmine-config:/usr/src/redmine/config
      - redmine-files:/usr/src/redmine/files
      - redmine-themes:/usr/src/redmine/themes
      - redmine-plugins:/usr/src/redmine/plugins
    depends_on:
      postgresql:
        condition: service_healthy

  postgresql:
    image: postgres:17-alpine
    environment:
      - POSTGRES_USER=${SERVICE_USER_POSTGRES}
      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_64_POSTGRES}
      - POSTGRES_DB=${POSTGRES_DATABASE:-redmine-db}
    volumes:
      - postgresql-data:/var/lib/postgresql/data
    healthcheck:
      test:
        - CMD-SHELL
        - "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"
      interval: 5s
      timeout: 5s
      retries: 5
