version: '3.9'
services:
  db:
    image: postgres:13
    restart: unless-stopped
    hostname: db
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    volumes:
      - chemotion_db:/var/lib/postgresql/data/
    networks:
      - chemotion

  msconvert:
    image: ptrxyz/chemotion:msconvert-1.5.1
    restart: unless-stopped
    hostname: msconvert
    volumes:
      - spectra:/shared:rw
    networks:
      - chemotion

  spectra:
    image: ptrxyz/chemotion:spectra-1.5.1
    restart: unless-stopped
    hostname: spectra
    volumes:
      - spectra:/shared:rw
    depends_on:
      - msconvert
    networks:
      - chemotion

  worker:
    image: ptrxyz/chemotion:eln-1.5.1
    restart: unless-stopped
    environment:
      - CONFIG_ROLE=worker
      - SECRET_KEY_BASE=pleasechangeme
    depends_on:
      - db
      - eln
      - spectra
    volumes:
      - chemotion_data:/chemotion/data/
      - chemotion:/chemotion/app
    networks:
      - chemotion

  eln:
    image: ptrxyz/chemotion:eln-1.5.1
    restart: unless-stopped
    environment:
      - CONFIG_ROLE=eln
      - SECRET_KEY_BASE=pleasechangeme
    depends_on:
      - db
      - spectra
    volumes:
      - ./shared/pullin:/shared
      - ./shared/backup:/backup
      - chemotion_data:/chemotion/data/
      - chemotion:/chemotion/app
    ports:
      - 4000:4000
    networks:
      - chemotion

  ketchersvc:
    image: ptrxyz/chemotion:ketchersvc-1.5.1
    restart: unless-stopped
    environment:
      - CONFIG_KETCHER_URL=http://eln:4000/ketcher/
    init: true
    depends_on:
      eln:
        condition: service_healthy
    networks:
      - chemotion

  converter:
    image: ptrxyz/chemotion:converter-1.5.1
    restart: unless-stopped
    environment:
      - SECRET_KEY=imsupersecretandwanttobechanged
    volumes:
      - ./services/converter/profiles:/srv/chemotion/profiles
      - ./services/converter/datasets:/srv/chemotion/datasets
    networks:
      - chemotion

volumes:
  chemotion:
    name: chemotion_app
  chemotion_data:
    name: chemotion_data
  chemotion_db:
    name: chemotion_db
  spectra:
    name: chemotion_spectra

networks:
  chemotion: