How to Install Exalate for Zendesk on Docker

    This article shows how to install the Exalate app for Zendesk on the server using Docker.

    Note: You need to install Docker.  Check the Docker documentation for more details.

    Steps to Install Exalate for Zendesk on Docker

    Note: Check the release notes for the latest version.

    1. Create or download the docker-compose.yml

    In the example below docker-compose.yml file can be used to install Exalate for Zendesk.

    1. Create a directory that would hold the docker-compose file:

      cd ~
      mkdir exalate-zendesknode
    2. Move into the newly created directory and create a docker-compose.yml file using your favorite editor:

      cd exalate-zendesknode
      vim docker-compose.yml

      The file should contain the following information:

      version: '2'
      
      services:
        database:
          restart: unless-stopped
          image: postgres:9.6
          volumes:
            - ./persist/db:/var/lib/postgresql/data
            - ./createdb.sh:/docker-entrypoint-initdb.d/init-user-db.sh
          environment:
            - POSTGRES_PASSWORD=changeme
            - DB_NAME=zendesknode
            - DB_USER=idalko
            - DB_PASS=idalko
          networks:
            - dbnet
      
        zendesknode:
          restart: unless-stopped
          ports:
            - 9302:9002
      
          #
          # Change the image tag to the required version
          # Check Release History on docs.exalate.com for an overview
          #
          image: idalko/zendesknode:5.4.8
          depends_on:
            - database #wait for postgres to be started, not for ready
          volumes:
            - ./persist/home:/opt/zendesknode/data
          environment:
            # Add your enviroment settings here
            - ZENDESKNODE_PG_HOST=database
            - ZENDESKNODE_PG_DB=zendesknode
            - ZENDESKNODE_PG_USER=idalko
            - ZENDESKNODE_PG_PWD=idalko
            - ZENDESKNODE_PORT=9302
      
           #As part of the security improvements, Exalate 5.5.0 validates the origin header
           #that the browser is sending upon every request to Exalate.
           #In order to validate the origin header, Exalate needs to know what is the URL 
           #leading to it.
           #When deploying Exalate to Docker one needs to put an environment variable NODE_SELF_URL.
           #Example:
           # When you deploy Exalate onto a server, you configure a DNS rule such that 
           #whenever people navigate to foo.com, they reach your server's Exalate. 
           #You set up SSL so that https://foo.com leads to your Exalate on your server.
           #Now you need to set environment variable 
      
           - NODE_SELF_URL=https://foo.com 
      
           #for your Exalate docker container.
      
          networks:
            - dbnet
            - default
      
      networks:
        dbnet:
          driver: bridge
        default:
          driver: bridge
      
      
      Please note the following:
      • Line 6: Choose the correct version of PostgreSQL
      • Line 21: Add the correct ports. 
      • Line 27: Choose the latest stable release from here.
      • Line 38: Use the correct port here. 
      • Optionally, you can set up a reverse proxy such as nginx in order to terminate SSL connections.

    2. Ensure that a correct database is set up using a createdb.sh

    Create createdb.sh (referenced from docker-compose.yml):

    #!/bin/bash
      
    TEST=`psql -U postgres <<-EOSQL
       SELECT 1 FROM pg_database WHERE datname='$DB_NAME';
    EOSQL`
      
    echo "******CREATING DOCKER DATABASE******"
    if [[ $TEST == "1" ]]; then
        # database exists
        # $? is 0
        exit 0
    else
    psql -U postgres <<-EOSQL
       CREATE ROLE $DB_USER WITH LOGIN ENCRYPTED PASSWORD '${DB_PASS}' SUPERUSER;
    EOSQL
      
    psql -U postgres <<-EOSQL
       CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
    EOSQL
      
    psql -U postgres <<-EOSQL
       GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;
    EOSQL
    fi
      
    echo ""
    echo "******DOCKER DATABASE CREATED******"

    3. Set environment variables if necessary

    Below you can find the environment variables used for the app container. All of them are optional, and in the given example, we've overridden ZENDESKNODE_PG_DB, ZENDESKNODE_PG_USER, and ZENDESKNODE_PG_PWD just to show how to pass different credentials to the Exalate application.

     Full list of environment variables:
    Variable nameDefault valueExampleDescription
    ZENDESKNODE_PG_HOSTZENDESKNODE_PG_HOST=databaseZENDESKNODE_PG_HOST=db.acme.comtells the Exalate application where the Postgres database to connect to is hosted.
    ZENDESKNODE_PG_DBZENDESKNODE_PG_DB=zendesknodeZENDESKNODE_PG_DB=exalatetells the Exalate application what is the Postgres database name for the Exalate application.
    ZENDESKNODE_PG_USERZENDESKNODE_PG_USER=idalkoZENDESKNODE_PG_USER=exalatetells the Exalate application what is the Postgres database username for the Exalate application to perform queries with.
    ZENDESKNODE_PG_PWDZENDESKNODE_PG_PWD=idalkoZENDESKNODE_PG_PWD=secrettells the Exalate application what is the Postgres database user's password for the Exalate application to perform queries with.
    ZENDESKNODE_PORTZENDESKNODE_PORT=9000ZENDESKNODE_PORT=8080

    tells which port to start the Exalate application on. 

    Note that this is the port within the exalatezendesknode_zendesknode_1 container, thus if this variable is changed (for example to 80), the

        ports:
          - 9000:9000

    should also be changed to

        ports:
          - 8080:8080


    ZENDESKNODE_SMTP_HOST_NAMEZENDESKNODE_SMTP_HOST_NAME=mail.server.comZENDESKNODE_SMTP_HOST_NAME=smtp.gmail.comis used to send email notifications about errors blocking synchronization. 
    ZENDESKNODE_SMTP_PORTZENDESKNODE_SMTP_PORT=465ZENDESKNODE_SMTP_PORT=587is used to send email notifications about errors blocking synchronization.
    ZENDESKNODE_SMTP_FROMZENDESKNODE_SMTP_FROM=admin@admin.comZENDESKNODE_SMTP_FROM=my.name@gmail.comis used to send email notifications about errors blocking synchronization.
    ZENDESKNODE_SMTP_USERZENDESKNODE_SMTP_USER=adminZENDESKNODE_SMTP_USER=my.nameis used to send email notifications about errors blocking synchronization.
    ZENDESKNODE_SMTP_PASSZENDESKNODE_SMTP_PASS=1234567ZENDESKNODE_SMTP_PASS=secretis used to send email notifications about errors blocking synchronization.
    ZENDESKNODE_SMTP_TLSZENDESKNODE_SMTP_TLS=trueZENDESKNODE_SMTP_TLS=trueis used to send email notifications about errors blocking synchronization. Can be set to false, but then the ZENDESKNODE_SMTP_PORT should be set to the port, that accepts non-SSL and non-TLS connections.

    4. Start the application

    $ docker-compose up -d

    You can verify the status by using: 

    • $ docker-compose
    • $ docker-compose logs

    5. Verify the installation

    After performing the aforementioned steps and checking that the container is up, you should be able to access the Exalate console via http://localhost:9302

    Note: You may need to set up local port forwarding in order to get this to work. 

    Please continue to set up your Zendesk node by following the guide

    Register the Node in the Mapper

    The node needs to be registered in the Exalate mapper.  The Exalate mapper is a kind of DNS service that maps instances to nodes.
    Please raise a ticket on the support portal providing the following:

    • URL of the Zendesk instance.
    • URL of the Exalate node which has been deployed on-premise.

    How to Manage the Application on Docker

    Run Queries to the Application's Database

    cd ~/exalate-zendesknode
    docker exec -it exalate-zendesknode_database_1 bash
    su postgres
    psql -A $DB_NAME

    You can find all tables using Psql's \dt+ command: 

    \dt+

    All the Postgres SQL queries are permitted.

    To exit the application's DB:

    \q
    # \q exits the psql 
    exit
    # exits the postgres user session
    exit
    # exits the exalate-zendesknode_database_1 bash session

    Inspect the application's filesystem

    cd ~/exalate-zendesknode
    docker exec -it exalate-zendesknode_zendesknode_1 bash

    Remove the application

    cd ~/exalate-zendesknode
    docker-compose rm

    Remove the application data

    Warning:  do this only if you want to delete all the synchronization information, including the current synchronizations enqueued to be performed, and synchronization status. 

    Ensure that the remote side you exalate issues with knows that you're stopping synchronization and is ready to handle synchronization errors.

    cd ~/exalate-zendesknode
    # docker volume ls | grep exalate-zendesknode_vol |  awk '{ print $2 }' | xargs docker volume rm
    docker volume rm exalate-zendesknode_voldatabase
    docker volume rm exalate-zendesknode_volzendesknode

    Troubleshooting

    Issues during the installation of the Exalate server for Zendesk

    If you have issues during the installation of the Exalate app for Zendesk, you can find logs describing possible problems inside /tmp.

    The name for the file is generated randomly and automatically by the OS, but you can find the file by the creation date.

    Issues while running the Exalate server for Zendesk

    Logs will be generated under the directory: /opt/zendesknode/data/logs.

    Refer to these logs to get more information about possible issues and communicate with our support if you need any assistance.

    Support

    Check our Support options.