You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Multi-image Discovery with PostgreSQL

Currently Corteza Discovery is tested on a running production servers in combination with PostgreSQL database, but should work with the latest MySQL versions. Beside the server and db containers, there should be also the indexer (es) and the searcher (discovery) running.

docker-compose.yaml
version: '3.5'

services:
  server:
    image: cortezaproject/corteza:${VERSION}
    env_file: [ .env ]
    depends_on: [ db ]
    networks: [ proxy, internal ]
    environment:
      VIRTUAL_HOST:     ${DOMAIN}
      LETSENCRYPT_HOST: ${DOMAIN}
    volumes: [ "./data/server:/data" ]
    restart: on-failure

  db:
    image: postgres:13
    networks: [ internal ]
    restart: on-failure
    healthcheck: { test: ["CMD-SHELL", "pg_isready -U corteza"], interval: 10s, timeout: 5s, retries: 5 }
    environment:
      POSTGRES_USER:     corteza
      POSTGRES_PASSWORD: corteza

  es:
    image: opensearchproject/opensearch:1.3.0
    restart: on-failure
    networks: [ internal ]
    environment:
      - cluster.name=es-docker-cluster
      - node.name=es
      - cluster.initial_master_nodes=es
      - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
      - OPENSEARCH_JAVA_OPTS=-Xms8000m -Xmx8000m # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
      - DISABLE_INSTALL_DEMO_CONFIG=true
      - DISABLE_SECURITY_PLUGIN=true
      - VIRTUAL_HOST=es.${DOMAIN}
      - LETSENCRYPT_HOST=es.${DOMAIN}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./data/es:/usr/share/elasticsearch/data

  discovery:
    image: cortezaproject/corteza-server-discovery:${VERSION}
    restart: on-failure
    env_file: [ .env ]
    depends_on: [ es, server ]
    networks: [ proxy, internal ]
    environment:
      VIRTUAL_HOST: discovery.${DOMAIN}
      VIRTUAL_PORT: 80
      LETSENCRYPT_HOST: discovery.${DOMAIN}

networks: { internal: {}, proxy: { name: proxy } }
.env
########################################################################################################################
# General settings
DOMAIN=your-demo.example.tld
VERSION=2022.3.0

########################################################################################################################
# Database connection

DB_DSN=postgres://corteza:corteza@db:5432/corteza?sslmode=disable

########################################################################################################################
# Server settings

# Serve Corteza webapps alongside API
HTTP_WEBAPP_ENABLED=true

########################################################################################################################
# Server Discovery configs

DISCOVERY_ENABLED=true
DISCOVERY_DEBUG=true
DISCOVERY_CORTEZA_DOMAIN=https://your-demo.example.tld
DISCOVERY_BASE_URL=//discovery.your-demo.example.tld
CORTEZA_SERVER_BASE_URL=http://server:80

ES_ADDRESS=http://es:9200
ES_INDEX_INTERVAL=300
HTTP_ADDR=0.0.0.0:80

# Corteza Discovery indexer configuration
DISCOVERY_INDEXER_ENABLED=true
DISCOVERY_INDEXER_PRIVATE_INDEX_CLIENT_KEY=${PRIVATE_KEY_EXAMPLE}
DISCOVERY_INDEXER_PRIVATE_INDEX_CLIENT_SECRET=${SECRET_EXAMPLE}

# Corteza Discovery searcher configuration
DISCOVERY_SEARCHER_ENABLED=true
DISCOVERY_SEARCHER_CLIENT_KEY=${CLIENT_KEY_EXAMPLE}
DISCOVERY_SEARCHER_CLIENT_SECRET=${CLIENT_SECRET_EXAMPLE}
DISCOVERY_SEARCHER_JWT_SECRET=${JWT_SECRET_EXAMPLE}
DISCOVERY_SEARCHER_ALLOWED_ROLE=${ROLE_ALLOWED_EXAMPLE}