How to Start Docker Containers for Cluster Environments
This page requires advanced Docker and Docker-Compose know how!
Docker-Compose for Cluster
docker-compose.yml
version: '2.1'
services:
codebeamer-autoheal:
image: willfarrell/autoheal
network_mode: host
depends_on:
codebeamer-app:
condition: service_healthy
environment:
- AUTOHEAL_CONTAINER_LABEL=ALL
volumes:
- /var/run/docker.sock:/var/run/docker.sock
codebeamer-app:
image: <DOCKER_IMAGE>
hostname: <hostname>
ports:
- 8080:8080
- 4001:4001
- 4002:4002
- 9000:9000
env_file:
- /tmp/environment.env
environment:
- CB_LOGGING_ERROR_TO=<error@example.com>
- TZ=<TZ>
- CB_CONTEXT_PATH=<CB_CONTEXT_PATH>
- CB_CLUSTER_ENABLED=true
- CB_CLUSTER_TEST_ENABLED=false
- "JVM_OPTIONS=-Djava.rmi.server.hostname=<hostname> -Djava.net.preferIPv4Stack=true"
- CB_MAXHEAPSIZE=<CB_MAXHEAPSIZE>
# RMI - Common
- CB_RMI_CACHE_HOSTNAME=<HOSTNAME>
- CB_RMI_REPLICATION_CACHE_PORT=4001
- CB_RMI_INVALIDATION_CACHE_PORT=4002
- CB_RMI_CACHE_SOCKET_TIMEOUT_MILLIS=12000
- CB_RMI_CACHE_REMOTE_OBJECT_PORT=9000
# RMI - Manual
- CB_RMI_CACHE_INSTANCES=<CLUSTER_HOSTNAMES>
# RMI - Discovery
## New configuration - TTL of living RMI cache node, if no update from the node after 10 seconds, codebeamer will remove this node from the cache synchronization
- CB_RMI_CACHE_TIME_TO_LIVE=10s
## New configuration - Frequently of RMI node's hearth beat
- CB_RMI_HEARTH_BEAT_INTERVAL=1s
- CB_SCHEDULER_FACTORY_THREAD_COUNT_INSTANCE=3
- CB_SCHEDULER_FACTORY_THREAD_COUNT_CONCURRENT=3
- CB_SCHEDULER_FACTORY_THREAD_COUNT_REPORT=3
- CB_SCHEDULER_FACTORY_THREAD_COUNT_REMOTE_JIRA_SYNC=3
- CB_SCHEDULER_FACTORY_THREAD_COUNT_REMOTE_DOORS_SYNC=3
- WAIT_HOSTS=<DATABASE_HOST>:<DATABASE_PORT>
- WAIT_HOSTS_TIMEOUT=120
- CB_database_JDBC_Username=<DATABASE_USER>
- CB_database_JDBC_Password=<DATABASE_PASSWORD>
- CB_database_JDBC_Driver=<DATABASE_DRIVER>
- CB_database_JDBC_ConnectionURL=<DATABASE_CONNECTION_URL>
- CB_database_JDBC_Timeout=<INTEGER>
volumes:
- /vol/access:/home/appuser/codebeamer/repository/access
- /vol/git:/home/appuser/codebeamer/repository/git
- /vol/svn:/home/appuser/codebeamer/repository/svn
- /vol/hg:/home/appuser/codebeamer/repository/hg
- /vol/docs:/home/appuser/codebeamer/repository/docs
- /vol/search:/home/appuser/codebeamer/repository/search
- /vol/logs:/home/appuser/codebeamer/logs
- /vol/lucene:/home/appuser/codebeamer/repository/lucene
- /vol/tmp:/home/appuser/codebeamer/repository/tmp
# Only if RMI - Discovery is configured
- /vol//home/appuser/codebeamer/repository/config/cache/peerDiscovery
The above Docker-compose file starts a Codebeamer instance first, and an autoheal after Codebeamer is able to start without any issues. It is important since a long running database upgrade might mark the container unhealthy and autoheal restart it.
For docker container configuration options, see Docker.
Cluster-Specific Configurations
Configuration |
Description |
HOSTNAME
|
The hostname of the current server. Required for cache synchronization. |
CLUSTER_HOSTNAMES
|
The hostnames of the cluster environment. Required for cache synchronization. |
Limitations
- The current solution of the cluster is not able to scale up automatically. Because of the CLUSTER_HOSTNAMES, must contain all host in the cluster.
- In case the hostname of any server of the cluster has been changed, all servers must be restarted.
Recommendations
- Using domain names instead of IP addresses helps you keep the same configuration.
- Servers should not be available from public internet, only via load balancer.
Example
For an example, see page Step-by-Step: How to Configure Codebeamer as Active-Active Cluster.