Deploy 2 data center nodes of Confluence in docker

Hello!

In this article I will show you how you can deploy 2 data center nodes of Confluence in your local environments using the docker image provided by Atlassian.

This deployment will not include the load balancer because I need these nodes for app development to check if my app works properly in Data Center environment. That is why I always connect to a certain node.

First, you need to create this docker-compose.yml file:

version: '3'

services:
  confluence_node_1:
    depends_on:
      - postgresql
    image: atlassian/confluence:latest
    networks:
      confnet:
        ipv4_address: 192.168.0.3
    volumes:
      - /Users/alexm/projects/prometheus/confluence/shared:/var/atlassian/application-data/confluence/shared-home
    ports:
      - '8090:8090'
      - '8000:5005'
    environment:
      - 'ATL_JDBC_URL=jdbc:postgresql://postgresql:5432/confluencedb'
      - 'ATL_JDBC_USER=confluence'
      - 'ATL_JDBC_PASSWORD=jellyfish'
      - 'ATL_DB_DRIVER=org.postgresql.Driver'
      - 'ATL_DB_TYPE=postgresql'
      - 'JVM_MINIMUM_MEMORY=2048m'
      - 'JVM_MAXIMUM_MEMORY=4096m'
      - 'JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"'
      - 'ATL_CLUSTER_NAME=confluence_cluster'
      - 'ATL_PRODUCT_HOME_SHARED=/var/atlassian/application-data/confluence/shared-home'
      - 'ATL_CLUSTER=true'
      - 'ATL_CLUSTER_TYPE=multicast'
      - 'ATL_CLUSTER_TTL=1'
      - 'ATL_CLUSTER_ADDRESS=235.113.127.226'
      - 'ATL_CLUSTER_INTERFACE=eth0'
    logging:
      # limit logs retained on host to 25MB
      driver: "json-file"
      options:
        max-size: "500k"
        max-file: "50"

  confluence_node_2:
    depends_on:
      - postgresql
    image: atlassian/confluence:latest
    networks:
      confnet:
        ipv4_address: 192.168.0.4
    volumes:
      - /Users/alexm/projects/prometheus/confluence/shared:/var/atlassian/application-data/confluence/shared-home
    ports:
      - '8091:8090'
      - '8001:5005'
    environment:
      - 'ATL_JDBC_URL=jdbc:postgresql://postgresql:5432/confluencedb'
      - 'ATL_JDBC_USER=confluence'
      - 'ATL_JDBC_PASSWORD=jellyfish'
      - 'ATL_DB_DRIVER=org.postgresql.Driver'
      - 'ATL_DB_TYPE=postgresql'
      - 'JVM_MINIMUM_MEMORY=2048m'
      - 'JVM_MAXIMUM_MEMORY=4096m'
      - 'JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"'
      - 'ATL_CLUSTER_NAME=confluence_cluster'
      - 'ATL_CLUSTER=true'
      - 'ATL_PRODUCT_HOME_SHARED=/var/atlassian/application-data/confluence/shared-home'
      - 'ATL_CLUSTER_TYPE=multicast'
      - 'ATL_CLUSTER_TTL=1'
      - 'ATL_CLUSTER_ADDRESS=235.113.127.226'
      - 'ATL_CLUSTER_INTERFACE=eth0'
    logging:
      # limit logs retained on host to 25MB
      driver: "json-file"
      options:
        max-size: "500k"
        max-file: "50"

  postgresql:
    image: postgres:9.5-alpine
    networks:
      confnet:
        ipv4_address: 192.168.0.2
    volumes:
      - postgresqldata:/var/lib/postgresql/data
    ports:
      - '5432:5432'
    environment:
      - 'POSTGRES_USER=confluence'
      # CHANGE THE PASSWORD!
      - 'POSTGRES_PASSWORD=jellyfish'
      - 'POSTGRES_DB=confluencedb'
      - 'POSTGRES_ENCODING=UNICODE'
      - 'POSTGRES_COLLATE=C'
      - 'POSTGRES_COLLATE_TYPE=C'
    logging:
      # limit logs retained on host to 25MB
      driver: "json-file"
      options:
        max-size: "500k"
        max-file: "50"

volumes:
  postgresqldata:
    external: false

networks:
  confnet:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: "192.168.0.0/24"
          gateway: "192.168.0.1"

Change ‘/Users/alexm/projects/prometheus/confluence/shared’ to the folder path where all shared data for your nodes should be placed.

Move to the folder where you created the file and run it with this command:

docker-compose up

As a result you will have two Confluence nodes up. The first node will be running on port 8090 and the second node will be running on port 8091.

Also you will be able to connect with a debug session to the nodes using ports 8000 for node 1 and 8001 for node 2.

If you have problem with including the second node to the cluster just restart the container with the second node.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: