---
version: "3.8"

services:
  navidrome:
    image: deluan/navidrome:latest
    container_name: navidrome
    restart: unless-stopped
    expose:
      - "4533"
    environment:
      ND_DATABASE_URL: "postgres://navidrome:{{ vault_navidrome_db_password }}@navidromedb:5432/navidrome_db?sslmode=disable"
      ND_SESSIONTIMEOUT: 24h
      ND_ENABLETRANSCODING: "true"

    volumes:
      - "/opt/navidrome/data:/data"
      - "/opt/music:/music:ro"
    user: "1000:1000"
    networks:
      - web
    depends_on:
      - navidromedb
  nginx-proxy-manager:
    image: jc21/nginx-proxy-manager:latest
    container_name: nginx-proxy-manager
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "81:81"
    volumes:
      - "/opt/npm/data:/data"
      - "/opt/npm/letsencrypt:/etc/letsencrypt"
    networks:
      - web
      - gitea

  # Disabled: prometheus does not have enough resources to run Nextcloud AIO.
  # nextcloud-aio-mastercontainer:
  #   image: ghcr.io/nextcloud-releases/all-in-one:latest
  #   container_name: nextcloud-aio-mastercontainer
  #   init: true
  #   restart: always
  #   ports:
  #     - "127.0.0.1:8080:8080"
  #   environment:
  #     APACHE_PORT: "11000"
  #     APACHE_IP_BINDING: "0.0.0.0"
  #     APACHE_ADDITIONAL_NETWORK: "server_web"
  #     NEXTCLOUD_DATADIR: "/srv/nextcloud/data"
  #   volumes:
  #     - "nextcloud_aio_mastercontainer:/mnt/docker-aio-config"
  #     - "/var/run/docker.sock:/var/run/docker.sock:ro"
  #   networks:
  #     - web

  navidromedb:
    image: postgres:13
    container_name: navidromedb
    restart: unless-stopped
    mem_limit: 2048m
    environment:
      POSTGRES_DB: "navidrome_db"
      POSTGRES_USER: "navidrome"
      POSTGRES_PASSWORD: "{{ vault_postgres_root_password }}"

    volumes:
      - "/opt/postgres/data:/var/lib/postgresql/data"
    networks:
      - web
  gitea:
    image: docker.gitea.com/gitea:1.25.2
    container_name: gitea
    environment:
      - USER_UID=1100
      - USER_GID=1100
    restart: always
    networks:
      - gitea
    volumes:
      - /opt/gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /home/git/.ssh:/data/git/.ssh
    ports:
      - "3000:3000"
      - "127.0.0.1:222:22"

  syncthing:
    image: syncthing/syncthing:2
    container_name: syncthing
    hostname: syncthing
    restart: unless-stopped
    expose:
      - "8384"
    volumes:
      - "/opt/syncthing/config:/var/syncthing"
      - "/srv/syncthing/data:/data"
    ports:
      - "22000:22000/tcp"
      - "22000:22000/udp"
      - "21027:21027/udp"
    networks:
      - web

networks:
  web:
    name: server_web
    external: false
  gitea:
    external: false

# volumes:
#   nextcloud_aio_mastercontainer:
#     name: nextcloud_aio_mastercontainer
