version: "2.1"
services:


#########################################################################################################
# The following section is for the transaction Docker image                                             
#image: The URL and tag to the transaction Docker image.                                                        
#hostname: A name for the transaction server container.                                                 
#ports: Ports exported by transaction server. Port 5443 is SSL port.                                   
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to download 
#          the necessary Docker images.                                                                 
#TZ: The time zone.       
#adminPassword: The password for user configadmin, which is used to access the WebSphere Application Server Administrative Console  
#  If you omit adminPassword, then the default password is a random string                                                                                
#depends_on: The app container depends on the db container. The db container must be running                   
#            for the app container to start.  
#<IP_of_live_db>: The IP of the external database server.    
#MERCHANTKEY_ENCRYPT: The encrypted merchant key that you created when you loaded the database schema. 
#   Merchant key is needed to decrypt the data read from the database.                                                      
#########################################################################################################
  txn:
    image: <Docker_registry>/commerce/ts-app:<tag>
    hostname: live_txn
    environment:
      - LICENSE=accept
      - TZ=Toronto/Canada
      - adminPassword=passw0rd
      - MERCHANTKEY_ENCRYPT=<encrypted_merchant_key>      
    ports:
      - 5080:5080
      - 5443:5443
      - 9060:9060
      - 9043:9043
    networks:
      default:
        aliases:
          - app
    extra_hosts:
      - "db:<IP_of_live_db>"
    healthcheck:
      test: curl -f http://localhost:5080/wcs/resources/health/ping
      interval: 10s
      retries: 50


      
##################################################################################################################################
# The following section is for the web Docker image                                                                              
#image: The URL and tag to the web server Docker image.                                                                                  
#hostname: A name for the web server container.                                                                                  
#ports: Ports exported by web server. All ports are SSL ports.                                                                   
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to use the Docker images.   
#TZ: The time zone.                                                                                                              
#depends_on: The web container depends on the txn container. The app container must be running for the web container to start.   
##################################################################################################################################
  web:
    image: <Docker_registry>/commerce/ts-web:<tag>
    hostname: live_web
    environment:
      - LICENSE=accept
      - TZ=Toronto/Canada
    ports:
      - 80:80
      - 443:443
      - 8000-8002:8000-8002
      - 8004:8004
    depends_on:
      txn:
        condition: service_healthy
    healthcheck:
      test: exit 0
   

#########################################################################################################
# The following section creates the search repeater                                            
#image: The URL and tag to the search Docker image.                                                             
#hostname: A name for the search repeater container.                                                      
#ports: Ports exported by search repeater server. Port 3738 is SSL port.                                         
#environment: Specify the type of search node for this search container.                                                                                       
#             - SOLR_MASTER=true                                                                      
#             - SOLR_SLAVE=true                                                                                                                                              
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to download 
#         the necessary Docker images.                                                                  
#TZ: The time zone.                                                                                     
#depends_on: The search container depends on the db container. The db container must be running         
#            for the search container to start.                                         
#<IP_of_live_db>: The IP of the external database server.  
#<IP_of_host_running_search_master>: The IP of the authoring environment running the search master.
#healthcheck: Checks the health of Search server. 
#BASE64_ENCRYPTED_SPIUSER_PASSWORD  
#    1. run the following command: echo -n "spiuser:<plain text spiuser password>" | base64
#    2. use the output value to replace <BASE64_ENCRYPTED_SPIUSER_PASSWORD>     
#########################################################################################################
  search_repeater:
    image: <Docker_registry>/commerce/search-app:<tag>
    hostname: search_repeater
    environment:
      - SOLR_MASTER=true
      - SOLR_SLAVE=true
      - SOLR_MASTER_SERVER_URL=search_master:3737
      - WORKAREA=/search
      - LICENSE=accept
      - TZ=Toronto/Canada
    ports:
      - 3737:3737
      - 3738:3738
    extra_hosts:
      - "db:<IP_of_live_db>"
      - "search_master:<IP_of_host_running_search_master>"
    healthcheck:
      test: ["CMD", "curl", "-f", "-H", "Authorization: Basic <BASE64_ENCRYPTED_SPIUSER_PASSWORD>", "http://localhost:3737/search/admin/resources/health/ping"]


 #########################################################################################################
