Written by The Jahia Team
 
Sysadmins
   Estimated reading time:

The Dockerfile used to generate the jahia/jcustomer image is available here. The jahia/jcustomer image is used to run development, test and production workload. Its resource allocation depends on the use case.

Pull command docker pull jahia/jcustomer:1.5.1
Exposed port 8181 (HTTP), 9443 (HTTPs)
Min/Max memory 2GB/8GB
vCPU requirements 2/4 vCPUs
Volume none

Quick start

Docker run parameters

The start command of the Docker image is:

docker run -p 8181:8181 -p 9443:9443 --env-file /path/to/my-env-file jahia/jcustomer:1.5.1

Configuring the jCustomer Docker image

The jCustomer Docker image can be configured using two different methods:

  • An environment file containing all of the configurations
  • Environment variables passed at launch

Option 1: Configuring the environment file

Refer to Installing Elasticsearch, jCustomer, and jExperience to understand each configuration key.

unomi_env_var_UNOMI_ELASTICSEARCH_ADDRESSES=elasticsearch:9300
unomi_env_var_UNOMI_ELASTICSEARCH_CLUSTERNAME=docker-cluster
unomi_env_var_UNOMI_CLUSTER_PUBLIC_ADDRESS=http://<public.address>
unomi_env_var_UNOMI_CLUSTER_PRIVATE_ADDRESS=http://<private.address>
unomi_env_var_JAVA_MAX_MEM=2G
unomi_env_var_UNOMI_ROOT_PASSWORD=AnAwesomePassword
unomi_env_var_UNOMI_HAZELCAST_TCPIP_MEMBERS=unomi1,unomi2,unomi3
MAXMIND_KEY=XXXXXXXXXXXXXXXXX
Note: When internal and external calls do not need to be separated, http://public.address/ and http://private.address can be the same address. In a local environment, both endpoints are usually http://127.0.0.1:8181 (public) and http://127.0.0.1:9443 (private).

Option 2: Configuring environment variables

jCustomer can be configured by passing environment variables to the container at startup (see the Custom configuration deployment section to learn more).

Environment variable Default Description
MAXMIND_KEY   The MAXMIND API key to fetch GeoLite DB (see https://dev.maxmind.com/geoip/geoip2/geolite2/). If not provided, the db won't be fetched.
DB_NAME jahia  
unomi_env_var_UNOMI_ELASTICSEARCH_ADDRESSES   example: elasticsearch:9300
unomi_env_var_UNOMI_ELASTICSEARCH_CLUSTERNAME   example: docker-cluster
unomi_env_var_UNOMI_CLUSTER_PUBLIC_ADDRESS   example: http://public.address
unomi_env_var_UNOMI_CLUSTER_PRIVATE_ADDRESS   example: http://private.address
unomi_env_var_JAVA_MAX_MEM 1G  
unomi_env_var_UNOMI_ROOT_PASSWORD    
unomi_env_var_UNOMI_HAZELCAST_TCPIP_MEMBERS   example: unomi1,unomi2,unomi3

Cluster configuration

To run jCustomer in clustered mode, a Docker network needs to be created. It is a simple four-step process:

  1. Initialize the network.
        docker network create -d bridge jcustomer-net
  2. (optional) Run a dockerized Elasticsearch instance.
        docker run -d --name elasticsearch --net=jcustomer-net -e "discovery.type=single-node" -e xpack.security.enabled=false -v /usr/share/elasticsearch/data:/my/local/folder
     docker.elastic.co/elasticsearch/elasticsearch:7.4.2
  3. Create an environment configuration file (or use the equivalent environment variable-based entries).
        unomi_env_var_UNOMI_ELASTICSEARCH_ADDRESSES=elasticsearch:9300
    unomi_env_var_UNOMI_ELASTICSEARCH_CLUSTERNAME=docker-cluster
    unomi_env_var_UNOMI_CLUSTER_PUBLIC_ADDRESS=http://<public.address>
    unomi_env_var_UNOMI_CLUSTER_PRIVATE_ADDRESS=<http://private.address>
    unomi_env_var_JAVA_MAX_MEM=2G
    unomi_env_var_UNOMI_ROOT_PASSWORD=myPassword
    unomi_env_var_UNOMI_HAZELCAST_TCPIP_MEMBERS=unomi1,unomi2,unomi3
  4. Start as many jCustomer containers as needed, each with a unique name.
        docker run -d --name=unomi1 --hostname=unomi1 -p 8181:8181 --net=jcustomer-net --env-file ./env_file jahia/jcustomer:1.5.1
    docker run -d --name=unomi2 --hostname=unomi2 -p 8182:8181 --net=jcustomer-net --env-file ./env_file jahia/jcustomer:1.5.1
    docker run -d --name=unomi3 --hostname=unomi3 -p 8183:8181 --net=jcustomer-net --env-file ./env_file jahia/jcustomer:1.5.1

Upgrading jCustomer

The upgrade of jCustomer based on the jahia/jcustomer Docker image is a straightforward process:

  1. Stop the jCustomer container (or containers if you run a cluster).
  2. Start a new jCustomer container, that points to the same volume and database as the previous one.
  3. For clustered environments, once the first jCustomer container has finished starting, all the others can be started at the same time. The first container to start will upgrade the Elasticsearch data if needed.