Commit 23819e69 authored by Luca Cinquini's avatar Luca Cinquini
Browse files

Adding first version of docker-stack.yml file for full ESGF node.

parent accb3687
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ sed -i 's/PRODUCTION_SERVER = True/PRODUCTION_SERVER = False/g' $COG_CONFIG_DIR/

# start django server in virtual environment
# or keep the container running
if [ $RUNSERVER ]; then
if [ $RUNSERVER == "true" ]; then
   # start supervisor --> cog
   supervisord -c /etc/supervisord.conf
   sleep 2

docker-stack.yml

0 → 100644
+127 −0
Original line number Diff line number Diff line
# Docker compose file to start a full ESGF node as a distrubuted stack

# Required env variables:
#
# ESGF_CONFIG : points to the root ESGF configuration directory
#       example: export ESGF_CONFIG=/Users/cinquini/ESGF_CONFIG
# ESGF_HOSTNAME: HostName or IP address for apache httpd front-end server
#       example: export ESGF_HOSTNAME=my.esgf.node
#       example: export ESGF_HOSTNAME=`docker-machine ip`
# ESGF_VERSION: version of ESGF/Docker distribution
#       example: export ESGF_VERSION=1.0
# ESGF_DATA_DIR: root of ESGF data directories
#
# Services deployment:
# - front_node: httpd daemon, cog (for data initialization) and visualizer
# - db_node: postgres

version: '3'

networks:
  # network to keep postgres database isolated
  dbnetwork:

services:

  # ESGF postgres database
  esgf-postgres:
    image: esgfhub/esgf-postgres:${ESGF_VERSION}
    ports:
      - "5432:5432"
    networks:
      - dbnetwork
    volumes:
      - pg_data:/var/lib/pgsql/data
    deploy:
      placement:
        constraints: [node.labels.esgf_type == db_node]

  # CoG
  # data container to hold CoG source code and python virtual environment
  # this container stops after the volume 'cog_data' is initialized
  esgf-cog:
    image: esgfhub/esgf-cog:${ESGF_VERSION}
    ports:
      - "8000:8000"
    volumes:
      - cog_data:/usr/local/cog/cog_config
      - cog_install_dir:/usr/local/cog/cog_install
      - cog_venv:/usr/local/cog/venv
      - $ESGF_CONFIG/httpd/certs/:/etc/certs/
      - $ESGF_CONFIG/httpd/conf/esgf-httpd.conf:/etc/httpd/conf.d/esgf-httpd.conf
      - $ESGF_CONFIG/grid-security/certificates/:/etc/grid-security/certificates/
      - $ESGF_CONFIG/esg/config/:/esg/config/
    #command: $ESGF_HOSTNAME true true # ESGF=true, keep django server runnining on port 8000
    command: $ESGF_HOSTNAME true false # ESGF=false, django server running on port 8000 = false
    depends_on:
      - esgf-postgres
    networks:
      - dbnetwork
    environment:
      - COG_DIR=/usr/local/cog
      - COG_INSTALL_DIR=/usr/local/cog/cog_install
      - COG_CONFIG_DIR=/usr/local/cog/cog_config
      - ESGF_HOSTNAME
    deploy:
      placement:
        constraints: [node.labels.esgf_type == front_node]

  esgf-httpd:
    image: esgfhub/esgf-httpd:${ESGF_VERSION}
    entrypoint: /usr/local/bin/docker-entrypoint.sh
    volumes:
      - cog_data:/usr/local/cog/cog_config
      - cog_install_dir:/usr/local/cog/cog_install
      - cog_venv:/usr/local/cog/venv
      - $ESGF_CONFIG/httpd/certs/:/etc/certs/
      - $ESGF_CONFIG/httpd/conf/esgf-httpd.conf:/etc/httpd/conf.d/esgf-httpd.conf
      - $ESGF_CONFIG/grid-security/certificates/:/etc/grid-security/certificates/
      - $ESGF_CONFIG/esg/config/:/esg/config/
      # - esgf-node-manager
    environment:
      - SSL_CERT_DIR=/etc/grid-security/certificates
      - COG_CONFIG_DIR=/usr/local/cog/cog_config
      - ESGF_HOSTNAME
    ports:
     - "80:80"
     - "443:443"
    depends_on:
     - esgf-cog
    #  - esgf-node-manager
    # httpd URLs must use hostname=$ESGF_HOSTNAME
    networks:
      default:
        aliases:
          - "${ESGF_HOSTNAME}"
      dbnetwork: {}
    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 1
      placement:
        constraints: [node.labels.esgf_type == front_node]

# Use Docker volumes to store persistent data
# (which survives when the containers are removed)
# When services are first started, 
# volumes are initialized with content from directory in container

volumes:
  # postgres data and configuration
  pg_data:
  # cog data directory
  cog_data:
  # cog source directory
  cog_install_dir:
  # cog venv directory
  cog_venv:
  # contains Solr index data
  #solr_data:
  # contains TDS configuration, catalogs, cache, and logs
  # (directory below -Dtds.content.root.path=/esg/content)
  #tds_data: