From ebeaa637c88e314feebea81037c4706467f1a090 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 24 Aug 2023 18:47:26 -0300 Subject: [PATCH] 20889: Allows customization on database name and user. Also, allows specifying external PG service for the single host cases. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../multi_host/aws/pillars/arvados.sls | 9 ++++++--- .../multiple_hostnames/pillars/arvados.sls | 13 +++++++++---- .../single_host/single_hostname/pillars/arvados.sls | 13 +++++++++---- .../local.params.example.multiple_hosts | 2 ++ ...al.params.example.single_host_multiple_hostnames | 5 +++++ ...local.params.example.single_host_single_hostname | 5 +++++ tools/salt-install/provision.sh | 6 ++++-- 7 files changed, 40 insertions(+), 13 deletions(-) diff --git a/tools/salt-install/config_examples/multi_host/aws/pillars/arvados.sls b/tools/salt-install/config_examples/multi_host/aws/pillars/arvados.sls index 5fe2c0a6e9..84df363c2e 100644 --- a/tools/salt-install/config_examples/multi_host/aws/pillars/arvados.sls +++ b/tools/salt-install/config_examples/multi_host/aws/pillars/arvados.sls @@ -7,6 +7,9 @@ {%- set max_workers = [_workers, 8]|max %} {%- set max_reqs = ("__CONTROLLER_MAX_QUEUED_REQUESTS__" or 128)|int %} {%- set database_host = ("__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__" or "__DATABASE_INT_IP__") %} +{%- set database_name = "__DATABASE_NAME__" %} +{%- set database_user = "__DATABASE_USER__" %} +{%- set database_password = "__DATABASE_PASSWORD__" %} # The variables commented out are the default values that the formula uses. # The uncommented values are REQUIRED values. If you don't set them, running @@ -73,10 +76,10 @@ arvados: database: # max concurrent connections per arvados server daemon # connection_pool_max: 32 - name: __CLUSTER___arvados + name: {{ database_name }} host: {{ database_host }} - password: "__DATABASE_PASSWORD__" - user: __CLUSTER___arvados + password: {{ database_password }} + user: {{ database_user }} encoding: en_US.utf8 client_encoding: UTF8 diff --git a/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/arvados.sls b/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/arvados.sls index 35544730ad..5883f19241 100644 --- a/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/arvados.sls +++ b/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/arvados.sls @@ -5,6 +5,11 @@ # # SPDX-License-Identifier: AGPL-3.0 +{%- set database_host = ("__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__" or "127.0.0.1") %} +{%- set database_name = "__DATABASE_NAME__" %} +{%- set database_user = "__DATABASE_USER__" %} +{%- set database_password = "__DATABASE_PASSWORD__" %} + # The variables commented out are the default values that the formula uses. # The uncommented values are REQUIRED values. If you don't set them, running # this formula will fail. @@ -65,10 +70,10 @@ arvados: database: # max concurrent connections per arvados server daemon # connection_pool_max: 32 - name: __CLUSTER___arvados - host: 127.0.0.1 - password: "__DATABASE_PASSWORD__" - user: __CLUSTER___arvados + name: {{ database_name }} + host: {{ database_host }} + password: {{ database_password }} + user: {{ database_user }} extra_conn_params: client_encoding: UTF8 # Centos7 does not enable SSL by default, so we disable diff --git a/tools/salt-install/config_examples/single_host/single_hostname/pillars/arvados.sls b/tools/salt-install/config_examples/single_host/single_hostname/pillars/arvados.sls index 10a9b79c94..e85b709c2c 100644 --- a/tools/salt-install/config_examples/single_host/single_hostname/pillars/arvados.sls +++ b/tools/salt-install/config_examples/single_host/single_hostname/pillars/arvados.sls @@ -5,6 +5,11 @@ # # SPDX-License-Identifier: AGPL-3.0 +{%- set database_host = ("__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__" or "127.0.0.1") %} +{%- set database_name = "__DATABASE_NAME__" %} +{%- set database_user = "__DATABASE_USER__" %} +{%- set database_password = "__DATABASE_PASSWORD__" %} + # The variables commented out are the default values that the formula uses. # The uncommented values are REQUIRED values. If you don't set them, running # this formula will fail. @@ -65,10 +70,10 @@ arvados: database: # max concurrent connections per arvados server daemon # connection_pool_max: 32 - name: __CLUSTER___arvados - host: 127.0.0.1 - password: "__DATABASE_PASSWORD__" - user: __CLUSTER___arvados + name: {{ database_name }} + host: {{ database_host }} + password: {{ database_password }} + user: {{ database_user }} extra_conn_params: client_encoding: UTF8 # Centos7 does not enable SSL by default, so we disable diff --git a/tools/salt-install/local.params.example.multiple_hosts b/tools/salt-install/local.params.example.multiple_hosts index 63a51f7731..0cfae3e284 100644 --- a/tools/salt-install/local.params.example.multiple_hosts +++ b/tools/salt-install/local.params.example.multiple_hosts @@ -141,6 +141,8 @@ KEEP_INT_IP=${WORKBENCH1_INT_IP} KEEPSTORE0_INT_IP=10.1.2.13 SHELL_INT_IP=10.1.2.17 +DATABASE_NAME="${CLUSTER}_arvados" +DATABASE_USER="${CLUSTER}_arvados" # Set this if using an external PostgreSQL service. #DATABASE_EXTERNAL_SERVICE_HOST_OR_IP= diff --git a/tools/salt-install/local.params.example.single_host_multiple_hostnames b/tools/salt-install/local.params.example.single_host_multiple_hostnames index 551051939e..54da585d38 100644 --- a/tools/salt-install/local.params.example.single_host_multiple_hostnames +++ b/tools/salt-install/local.params.example.single_host_multiple_hostnames @@ -76,6 +76,11 @@ KEEP_INT_IP="" KEEPSTORE0_INT_IP="" SHELL_INT_IP="" +DATABASE_NAME="${CLUSTER}_arvados" +DATABASE_USER="${CLUSTER}_arvados" +# Set this if using an external PostgreSQL service. +#DATABASE_EXTERNAL_SERVICE_HOST_OR_IP= + # The directory to check for the config files (pillars, states) you want to use. # There are a few examples under 'config_examples'. # CONFIG_DIR="local_config_dir" diff --git a/tools/salt-install/local.params.example.single_host_single_hostname b/tools/salt-install/local.params.example.single_host_single_hostname index ab0ee1be1b..d42b4cb54c 100644 --- a/tools/salt-install/local.params.example.single_host_single_hostname +++ b/tools/salt-install/local.params.example.single_host_single_hostname @@ -86,6 +86,11 @@ KEEP_INT_IP="" KEEPSTORE0_INT_IP="" SHELL_INT_IP="" +DATABASE_NAME="${CLUSTER}_arvados" +DATABASE_USER="${CLUSTER}_arvados" +# Set this if using an external PostgreSQL service. +#DATABASE_EXTERNAL_SERVICE_HOST_OR_IP= + # The directory to check for the config files (pillars, states) you want to use. # There are a few examples under 'config_examples'. # CONFIG_DIR="local_config_dir" diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh index e76d3cc6ba..b44fc8b19b 100755 --- a/tools/salt-install/provision.sh +++ b/tools/salt-install/provision.sh @@ -175,7 +175,11 @@ apply_var_substitutions() { s#__LE_AWS_REGION__#${LE_AWS_REGION:-}#g; s#__LE_AWS_SECRET_ACCESS_KEY__#${LE_AWS_SECRET_ACCESS_KEY:-}#g; s#__LE_AWS_ACCESS_KEY_ID__#${LE_AWS_ACCESS_KEY_ID:-}#g; + s#__DATABASE_NAME__#${DATABASE_NAME}#g; + s#__DATABASE_USER__#${DATABASE_USER}#g; s#__DATABASE_PASSWORD__#${DATABASE_PASSWORD}#g; + s#__DATABASE_INT_IP__#${DATABASE_INT_IP:-}#g; + s#__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__#${DATABASE_EXTERNAL_SERVICE_HOST_OR_IP:-}#g; s#__KEEPWEB_EXT_SSL_PORT__#${KEEPWEB_EXT_SSL_PORT}#g; s#__KEEP_EXT_SSL_PORT__#${KEEP_EXT_SSL_PORT}#g; s#__MANAGEMENT_TOKEN__#${MANAGEMENT_TOKEN}#g; @@ -196,8 +200,6 @@ apply_var_substitutions() { s#__SHELL_INT_IP__#${SHELL_INT_IP}#g; s#__WORKBENCH1_INT_IP__#${WORKBENCH1_INT_IP}#g; s#__WORKBENCH2_INT_IP__#${WORKBENCH2_INT_IP}#g; - s#__DATABASE_INT_IP__#${DATABASE_INT_IP:-}#g; - s#__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__#${DATABASE_EXTERNAL_SERVICE_HOST_OR_IP:-}#g; s#__WORKBENCH_SECRET_KEY__#${WORKBENCH_SECRET_KEY}#g; s#__SSL_KEY_ENCRYPTED__#${SSL_KEY_ENCRYPTED}#g; s#__SSL_KEY_AWS_REGION__#${SSL_KEY_AWS_REGION:-}#g; -- 2.30.2