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>
network_mode: host
ports:
- 8080:8080
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.net.preferIPv4Stack=true"
- CB_MAXHEAPSIZE=<CB_MAXHEAPSIZE>
# Manual - RMI
- CB_RMI_CACHE_HOSTNAME=<HOSTNAME>
- CB_RMI_CACHE_INSTANCES=<CLUSTER_HOSTNAMES>
- 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
# JGroups Channel config
- CB_JGROUPS_CHANNEL_TCP_PING_PORT=5000
- CB_JGROUPS_CHANNEL_TCP_PING_ADDRESSES=<CLUSTER_HOSTNAMES>
- CB_JGROUPS_TEST_CHANNEL_TCP_PING_PORT=6000
- 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
Docker compose file above will start a codeBeaer instance first and a autoheal after the codeBeamer was able to start with no issue. It is important because a long running database upgrade might mark the container unhealthy and autoheal restart it.
Configuration options of docker container can be found here:
Docker
Cluster specific configurations
network_mode: host
Both containers must be started with network_mode: host configuration. It is required because JGroups uses a random port for communication
HOSTNAME
Hostname of the current server. It is required for cache synchronisation
CLUSTER_HOSTNAMES
Hostnames of the cluster environment. It is required for cache synchronisation
Limitations
- Current solution of the cluster is not able to scale up automatically. Because of the CLUSTER_HOSTNAMES must contains all host in the cluster.
- In case the hostname of any server of the cluster has been changed, all servers must be restarted.
Recommendations
- Instead of using IP addresses use domain names. It helps you keep the same configuration
- Servers should not be available from public internet, only via load balancer