From 527f2e0270a5cc5b2653ea015c4bea54876af63a Mon Sep 17 00:00:00 2001 From: egeaksoz Date: Wed, 3 Nov 2021 13:48:38 +0100 Subject: [PATCH 1/2] QE-746 As a QE member, I want to containerize Postgres Database cluster for XLD testing, so I can include this platform at every release --- .../server/common/domain/Cluster.kt | 1 + .../integration/server/deploy/domain/Cli.kt | 2 +- .../server/deploy/internals/CliUtil.kt | 2 +- .../internals/DeployDockerClusterHelper.kt | 25 ++- .../tasks/StartDeployIntegrationServerTask.kt | 1 - ...r-compose-xld-ha-with-db-loadbalancer.yaml | 165 ++++++++++++++++++ .../haproxy/Dockerfile | 14 ++ .../haproxy/dbhaproxy.cfg | 27 +++ .../haproxy/entrypoint.sh | 15 ++ .../patroni/Dockerfile | 21 +++ .../patroni/entrypoint.sh | 23 +++ .../patroni/patroni.yaml | 43 +++++ .../docker-compose-xld-ha-slim-workers.yaml | 2 +- 13 files changed, 335 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/Dockerfile create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/dbhaproxy.cfg create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/entrypoint.sh create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/Dockerfile create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/entrypoint.sh create mode 100644 src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/patroni.yaml diff --git a/src/main/kotlin/ai/digital/integration/server/common/domain/Cluster.kt b/src/main/kotlin/ai/digital/integration/server/common/domain/Cluster.kt index 267277f3..d5d3bf33 100644 --- a/src/main/kotlin/ai/digital/integration/server/common/domain/Cluster.kt +++ b/src/main/kotlin/ai/digital/integration/server/common/domain/Cluster.kt @@ -8,5 +8,6 @@ open class Cluster(objects: ObjectFactory) { var debugSuspend: Boolean = objects.property().value(false).get() var enable: Boolean = objects.property().value(false).get() var enableDebug: Boolean = objects.property().value(false).get() + var enableDatabaseLoadBalancer: Boolean = objects.property().value(false).get() var publicPort: Int = objects.property().value(8080).get() } diff --git a/src/main/kotlin/ai/digital/integration/server/deploy/domain/Cli.kt b/src/main/kotlin/ai/digital/integration/server/deploy/domain/Cli.kt index 5e70eb5f..34d54ab2 100644 --- a/src/main/kotlin/ai/digital/integration/server/deploy/domain/Cli.kt +++ b/src/main/kotlin/ai/digital/integration/server/deploy/domain/Cli.kt @@ -11,7 +11,7 @@ class Cli(objects: ObjectFactory) { var cleanDefaultExtContent: Boolean = objects.property().value(false).get() var debugPort: Int? = objects.property().orNull var debugSuspend: Boolean = objects.property().value(false).get() - var enabled: Boolean = objects.property().value(true).get() + var enable: Boolean = objects.property().value(true).get() var filesToExecute: List = objects.listProperty(File::class.java).value(mutableListOf()).get() var overlays: Map> = objects.mapProperty(String::class.java, List::class.java).value(mutableMapOf()).get() diff --git a/src/main/kotlin/ai/digital/integration/server/deploy/internals/CliUtil.kt b/src/main/kotlin/ai/digital/integration/server/deploy/internals/CliUtil.kt index 305f150d..877edab7 100644 --- a/src/main/kotlin/ai/digital/integration/server/deploy/internals/CliUtil.kt +++ b/src/main/kotlin/ai/digital/integration/server/deploy/internals/CliUtil.kt @@ -23,7 +23,7 @@ class CliUtil { } fun hasCli(project: Project): Boolean { - return getCli(project).enabled + return getCli(project).enable } private fun getDebugPort(project: Project, cli: Cli): Int? { diff --git a/src/main/kotlin/ai/digital/integration/server/deploy/internals/DeployDockerClusterHelper.kt b/src/main/kotlin/ai/digital/integration/server/deploy/internals/DeployDockerClusterHelper.kt index af87706a..1065bc4e 100644 --- a/src/main/kotlin/ai/digital/integration/server/deploy/internals/DeployDockerClusterHelper.kt +++ b/src/main/kotlin/ai/digital/integration/server/deploy/internals/DeployDockerClusterHelper.kt @@ -17,6 +17,7 @@ open class DeployDockerClusterHelper(val project: Project) { companion object { private const val clusterMetadataPath = "deploy/cluster/cluster-metadata.properties" private const val dockerXldHAPath = "deploy/cluster/docker-compose-xld-ha.yaml" + private const val dockerXldHAWithDbLoadbalancerPath = "deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml" private const val dockerXldHAWithWorkersPath = "deploy/cluster/docker-compose-xld-ha-slim-workers.yaml" private const val rabbitMqEnabledPluginsPath = "deploy/cluster/rabbitmq/enabled_plugins" private const val privateDebugPort = 4005 @@ -39,6 +40,10 @@ open class DeployDockerClusterHelper(val project: Project) { return getCluster().enable } + fun isDatabaseLoadBalancerEnabled(): Boolean { + return getCluster().enableDatabaseLoadBalancer + } + private fun getServers(): List { return DeployExtensionUtil.getExtension(project).servers .filter { server -> !server.previousInstallation } @@ -65,6 +70,14 @@ open class DeployDockerClusterHelper(val project: Project) { return "${worker.dockerImage}:${getClusterVersion()}" } + private fun getWorkerJdbcUrl(): String { + var workerJdbcUrl = "postgresql:5432/xld-db" + if (isDatabaseLoadBalancerEnabled()) { + workerJdbcUrl = "haproxydb:5000/postgres" + } + return workerJdbcUrl + } + private fun configureRabbitMq() { val dockerComposeStream = {}::class.java.classLoader.getResourceAsStream(rabbitMqEnabledPluginsPath) val resultComposeFilePath = @@ -87,7 +100,10 @@ open class DeployDockerClusterHelper(val project: Project) { } private fun getResolvedXldHaDockerComposeFile(): Path { - val template = getTemplate(dockerXldHAPath) + var template = getTemplate(dockerXldHAPath) + if (isDatabaseLoadBalancerEnabled()){ + template = getTemplate(dockerXldHAWithDbLoadbalancerPath) + } val configuredTemplate = template.readText(Charsets.UTF_8) .replace("{{DEPLOY_MASTER_IMAGE}}", getServerVersionedImage()) @@ -108,6 +124,7 @@ open class DeployDockerClusterHelper(val project: Project) { .replace("{{DEPLOY_WORKER_IMAGE}}", getWorkerVersionedImage()) .replace("{{INTEGRATION_SERVER_ROOT_VOLUME}}", IntegrationServerUtil.getDist(project)) .replace("{{DEPLOY_NETWORK_NAME}}", ClusterConstants.NETWORK_NAME) + .replace("{{JDBC_URL}}", getWorkerJdbcUrl()) template.writeText(configuredTemplate) overrideWorkerCommand(template) @@ -236,9 +253,13 @@ open class DeployDockerClusterHelper(val project: Project) { } private fun getMasterIp(order: Int): String { + var masterContainerName = "cluster_xl-deploy-master_" + if (isDatabaseLoadBalancerEnabled()){ + masterContainerName = "cluster-with-db-loadbalancer_xl-deploy-master_" + } return DockerUtil.inspect(project, "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}", - "cluster_xl-deploy-master_${order}") + "${masterContainerName}${order}") } fun shutdownCluster() { diff --git a/src/main/kotlin/ai/digital/integration/server/deploy/tasks/StartDeployIntegrationServerTask.kt b/src/main/kotlin/ai/digital/integration/server/deploy/tasks/StartDeployIntegrationServerTask.kt index 4aea9448..8a39261d 100644 --- a/src/main/kotlin/ai/digital/integration/server/deploy/tasks/StartDeployIntegrationServerTask.kt +++ b/src/main/kotlin/ai/digital/integration/server/deploy/tasks/StartDeployIntegrationServerTask.kt @@ -1,7 +1,6 @@ package ai.digital.integration.server.deploy.tasks import ai.digital.integration.server.common.constant.PluginConstant.PLUGIN_GROUP -import ai.digital.integration.server.deploy.tasks.maintenance.CleanupBeforeStartupTask import ai.digital.integration.server.deploy.internals.DeployDockerClusterHelper import ai.digital.integration.server.deploy.tasks.cluster.StartDeployClusterTask import ai.digital.integration.server.deploy.tasks.server.StartServerInstanceTask diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml new file mode 100644 index 00000000..2a4f23bd --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml @@ -0,0 +1,165 @@ +version: "3.4" + +services: + zoo1: + image: zookeeper:3.4 + hostname: zoo1 + container_name: zoo1 + ports: + - 2191:2181 + networks: + - {{DEPLOY_NETWORK_NAME}} + environment: + ZOO_MY_ID: 1 + ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 + + zoo2: + image: zookeeper:3.4 + hostname: zoo2 + container_name: zoo2 + ports: + - 2192:2181 + networks: + - {{DEPLOY_NETWORK_NAME}} + environment: + ZOO_MY_ID: 2 + ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888 + depends_on: + - zoo1 + + zoo3: + image: zookeeper:3.4 + hostname: zoo3 + container_name: zoo3 + ports: + - 2193:2181 + networks: + - {{DEPLOY_NETWORK_NAME}} + environment: + ZOO_MY_ID: 3 + ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=0.0.0.0:2888:3888 + depends_on: + - zoo2 + + patroni1: + build: + context: patroni + dockerfile: Dockerfile + container_name: patroni1 + ports: + - 8091:8091 + networks: + - {{DEPLOY_NETWORK_NAME}} + hostname: patroni1 + environment: + PATRONI_API_CONNECT_PORT: 8091 + REPLICATION_NAME: replicator + REPLICATION_PASS: replicator + SU_NAME: postgres + SU_PASS: admin + POSTGRES_APP_ROLE_PASS: postgresconnect + depends_on: + - zoo3 + + patroni2: + build: + context: patroni + dockerfile: Dockerfile + container_name: patroni2 + ports: + - 8092:8091 + networks: + - {{DEPLOY_NETWORK_NAME}} + hostname: patroni2 + environment: + PATRONI_API_CONNECT_PORT: 8091 + REPLICATION_NAME: replicator + REPLICATION_PASS: replicator + SU_NAME: postgres + SU_PASS: admin + POSTGRES_APP_ROLE_PASS: postgresconnect + depends_on: + - patroni1 + + haproxydb: + build: + context: haproxy + dockerfile: Dockerfile + container_name: haproxydb + networks: + - {{DEPLOY_NETWORK_NAME}} + hostname: haproxydb + ports: + - 5000:5000 + - 7000:7000 + depends_on: + - patroni2 + + rabbitmq: + image: "rabbitmq:3.9.8-management-alpine" + container_name: rabbitmq + hostname: "rabbit" + ports: + - "5672:5672" + - "4369:4369" + - "25672:25672" + - "15672:15672" + networks: + - {{DEPLOY_NETWORK_NAME}} + labels: + NAME: "rabbitmq" + environment: + RABBITMQ_DEFAULT_USER: rabbitmq + RABBITMQ_DEFAULT_PASS: admin + RABBITMQ_LOOPBACK_USERS: none + volumes: + - {{INTEGRATION_SERVER_ROOT_VOLUME}}/rabbitmq:/etc/rabbitmq + + xl-deploy-master: + image: {{DEPLOY_MASTER_IMAGE}} + depends_on: + - rabbitmq + - haproxydb + networks: + - {{DEPLOY_NETWORK_NAME}} + environment: + - ACCEPT_EULA=Y + - ADMIN_PASSWORD=admin + - FORCE_UPGRADE=true + - XL_CLUSTER_MODE=default + - XL_DB_PASSWORD=admin + - XL_DB_USERNAME=postgres + - XL_DB_URL=jdbc:postgresql://haproxydb:5000/postgres + - XLD_IN_PROCESS=false + - XLD_TASK_QUEUE_DRIVER_CLASS_NAME=com.rabbitmq.jms.admin.RMQConnectionFactory + - XLD_TASK_QUEUE_PASSWORD=admin + - XLD_TASK_QUEUE_USERNAME=rabbitmq + - XLD_TASK_QUEUE_URL=amqp://rabbitmq:5672 + - USE_IP_AS_HOSTNAME=true + volumes: + - {{INTEGRATION_SERVER_ROOT_VOLUME}}/xl-deploy-server/centralConfiguration:/opt/xebialabs/xl-deploy-server/centralConfiguration + - {{INTEGRATION_SERVER_ROOT_VOLUME}}/xl-deploy-server/conf:/opt/xebialabs/xl-deploy-server/conf + - {{INTEGRATION_SERVER_ROOT_VOLUME}}/xl-deploy-server/plugins:/opt/xebialabs/xl-deploy-server/plugins + + xl-deploy-lb: + image: xebialabsunsupported/haproxy + container_name: xl-deploy-lb + depends_on: + - xl-deploy-master + ports: + - "{{PUBLIC_PORT}}:5000" + - "1936:1936" + networks: + - {{DEPLOY_NETWORK_NAME}} + environment: + BACKENDS: "xl-deploy-master:4516" + HTTPCHK: "GET /deployit/ha/health" + DNS_ENABLED: "true" + COOKIES_ENABLED: "true" + COOKIES_PARAMS: "SESSION_XLD prefix" + LOG_LEVEL: "info" + TIMEOUT_CONNECT: 60000 + +networks: + {{DEPLOY_NETWORK_NAME}}: + external: true diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/Dockerfile b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/Dockerfile new file mode 100644 index 00000000..73cbfc53 --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/Dockerfile @@ -0,0 +1,14 @@ +FROM haproxy:latest +COPY dbhaproxy.cfg /usr/local/etc/haproxy/haproxy.cfg +USER root +RUN mkdir /run/haproxy &&\ + apt-get update -y &&\ + apt-get install -y hatop &&\ + apt-get install -y postgresql-client &&\ + apt-get clean +RUN chmod 777 /run/haproxy/ +COPY entrypoint.sh /docker-entrypoint.sh +RUN chmod 755 /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] +USER haproxy +CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] \ No newline at end of file diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/dbhaproxy.cfg b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/dbhaproxy.cfg new file mode 100644 index 00000000..140ce23c --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/dbhaproxy.cfg @@ -0,0 +1,27 @@ +global + maxconn 100 + stats socket /run/haproxy/haproxy.sock + stats timeout 2m # Wait up to 2 minutes for input + +defaults + log global + mode tcp + retries 2 + timeout client 30m + timeout connect 4s + timeout server 30m + timeout check 5s + +listen stats + mode http + bind *:7000 + stats enable + stats uri / + +listen postgres + bind *:5000 + option httpchk + http-check expect status 200 + default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions + server patroni1 patroni1:5432 maxconn 100 check port 8091 + server patroni2 patroni2:5432 maxconn 100 check port 8091 diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/entrypoint.sh b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/entrypoint.sh new file mode 100644 index 00000000..f35afb68 --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/haproxy/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- haproxy "$@" +fi + +if [ "$1" = 'haproxy' ]; then + shift + set -- haproxy -W -db "$@" +fi +sleep 15 +export PGPASSWORD=admin +exec "$@" \ No newline at end of file diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/Dockerfile b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/Dockerfile new file mode 100644 index 00000000..8a38ecb9 --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/Dockerfile @@ -0,0 +1,21 @@ +FROM postgres:12.7 + +RUN apt-get update -y\ +&& apt-get install python3 python3-pip -y\ +&& apt-get install python3-dev libpq-dev -y\ +&& pip3 install --upgrade pip\ +&& pip3 install --upgrade setuptools\ +&& pip3 install psycopg2-binary \ +&& pip3 install patroni[zookeeper] \ +&& mkdir /data/patroni -p \ +&& chown postgres:postgres /data/patroni \ +&& chmod 700 /data/patroni + +#Copy patroni config files +COPY patroni.yaml /etc/patroni.yml + +#Copy entrypoint1.sh file +COPY entrypoint.sh ./entrypoint.sh + +USER postgres +ENTRYPOINT ["bin/sh", "/entrypoint.sh"] diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/entrypoint.sh b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/entrypoint.sh new file mode 100644 index 00000000..7b94c146 --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +readonly CONTAINER_IP=$(hostname --ip-address) +readonly CONTAINER_API_ADDR="${CONTAINER_IP}:${PATRONI_API_CONNECT_PORT}" +readonly CONTAINER_POSTGRE_ADDR="${CONTAINER_IP}:5432" + +export PATRONI_NAME="${PATRONI_NAME:-$(hostname)}" +export PATRONI_RESTAPI_CONNECT_ADDRESS="$CONTAINER_API_ADDR" +export PATRONI_RESTAPI_LISTEN="$CONTAINER_API_ADDR" +export PATRONI_POSTGRESQL_CONNECT_ADDRESS="$CONTAINER_POSTGRE_ADDR" +export PATRONI_POSTGRESQL_LISTEN="$CONTAINER_POSTGRE_ADDR" +export PATRONI_REPLICATION_USERNAME="$REPLICATION_NAME" +export PATRONI_REPLICATION_PASSWORD="$REPLICATION_PASS" +export PATRONI_SUPERUSER_USERNAME="$SU_NAME" +export PATRONI_SUPERUSER_PASSWORD="$SU_PASS" +export PATRONI_approle_PASSWORD="$POSTGRES_APP_ROLE_PASS" +export PATRONI_approle_OPTIONS="${PATRONI_admin_OPTIONS:-createdb, createrole}" + +chmod 700 /var/lib/postgresql/data/ +exec /usr/local/bin/patroni /etc/patroni.yml + + +exit 0 \ No newline at end of file diff --git a/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/patroni.yaml b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/patroni.yaml new file mode 100644 index 00000000..05c02416 --- /dev/null +++ b/src/main/resources/deploy/cluster/cluster-with-db-loadbalancer/patroni/patroni.yaml @@ -0,0 +1,43 @@ +scope: patroni +namespace: /xl-deploy/ + +bootstrap: + dcs: + ttl: 30 + loop_wait: 10 + retry_timeout: 10 + maximum_lag_on_failover: 1048576 + postgresql: + use_pg_rewind: true + parameters: + max_connections: 4000 + + postgresql: + use_pg_rewind: true + + initdb: + - encoding: UTF8 + - data-checksums + + pg_hba: + - host replication all all md5 + - host all all all md5 + +zookeeper: + hosts: + - zoo1:2181 + - zoo2:2181 + - zoo3:2181 + +postgresql: + data_dir: /var/lib/postgresql/data + bin_dir: /usr/lib/postgresql/12/bin + pgpass: /tmp/pgpass + parameters: + unix_socket_directories: '.' + +tags: + nofailover: false + noloadbalance: false + clonefrom: false + nosync: false \ No newline at end of file diff --git a/src/main/resources/deploy/cluster/docker-compose-xld-ha-slim-workers.yaml b/src/main/resources/deploy/cluster/docker-compose-xld-ha-slim-workers.yaml index 4fd45106..e33ea6eb 100644 --- a/src/main/resources/deploy/cluster/docker-compose-xld-ha-slim-workers.yaml +++ b/src/main/resources/deploy/cluster/docker-compose-xld-ha-slim-workers.yaml @@ -11,7 +11,7 @@ services: - XL_CLUSTER_MODE=default - XL_DB_PASSWORD=admin - XL_DB_USERNAME=postgres - - XL_DB_URL=jdbc:postgresql://postgresql:5432/xld-db + - XL_DB_URL=jdbc:postgresql://{{JDBC_URL}} - XLD_IN_PROCESS=false - XLD_TASK_QUEUE_DRIVER_CLASS_NAME=com.rabbitmq.jms.admin.RMQConnectionFactory - XLD_TASK_QUEUE_PASSWORD=admin From 2336b1125f5aa6018ca77e87efbdcc7e510f36ed Mon Sep 17 00:00:00 2001 From: bnechyporenko Date: Wed, 15 Dec 2021 09:59:08 +0100 Subject: [PATCH 2/2] wip --- .../cluster/DeployDockerClusterHelper.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/ai/digital/integration/server/deploy/internals/cluster/DeployDockerClusterHelper.kt b/src/main/kotlin/ai/digital/integration/server/deploy/internals/cluster/DeployDockerClusterHelper.kt index 46208385..bd49164b 100644 --- a/src/main/kotlin/ai/digital/integration/server/deploy/internals/cluster/DeployDockerClusterHelper.kt +++ b/src/main/kotlin/ai/digital/integration/server/deploy/internals/cluster/DeployDockerClusterHelper.kt @@ -22,7 +22,8 @@ open class DeployDockerClusterHelper(val project: Project) { companion object { private const val clusterMetadataPath = "deploy/cluster/cluster-metadata.properties" private const val dockerXldHAPath = "deploy/cluster/docker-compose-xld-ha.yaml" - private const val dockerXldHAWithDbLoadbalancerPath = "deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml" + private const val dockerXldHAWithDbLoadbalancerPath = + "deploy/cluster/cluster-with-db-loadbalancer/docker-compose-xld-ha-with-db-loadbalancer.yaml" private const val dockerXldHAWithWorkersPath = "deploy/cluster/docker-compose-xld-ha-slim-workers.yaml" private const val rabbitMqEnabledPluginsPath = "deploy/cluster/rabbitmq/enabled_plugins" private const val privateDebugPort = 4005 @@ -46,12 +47,8 @@ open class DeployDockerClusterHelper(val project: Project) { return server.version } - fun isClusterEnabled(): Boolean { - return getCluster().enable - } - - fun isDatabaseLoadBalancerEnabled(): Boolean { - return getCluster().enableDatabaseLoadBalancer + private fun isDatabaseLoadBalancerEnabled(): Boolean { + return DeployServerUtil.getCluster(project).enableDatabaseLoadBalancer } private fun getServers(): List { @@ -111,7 +108,7 @@ open class DeployDockerClusterHelper(val project: Project) { private fun getResolvedXldHaDockerComposeFile(): Path { var template = getTemplate(dockerXldHAPath) - if (isDatabaseLoadBalancerEnabled()){ + if (isDatabaseLoadBalancerEnabled()) { template = getTemplate(dockerXldHAWithDbLoadbalancerPath) } val serviceName = "xl-deploy-master" @@ -287,7 +284,7 @@ open class DeployDockerClusterHelper(val project: Project) { private fun getMasterIp(order: Int): String { var masterContainerName = "cluster-xl-deploy-master-" - if (isDatabaseLoadBalancerEnabled()){ + if (isDatabaseLoadBalancerEnabled()) { masterContainerName = "cluster-with-db-loadbalancer_xl-deploy-master_" } try {