version: "3.7"

volumes:
  db:
    name: plume_db
  data:
    name: plume_data
  searchidx:
    name: plume_index
  first-launch:
    name: plume_first_launch

networks:
  proxy:
    external: true
  plume:
    name: plume

services:
  blog:
    image: registry.picasoft.net/pica-plume:0.5.0
    build: .
    container_name: blog
    env_file:
      - ./secrets/plume_db.secrets
      - ./secrets/plume.secrets
    environment:
      BASE_URL: "blog.picasoft.net"
      NAME: "Picablog"
      ADMIN_EMAIL: picasoft@assos.utc.fr
      DB_HOST: "blog-db"
    volumes:
      - data:/app/static/media
      - searchidx:/app/search_index
      - first-launch:/firstlaunch
    labels:
      traefik.http.routers.blog.entrypoints: websecure
      traefik.http.routers.blog.rule: Host(`blog.picasoft.net`)
      traefik.http.services.blog.loadbalancer.server.port: 7878
      traefik.enable: true
    networks:
      - plume
      - proxy
    depends_on:
      - blog-db
    restart: unless-stopped

  blog-db:
    image: postgres:12
    container_name: blog-db
    env_file: ./secrets/plume_db.secrets
    volumes:
      - db:/var/lib/postgresql/data
    networks:
     - plume
    restart: unless-stopped
