From 19bace10046f95014dab37c1f2d8a77becd132d2 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Wed, 22 May 2024 15:55:51 +0200 Subject: [PATCH 1/2] chore: Remove obsolete configure-module script The configure-module script in the imageroot/actions directory is no longer needed and has been removed. --- .../10configure_environment_vars | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100755 imageroot/actions/configure-module/10configure_environment_vars diff --git a/imageroot/actions/configure-module/10configure_environment_vars b/imageroot/actions/configure-module/10configure_environment_vars deleted file mode 100755 index f0589aa..0000000 --- a/imageroot/actions/configure-module/10configure_environment_vars +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -# -# Copyright (C) 2022 Nethesis S.r.l. -# SPDX-License-Identifier: GPL-3.0-or-later -# - -import json -import sys -import agent - -# Try to parse the stdin as JSON. -# If parsing fails, output everything to stderr -data = json.load(sys.stdin) - -#This is specific to you module, so you need to change it accordingly. -# we read a json stdin {"vars1":true, "var2":"foo", "vars3": 3} and we writ it to .config/state/environment -# Upper case to set environment variable and minor case to read from stdin - -# this values must exists in the json stdin -# agent.set_env("MAIL_SERVER", data["mail_server"]) -# agent.set_env("LDAP_DOMAIN", data["ldap_domain"]) - -# you can add default values for the following variables -# agent.set_env("MAIL_DOMAIN",data.get("mail_domain","")) -# agent.set_env("WOWORKERSCOUNT",data.get("workers_count",3)) -# agent.set_env("AUXILIARYACCOUNT",data.get("auxiliary_account",True)) -# agent.set_env("ACTIVESYNC",data.get("activesync",False)) - - -# Make sure everything is saved inside the environment file -# just before starting systemd unit -#agent.dump_env() From cc71e359351879559bbd45e0fceb3eeddff8cb95 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Wed, 22 May 2024 16:04:29 +0200 Subject: [PATCH 2/2] Update pgadmin-app.service to use config_server.json for server configuration --- imageroot/state/{servers.json => config_server.json} | 0 imageroot/systemd/user/pgadmin-app.service | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename imageroot/state/{servers.json => config_server.json} (100%) diff --git a/imageroot/state/servers.json b/imageroot/state/config_server.json similarity index 100% rename from imageroot/state/servers.json rename to imageroot/state/config_server.json diff --git a/imageroot/systemd/user/pgadmin-app.service b/imageroot/systemd/user/pgadmin-app.service index 0113a66..d3aced0 100644 --- a/imageroot/systemd/user/pgadmin-app.service +++ b/imageroot/systemd/user/pgadmin-app.service @@ -22,7 +22,7 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/pgadmin-app.pid \ --cidfile %t/pgadmin-app.ctr-id --cgroups=no-conmon \ --pod-id-file %t/postgresql.pod-id --replace -d --name pgadmin-app \ --volume pgadmin-data:/var/lib/pgadmin:Z \ - --volume ./servers.json:/pgadmin4/servers.json:Z \ + --volume ./config_server.json:/pgadmin4/config_server.json:Z \ --volume ./pgpassfile:/pgadmin4/pgpassfile:Z \ --env 'PGADMIN_DEFAULT_EMAIL=admin@nethserver.org' \ --env 'PGADMIN_DEFAULT_PASSWORD=Nethesis,1234' \ @@ -33,6 +33,8 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/pgadmin-app.pid \ --env 'PGADMIN_CONFIG_CONFIG_DATABASE_URI="postgresql://postgres:Nethesis,1234@127.0.0.1:5432/postgres"' \ --env-file=%S/state/smarthost.env \ ${PGADMIN4_IMAGE} +ExecStartPost=/usr/bin/bash -c "while ! podman exec pgadmin-app /venv/bin/python3 setup.py get-users ; do sleep 5 ; done" +ExecStartPost=/usr/bin/podman exec pgadmin-app /venv/bin/python3 setup.py load-servers config_server.json --replace --user admin@nethserver.org ExecStop=/usr/bin/podman stop --ignore --cidfile %t/pgadmin-app.ctr-id -t 10 ExecReload=/usr/bin/podman kill -s HUP pgadmin-app SyslogIdentifier=%u