Also, makes sure that the trigram extension is enabled.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>
--- /dev/null
+---
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+postgresql_external_service:
+ db_host: "__DATABASE_EXTERNAL_SERVICE_HOST_OR_IP__"
+ db_port: 5432
+ db_name: "__DATABASE_NAME__"
+ db_user: "__DATABASE_USER__"
+ db_password: "__DATABASE_PASSWORD__"
--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+{%- set pg_svc = pillar.get('postgresql_external_service', {}) %}
+
+{%- if pg_svc %}
+__CLUSTER___external_trgm_extension:
+ postgres_extension.present:
+ - name: pg_trgm
+ - if_not_exists: true
+ - schema: public
+ - db_host: {{ pg_svc.db_host }}
+ - db_port: 5432
+ - db_user: {{ pg_svc.db_user }}
+ - db_password: {{ pg_svc.db_password }}
+ - require:
+ - pkg: postgresql-client-libs
+{%- endif %}
\ No newline at end of file
(cd terraform/vpc && terraform apply -auto-approve) 2>&1 | tee -a $logfile
(cd terraform/data-storage && terraform apply -auto-approve) 2>&1 | tee -a $logfile
(cd terraform/services && terraform apply -auto-approve) 2>&1 | grep -v letsencrypt_iam_secret_access_key | tee -a $logfile
- (cd terraform/services && echo -n 'letsencrypt_iam_secret_access_key = ' && terraform output letsencrypt_iam_secret_access_key) 2>&1 | tee -a $logfile
+ (cd terraform/services && \
+ echo -n 'letsencrypt_iam_secret_access_key = ' && \
+ terraform output letsencrypt_iam_secret_access_key && \
+ echo -n 'database_password = ' && \
+ terraform output database_password) 2>&1 | tee -a $logfile
;;
terraform-destroy)
for R in ${ROLES:-}; do
case "${R}" in
"database")
+ # Skip if using an external service
+ if [[ "${DATABASE_EXTERNAL_SERVICE_HOST_OR_IP:-}" != "" ]]; then
+ continue
+ fi
# States
grep -q "\- postgres$" ${STATES_TOP} || echo " - postgres" >> ${STATES_TOP}
grep -q "extra.prometheus_pg_exporter" ${STATES_TOP} || echo " - extra.prometheus_pg_exporter" >> ${STATES_TOP}
fi
echo " - extra.passenger_rvm" >> ${STATES_TOP}
grep -q "^ - postgres\\.client$" ${STATES_TOP} || echo " - postgres.client" >> ${STATES_TOP}
+ if [[ "${DATABASE_EXTERNAL_SERVICE_HOST_OR_IP:-}" != "" ]]; then
+ grep -q " - extra.postgresql_external" ${STATES_TOP} || echo " - extra.postgresql_external" >> ${STATES_TOP}
+ fi
### If we don't install and run LE before arvados-api-server, it fails and breaks everything
### after it. So we add this here as we are, after all, sharing the host for api and controller
grep -q "nginx_api_configuration" ${PILLARS_TOP} || echo " - nginx_api_configuration" >> ${PILLARS_TOP}
grep -q "nginx_controller_configuration" ${PILLARS_TOP} || echo " - nginx_controller_configuration" >> ${PILLARS_TOP}
+ if [[ "${DATABASE_EXTERNAL_SERVICE_HOST_OR_IP:-}" != "" ]]; then
+ grep -q " - postgresql_external" ${PILLARS_TOP} || echo " - postgresql_external" >> ${PILLARS_TOP}
+ fi
+
if [ "${ENABLE_BALANCER}" == "no" ]; then
if [ "${SSL_MODE}" = "lets-encrypt" ]; then
if [ "${USE_LETSENCRYPT_ROUTE53}" = "yes" ]; then