version: '3.9'
services:
  postgres:
    image: postgres:latest
    container_name: postgres
    restart: always
    environment:
      - POSTGRES_PASSWORD=postgrespw
      - POSTGRES_DATABASE=postgres
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - postgres:/var/lib/postgresql/data

  redis:
    image: redis:alpine
    container_name: redis
    restart: on-failure
    volumes:
      - redis:/data

  api:
    image: ghcr.io/renzynx/bliss:latest
    container_name: api
    restart: always
    environment:
      - NODE_ENV=production
      - DATABASE_URL=postgresql://postgres:postgrespw@postgres:5432/postgres?schema=public&connect_timeout=300
      - REDIS_URL=redis://redis:6379
      # should be your frontend domain
      # e.g. https://amog-us.club
      - CORS_ORIGIN=
      # just smash random keys on your keyboard or use a password generator
      - SESSION_SECRET=
      # set to "true" if you want to use email verification
      - USE_MAIL=false
      - MAIL_HOST=
      - MAIL_PORT=
      - MAIL_USER=
      - MAIL_PASS=
      # e.g. ServiceName <noreply@domain.com>
      - MAIL_FROM=
      # set to "true" if you are going to use a reverse proxy
      - USE_PROXY=false
      # set to "true" if you are going to use SSL
      - USE_SSL=false
      # port for the container to listen on
      - PORT=3000

      # should be local or s3
      - UPLOADER=local
      # s3 config (only needed if you are using s3)
      - S3_ENDPOINT=
      - S3_ACCESS_KEY_ID=
      - S3_SECRET_ACCESS_KEY=
      - S3_BUCKET_NAME=
      - S3_REGION=

      # optional
      - COOKIE_NAME=
    ports:
      # 👇 Change this to whatever port you want
      - 8080:3000
    depends_on:
      - postgres
      - redis
    volumes:
      - ./uploads:/app/uploads

  web:
    image: ghcr.io/renzynx/web:latest
    container_name: web
    restart: always
    ports:
      # 👇 Change this to whatever port you want
      - 8500:5000
    environment:
      # should be your backend domain e.g. https://uploads.amog-us.club
      - NEXT_PUBLIC_API_URL=

volumes:
  postgres:
  redis:
