
services:
  postgres:
    image: postgres
    restart: unless-stopped
    environment:
      - POSTGRES_DB=kontor
      - POSTGRES_USER=kontor
      #- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
      - POSTGRES_PASSWORD=kontor
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U kontor"]
      interval: 1s
      timeout: 5s
      retries: 10
    ports:
      - 5432:5432
    networks:
      - database
    volumes:
      - postgres-data:/var/lib/postgresql/data:rw
    secrets:
      - db-password
  adminer:
    image: adminer
    ports:
      - 8090:8080
    networks:
      - database
      - frontend
  couchdb:
    image: couchdb
    restart: unless-stopped
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=admin
    ports:
      - 5984:5984
    networks:
      - database
      - frontend
    volumes:
      - couchdb-data:/opt/couchdb/data
    secrets:
      - couchdb-password
  activemq:
    image: apache/activemq-artemis:latest-alpine
    restart: unless-stopped
    ports:
      - 61616:61616
      - 8161:8161
      - 5672:5672
    networks:
      - integration
      - frontend
    volumes:
      - activemq-data:/var/lib/artemis-instance
  kontor:
    image: kontor:0.2.0-SNAPSHOT
    restart: unless-stopped
    networks:
      - database
      - integration
      - frontend
    ports:
      - 8000:8000
    volumes:
      - images-data:/data/images
    depends_on:
      postgres:
        condition: service_healthy
  kontor-api:
    image: kontor-api:0.2.0-SNAPSHOT
    restart: unless-stopped
    networks:
      - database
      - integration
      - frontend
    ports:
      - 8800:8800
    volumes:
      - images-data:/data/images
    depends_on:
      postgres:
        condition: service_healthy
networks:
  database:
  integration:
    name: integration
  frontend:
volumes:
  postgres-data:
  couchdb-data:
  activemq-data:
  images-data:
secrets:
  db-password:
    file: db-password.txt
  couchdb-password:
    file: couchdb-password.txt

