services:
  discourse:
    image: "bitnami/discourse:3.3.1"
    container_name: ${CONTAINER_NAME}
    restart: always
    networks:
      - 1panel-network
    ports:
      - "${PANEL_APP_PORT_HTTP}:${DISCOURSE_PORT_NUMBER}"
    volumes:
      - ./data/discourse:/bitnami/discourse
    environment:
      - DISCOURSE_DATA_TO_PERSIST=${DISCOURSE_DATA_TO_PERSIST}
      - DISCOURSE_ENABLE_HTTPS=${DISCOURSE_ENABLE_HTTPS}
      - DISCOURSE_EXTERNAL_HTTP_PORT_NUMBER=${DISCOURSE_EXTERNAL_HTTP_PORT_NUMBER}
      - DISCOURSE_EXTERNAL_HTTPS_PORT_NUMBER=${DISCOURSE_EXTERNAL_HTTPS_PORT_NUMBER}
      - DISCOURSE_HOST=${DISCOURSE_HOST}
      - DISCOURSE_PORT_NUMBER=${DISCOURSE_PORT_NUMBER}
      - DISCOURSE_SKIP_BOOTSTRAP=${DISCOURSE_SKIP_BOOTSTRAP}
      - DISCOURSE_SITE_NAME=${DISCOURSE_SITE_NAME}
      - DISCOURSE_ENV=${DISCOURSE_ENV}
      - DISCOURSE_PRECOMPILE_ASSETS=${DISCOURSE_PRECOMPILE_ASSETS}
      - DISCOURSE_ENABLE_CONF_PERSISTENCE=${DISCOURSE_ENABLE_CONF_PERSISTENCE}
      - DISCOURSE_EXTRA_CONF_CONTENT=${DISCOURSE_EXTRA_CONF_CONTENT}
      - DISCOURSE_PASSENGER_SPAWN_METHOD=${DISCOURSE_PASSENGER_SPAWN_METHOD}
      - DISCOURSE_PASSENGER_EXTRA_FLAGS=${DISCOURSE_PASSENGER_EXTRA_FLAGS}
      - DISCOURSE_USERNAME=${DISCOURSE_USERNAME}
      - DISCOURSE_PASSWORD=${DISCOURSE_PASSWORD}
      - DISCOURSE_EMAIL=${DISCOURSE_EMAIL}
      - DISCOURSE_FIRST_NAME=${DISCOURSE_FIRST_NAME}
      - DISCOURSE_LAST_NAME=${DISCOURSE_LAST_NAME}
      - DISCOURSE_SMTP_HOST=${DISCOURSE_SMTP_HOST}
      - DISCOURSE_SMTP_PORT_NUMBER=${DISCOURSE_SMTP_PORT_NUMBER}
      - DISCOURSE_SMTP_USER=${DISCOURSE_SMTP_USER}
      - DISCOURSE_SMTP_PASSWORD=${DISCOURSE_SMTP_PASSWORD}
      - DISCOURSE_SMTP_PROTOCOL=${DISCOURSE_SMTP_PROTOCOL}
      - DISCOURSE_SMTP_AUTH=${DISCOURSE_SMTP_AUTH}
      - DISCOURSE_SMTP_OPEN_TIMEOUT=${DISCOURSE_SMTP_OPEN_TIMEOUT}
      - DISCOURSE_SMTP_READ_TIMEOUT=${DISCOURSE_SMTP_READ_TIMEOUT}
      - DISCOURSE_DATABASE_HOST=${PANEL_DB_HOST}
      - DISCOURSE_DATABASE_PORT_NUMBER=${PANEL_DB_PORT}
      - DISCOURSE_DATABASE_NAME=${PANEL_DB_NAME}
      - DISCOURSE_DATABASE_USER=${PANEL_DB_USER}
      - DISCOURSE_DATABASE_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - DISCOURSE_DB_BACKUP_HOST=${PANEL_DB_HOST}
      - DISCOURSE_DB_BACKUP_PORT=${PANEL_DB_PORT}
      - DISCOURSE_REDIS_HOST=${REDIS_HOST}
      - DISCOURSE_REDIS_PORT_NUMBER=${REDIS_PORT}
      - DISCOURSE_REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
      - DISCOURSE_REDIS_USE_SSL=${DISCOURSE_REDIS_USE_SSL}
      - POSTGRESQL_CLIENT_POSTGRES_USER=${PANEL_DB_USER}
      - POSTGRESQL_CLIENT_POSTGRES_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - POSTGRESQL_CLIENT_CREATE_DATABASE_NAME=${PANEL_DB_NAME}
      - POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS=${POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS}
    labels:
      createdBy: "Apps"

  discourse-sidekiq:
    image: "bitnami/discourse:3.3.1"
    container_name: ${CONTAINER_NAME}-sidekiq
    restart: always
    networks:
      - 1panel-network
    volumes:
      - ./data/sidekiq:/bitnami/discourse
    command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
    environment:
      - DISCOURSE_DATA_TO_PERSIST=${DISCOURSE_DATA_TO_PERSIST}
      - DISCOURSE_ENABLE_HTTPS=${DISCOURSE_ENABLE_HTTPS}
      - DISCOURSE_EXTERNAL_HTTP_PORT_NUMBER=${DISCOURSE_EXTERNAL_HTTP_PORT_NUMBER}
      - DISCOURSE_EXTERNAL_HTTPS_PORT_NUMBER=${DISCOURSE_EXTERNAL_HTTPS_PORT_NUMBER}
      - DISCOURSE_HOST=${DISCOURSE_HOST}
      - DISCOURSE_PORT_NUMBER=${DISCOURSE_PORT_NUMBER}
      - DISCOURSE_SKIP_BOOTSTRAP=${DISCOURSE_SKIP_BOOTSTRAP}
      - DISCOURSE_SITE_NAME=${DISCOURSE_SITE_NAME}
      - DISCOURSE_ENV=${DISCOURSE_ENV}
      - DISCOURSE_PRECOMPILE_ASSETS=${DISCOURSE_PRECOMPILE_ASSETS}
      - DISCOURSE_ENABLE_CONF_PERSISTENCE=${DISCOURSE_ENABLE_CONF_PERSISTENCE}
      - DISCOURSE_EXTRA_CONF_CONTENT=${DISCOURSE_EXTRA_CONF_CONTENT}
      - DISCOURSE_PASSENGER_SPAWN_METHOD=${DISCOURSE_PASSENGER_SPAWN_METHOD}
      - DISCOURSE_PASSENGER_EXTRA_FLAGS=${DISCOURSE_PASSENGER_EXTRA_FLAGS}
      - DISCOURSE_USERNAME=${DISCOURSE_USERNAME}
      - DISCOURSE_PASSWORD=${DISCOURSE_PASSWORD}
      - DISCOURSE_EMAIL=${DISCOURSE_EMAIL}
      - DISCOURSE_FIRST_NAME=${DISCOURSE_FIRST_NAME}
      - DISCOURSE_LAST_NAME=${DISCOURSE_LAST_NAME}
      - DISCOURSE_SMTP_HOST=${DISCOURSE_SMTP_HOST}
      - DISCOURSE_SMTP_PORT_NUMBER=${DISCOURSE_SMTP_PORT_NUMBER}
      - DISCOURSE_SMTP_USER=${DISCOURSE_SMTP_USER}
      - DISCOURSE_SMTP_PASSWORD=${DISCOURSE_SMTP_PASSWORD}
      - DISCOURSE_SMTP_PROTOCOL=${DISCOURSE_SMTP_PROTOCOL}
      - DISCOURSE_SMTP_AUTH=${DISCOURSE_SMTP_AUTH}
      - DISCOURSE_SMTP_OPEN_TIMEOUT=${DISCOURSE_SMTP_OPEN_TIMEOUT}
      - DISCOURSE_SMTP_READ_TIMEOUT=${DISCOURSE_SMTP_READ_TIMEOUT}
      - DISCOURSE_DATABASE_HOST=${PANEL_DB_HOST}
      - DISCOURSE_DATABASE_PORT_NUMBER=${PANEL_DB_PORT}
      - DISCOURSE_DATABASE_NAME=${PANEL_DB_NAME}
      - DISCOURSE_DATABASE_USER=${PANEL_DB_USER}
      - DISCOURSE_DATABASE_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - DISCOURSE_DB_BACKUP_HOST=${PANEL_DB_HOST}
      - DISCOURSE_DB_BACKUP_PORT=${PANEL_DB_PORT}
      - DISCOURSE_REDIS_HOST=${REDIS_HOST}
      - DISCOURSE_REDIS_PORT_NUMBER=${REDIS_PORT}
      - DISCOURSE_REDIS_PASSWORD=${PANEL_REDIS_ROOT_PASSWORD}
      - DISCOURSE_REDIS_USE_SSL=${DISCOURSE_REDIS_USE_SSL}
    labels:
      createdBy: "Apps"

networks:
  1panel-network:
    external: true
