#
# Usage:
#   docker-compose up -d
#   docker-compose run --rm archivebox init
#   docker-compose run --rm archivebox manage createsuperuser
#   docker-compose run --rm archivebox add 'https://example.com'
#   docker-compose run --rm archivebox add --depth=1 https://example.com/some/feed.rss
#   docker-compose run --rm archivebox config --set PUBLIC_INDEX=True
#
# Documentation:
#   https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#docker-compose
#

version: "3.8"

services:

  archivebox:
    image: archivebox/archivebox:0.7.2
    ports:
      - "8000:8000"
    environment:
      # ADMIN_USERNAME=admin
      # ADMIN_PASSWORD=admin
      - CSRF_TRUSTED_ORIGINS=https://archivebox.example.com
      - ALLOWED_HOSTS=*
      - PUBLIC_INDEX=True
      - PUBLIC_SNAPSHOTS=True
      - PUBLIC_ADD_VIEW=False
      - SEARCH_BACKEND_ENGINE=sonic
      - SEARCH_BACKEND_HOST_NAME=sonic
      - SEARCH_BACKEND_PASSWORD=sonic
    volumes:
      - ./data:/data
    depends_on:
      - sonic
    restart: unless-stopped
  
  sonic:
    image: valeriansaliou/sonic:v1.4.9
    ports:
      - "1491:1491"
    environment:
      - SEARCH_BACKEND_PASSWORD=sonic
    volumes:
      # ./data/sonic/config.cfg:/etc/sonic.cfg
      - ./data/sonic:/var/lib/sonic/store/
    restart: unless-stopped
