From 9f80d83b321bc06860ef6a1fac4ab727668d448a Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Mon, 12 Aug 2024 07:43:26 -0700 Subject: [PATCH] DEV: allow multiple configure runs (#828) when we have already run an initial setup, fall back to just checking for socket, rather than outright failing if the init script has already been run. This allows 'configure' steps to be re-run in standalone cases. eg: `launcher2 configure app && launcher2 configure app` current version: fails as it's missing the install_postgres file with PR: checks for psql socket, and builds. doing something like `launcher2 start app && launcher2 configure app` would also print out a more correct error message, "postgres already running stop container" --- templates/postgres.15.template.yml | 7 ++++++- templates/postgres.template.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/postgres.15.template.yml b/templates/postgres.15.template.yml index e3e1f5e..e085800 100644 --- a/templates/postgres.15.template.yml +++ b/templates/postgres.15.template.yml @@ -220,7 +220,12 @@ run: - exec: tag: db - cmd: "[ -f /root/install_postgres ] && /root/install_postgres && rm -f /root/install_postgres" + cmd: | + if [ -f /root/install_postgres ]; then + /root/install_postgres && rm -f /root/install_postgres + elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then + socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 + fi - exec: tag: db diff --git a/templates/postgres.template.yml b/templates/postgres.template.yml index 9aee6be..d46c6cb 100644 --- a/templates/postgres.template.yml +++ b/templates/postgres.template.yml @@ -208,7 +208,12 @@ run: - exec: tag: db - cmd: "[ -f /root/install_postgres ] && /root/install_postgres && rm -f /root/install_postgres" + cmd: | + if [ -f /root/install_postgres ]; then + /root/install_postgres && rm -f /root/install_postgres + elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then + socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 + fi - exec: tag: db -- 2.25.1