# The following section creates the search slave                                            
#image: The URL and tag to the search Docker image.                                                             
#hostname: A name for the search slave container.                                                      
#ports: Ports exported by search server. Port 3738 is SSL port.                                         
#environment: Specify the type of search node for this search container.                                                                                       
#             - SOLR_MASTER=false                                                                      
#             - SOLR_SLAVE=true                                                                                                                                              
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to download 
#         the necessary Docker images.                                                                  
#TZ: The time zone.                                                                                     
#depends_on: The search container depends on the db container. The db container must be running         
#            for the search container to start.    
#SOLR_REPLICATION_POLLINTERVAL:  Interval in which the slave should poll master. 
#<IP_of_live_db>: The IP of the external database server.   
#healthcheck: Checks the health of Search server. 
#BASE64_ENCRYPTED_SPIUSER_PASSWORD  
#    1. run the following command: echo -n "spiuser:<plain text spiuser password>" | base64
#    2. use the output value to replace <BASE64_ENCRYPTED_SPIUSER_PASSWORD>                                                 
#########################################################################################################           
  search_slave:
    image: <Docker_registry>/commerce/search-app:<tag>
    hostname: search_slave
    environment:
      - SOLR_SLAVE=true
      - SOLR_MASTER_SERVER_URL=search_repeater:3737
      - SOLR_REPLICATION_POLLINTERVAL=00:00:60
      - WORKAREA=/search
      - LICENSE=accept
      - TZ=Toronto/Canada
    extra_hosts:
      - "db:<IP_of_live_db>"
    depends_on:
      search_repeater:
        condition: service_healthy
    networks:
      default:
        aliases:
          - search
    healthcheck:
      test: ["CMD", "curl", "-f", "-H", "Authorization: Basic <BASE64_ENCRYPTED_SPIUSER_PASSWORD>", "http://localhost:3737/search/admin/resources/health/ping"]


#########################################################################################################
# The following section is for the Store Docker image                                                   
#image: The URL and tag to the store Docker image.                                                              
#hostname: A name for the store server container.                                                       
#ports: Ports exported by store server. Port 8443 is SSL port.                                          
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to          
#         download the necessary Docker images.                                                         
#TZ: The time zone.                                                                                     
#depends_on: The store container depends on the app container and search container.                     
#            The app and search containers must be running for the store container to start.            
#########################################################################################################
  store:
    image: <Docker_registry>/commerce/crs-app:<tag>
    hostname: live_store
    environment:
      - LICENSE=accept
      - TZ=Toronto/Canada
    ports:
      - 8080:8080
      - 8443:8443
    depends_on:
      txn:
        condition: service_healthy
      search_slave:
        condition: service_healthy
    healthcheck:
      test: curl -f http://localhost:8080/wcs/HealthCheck.jsp


#################################################################################################################################
# The following section is for the Customization server Docker image                                                            
#image: The URL and tag to the utilities Docker image.                                                                                  
#hostname: A name for the customizationtainer.                                                                                                                                                                 
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to use the Docker images.   
#TZ: The time zone.                                                
#ports: Ports exported by customization container.  
#################################################################################################################################      
  xc:
    image: <Docker_registry>/commerce/xc-app:<tag>
    hostname: live_xc
    environment:
      - LICENSE=
      - TZ=Toronto/Canada
    ports:
      - "9080:9080"
      - "9443:9443"      

#################################################################################################################################
# The following section is for the utilities Docker image                                                                       
#image: The URL and tag to the utilities Docker image.                                                                                  
#hostname: A name for the utilities container.                                                                                  
#LICENSE: Specify 'LICENSE=accept' to accept the terms and agreements and gain access to use the Docker images.  
#DBHOST: The database host. 
#DBNAME: Database name.
#DBPORT: Port exported by the database server.
#DBUSER: The database user name.
#DBADMIN: The database administrator user name.                                                                            
#tty: Connects a pseudo terminal to access the utilities inside the container.  
#<IP_of_live_db>: The IP of the external database server.                                                  
#################################################################################################################################
  utils:
    image: <Docker_registry>/commerce/ts-utils:<tag>
    hostname: live_utils
    environment:
      - LICENSE=accept
      - DBHOST=db
      - DBNAME=mall
      - DBPORT=50000
      - DBUSER=wcs
      - DBADMIN=db2inst1
    tty: true
    healthcheck:
      test: exit 0
    extra_hosts:
      - "db:<IP_of_live_db>"
