Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maint to dev #4

Merged
merged 12 commits into from
Jul 26, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ zitadel_app_config = {
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_SMTP_HOST": SMTP_HOST + ":" + str(SMTP_PORT),
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_SMTP_USER": SMTP_USER,
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_SMTP_PASSWORD": SMTP_PASSWORD,
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_TLS": SMTP_ENCRYPTION,
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_TLS": 'true' if smtp_settings['tls_verify'] else 'false',
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_FROM": SMTP_USER,
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_FROMNAME": "ZITADEL" + SMTP_USER,
"ZITADEL_DEFAULTINSTANCE_SMTPCONFIGURATION_REPLYTOADDRESS": SMTP_USER,
Expand Down
9 changes: 4 additions & 5 deletions imageroot/actions/restore-module/40restore-postgres
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ exec 1>&2 # Redirect any output to the journal (stderr)

mkdir -vp restore
cat - >restore/zitadel_restore.sh <<'EOS'

# Read dump file from standard input:

pg_restore --no-owner --no-privileges -U "${POSTGRES_USER}" -d "${POSTGRES_DB}"
pg_restore --no-owner --no-privileges -U postgres -d zitadel
ec=$?
docker_temp_server_stop
exit $ec
Expand All @@ -29,8 +27,9 @@ podman run \
--volume=./restore:/docker-entrypoint-initdb.d/:Z \
--volume=postgres-data:/var/lib/postgresql/data:Z \
--replace --name=restore_db \
--env-file=database.env \
--env TZ=UTC \
"${POSTGRES_IMAGE}" < zitadel.pg_dump
"${POSTGRES_IMAGE}" < zitadel.pg_dump

# If the restore is successful, clean up:
rm -rfv restore/ zitadel.pg_dump
rm -rfv restore/ zitadel.pg_dump
4 changes: 2 additions & 2 deletions imageroot/actions/restore-module/50traefik
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ request = json.load(sys.stdin)
renv = request['environment']

configure_retval = agent.tasks.run(agent_id=os.environ['AGENT_ID'], action='configure-module', data={
"lets_encrypt": renv["TRAEFIK_LETS_ENCRYPT"],
"lets_encrypt": renv["TRAEFIK_LETS_ENCRYPT"] == "True",
"host": renv["TRAEFIK_HOST"],
"http2https": renv["TRAEFIK_HTTP2HTTPS"],
"http2https": renv["TRAEFIK_HTTP2HTTPS"] == "True",
})
agent.assert_exp(configure_retval['exit_code'] == 0, "The configure-module subtask failed!")
16 changes: 16 additions & 0 deletions imageroot/actions/restore-module/80start_services
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

#
# Copyright (C) 2023 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#
set -e

# Redirect any output to the journal (stderr)
exec 1>&2

# If the control reaches this step, the service can be enabled and started

touch smarthost.env

systemctl --user enable --now zitadel.service
2 changes: 1 addition & 1 deletion imageroot/bin/module-dump-state
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
set -e

echo "Dumping zitadel postgres database"
podman exec postgres-app pg_dump -U "${POSTGRES_USER}" --format=c "${POSTGRES_DB}" > zitadel.pg_dump
podman exec postgresql-app pg_dump -U postgres --format=c zitadel > zitadel.pg_dump
4 changes: 2 additions & 2 deletions imageroot/etc/state-include.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


state/smarthost.env
state/zitadel.env
state/zitadel-app.env
state/database.env
state/zitadel.env
volumes/postgres-data
state/zitadel.pg_dump
Loading