# A docker-compose file to host a hiSHtory backend. To use:
#   1. Update TODO_YOUR_POSTGRES_PASSWORD_HERE
#   2. `docker compose -f backend/server/docker-compose.yml build`
#   3. `docker compose -f backend/server/docker-compose.yml up`
#   4. Point your hiSHtory client at the server by putting `export HISHTORY_SERVER=http://1.2.3.4` in your shellrc
#   5. Run `hishtory init` to initialize hiSHtory with the local server
#   6. [Optional, but recommended] Add a TLS proxy to enable https
networks:
  hishtory:
    driver: bridge
services:
  postgres:
    image: postgres
    restart: unless-stopped
    networks:
      - hishtory
    environment:
      POSTGRES_PASSWORD: TODO_YOUR_POSTGRES_PASSWORD_HERE
      POSTGRES_DB: hishtory
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
  hishtory:
    depends_on:
      - postgres
    networks:
      - hishtory
    build:
      context: ../../
      dockerfile: ./backend/server/native-arch-Dockerfile
    restart: unless-stopped
    environment:
      HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable
    ports:
      - 80:8080
