# APPNICENAME=Stash
services:
  stash:
    image: stashapp/stash:latest
    container_name: stash
    restart: unless-stopped
    ## the container's port must be the same with the STASH_PORT in the environment section
    #ports:
    #  - "9999:9999"
    #  - "8200:8200"
    #  - "1900:1900"
    ## If you intend to use stash's DLNA functionality uncomment the below network mode and comment out the above ports section
    network_mode: host
    logging:
      driver: "json-file"
      options:
        max-file: "10"
        max-size: "2m"
    environment:
      - STASH_STASH=/data/
      - STASH_GENERATED=/generated/
      - STASH_METADATA=/metadata/
      - STASH_CACHE=/cache/
      ## Adjust below to change default port (9999)
      - STASH_PORT=9999
    volumes:
      - /etc/localtime:/etc/localtime:ro
      ## Adjust below paths (the left part) to your liking.
      ## E.g. you can change ./config:/root/.stash to ./stash:/root/.stash
      ## Keep configs, scrapers, and plugins here.
      - ./config:/root/.stash
      ## Point this at your collection.
      - /mnt/system:/data
      ## This is where your stash's metadata lives
      - ./metadata:/metadata
      ## Any other cache content.
      - ./cache:/cache
      ## Where to store binary blob data (scene covers, images)
      - ./blobs:/blobs
      ## Where to store generated content (screenshots,previews,transcodes,sprites)
      - ./generated:/generated
      - ./cron/15min:/etc/periodic/15min

  postgres:
    container_name: postgres-stash-box
    #build: ./postgres
    image: postgres:14-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: asdf1234
      POSTGRES_DB: postgres
    volumes:
      - ./pgdata:/var/lib/postgresql/data

  stash-box:
    container_name: stash-box
    image: stashapp/stash-box:latest
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-file: "10"
        max-size: "2m"
    links:
      - postgres
    volumes:
      - ./stash-box-config:/root/.stash-box
    # labels:
    #   - traefik.http.routers.stash-box.rule=Host(`<DOMAIN>`)
    #   - traefik.http.routers.stash-box.tls=true
    #   - traefik.http.routers.stash-box.tls.certresolver=stash-box
    #   - traefik.port=9998

  # traefik:
  #   container_name: traefik
  #   image: traefik:2.3
  #   restart: unless-stopped
  #   ports:
  #     - 80:80
  #     - 443:443
  #   command:
  #     - "--entrypoints.web.address=:80"
  #     - "--entrypoints.websecure.address=:443"
  #     - "--entryPoints.web.http.redirections.entryPoint.to=websecure"
  #     - "--entryPoints.web.http.redirections.entryPoint.scheme=https"
  #     - "--providers.docker=true"
  #     - "--certificatesResolvers.stash-box.acme.email=<EMAIL>"
  #     - "--certificatesResolvers.stash-box.acme.storage=/acme.json"
  #     - "--certificatesresolvers.stash-box.acme.tlschallenge=true"
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock:ro
  #     - /traefik/acme.json:/acme.json
