commit c3c00fed691b64dea4eb7f92c99a232ae370a48f
parent a2c6fd1a01149c434b393079ab79a117186e9529
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 4 Mar 2023 12:15:23 +0100
try to fix DB setup rules
Diffstat:
9 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/debian/changelog b/debian/changelog
@@ -1,3 +1,9 @@
+libeufin (0.9.2-2) unstable; urgency=medium
+
+ * Try to fix DB setup rules.
+
+ -- Christian Grothoff <grothoff@gnu.org> Sat, 4 Mar 2023 14:47:04 +0200
+
libeufin (0.9.2-1) unstable; urgency=medium
* Add SPA.
diff --git a/debian/db/install/pgsql b/debian/db/install/pgsql
@@ -2,21 +2,25 @@
set -eu
-# Get database settings from dbconfig-common and write Taler configuration files.
+# Get database settings from dbconfig-common and write libeufin configuration files.
if [ -f /etc/dbconfig-common/taler-libeufin.conf ]; then
. /etc/dbconfig-common/taler-libeufin.conf
case "$dbc_dbtype" in
pgsql)
- # We assume ident auth here. We might support password auth later.
+ # We assume ident auth here. We might support password auth later.
+ echo -e "LIBEUFIN_NEXUS_PORT=5017" >> \
+ /etc/libeufin/nexus.env
echo -e "LIBEUFIN_NEXUS_DB_CONNECTION=jdbc:postgres:///${dbc_dbname}\n\n" >> \
/etc/libeufin/nexus.env
+ echo -e "LIBEUFIN_SANDBOX_PORT=5016" >> \
+ /etc/libeufin/sandbox.env
echo -e "LIBEUFIN_SANDBOX_DB_CONNECTION=jdbc:postgres:///${dbc_dbname}\n\n" >> \
/etc/libeufin/sandbox.env
-
- # Allow the libeufin-sandbox/nexus user to create schemas, needed by dbinit
- echo "GRANT CREATE ON DATABASE \"${dbc_dbtype}\" TO \"libeufin-nexus\";" | sudo -u postgres psql -f -
- echo "GRANT CREATE ON DATABASE \"${dbc_dbtype}\" TO \"libeufin-sandbox\";" | sudo -u postgres psql -f -
+
+ # Allow the libeufin-sandbox/nexus user to create schemas.
+ # Note: user name and DB name must match here.
+ echo "GRANT CREATE ON DATABASE \"${dbc_dbname}\" TO \"${dbc_dbname}\";" | sudo -u postgres psql -f -
;;
sqlite3)
# Later: use something like:
diff --git a/debian/etc/libeufin/nexus.env b/debian/etc/libeufin/nexus.env
@@ -1,5 +0,0 @@
-# Configuration settings for LibEuFin nexus.
-# These settings will be passed as environment variables.
-
-LIBEUFIN_NEXUS_PORT=5017
-#LIBEUFIN_NEXUS_DB_CONNECTION=jdbc:sqlite:/var/lib/libeufin/nexus/nexus-db.sqlite3
diff --git a/debian/etc/libeufin/sandbox.env b/debian/etc/libeufin/sandbox.env
@@ -1,5 +0,0 @@
-# Configuration settings for the LibEuFin sandbox.
-# These settings will be passed as environment variables.
-
-LIBEUFIN_SANDBOX_PORT=5016
-#LIBEUFIN_SANDBOX_DB_CONNECTION=jdbc:sqlite:/var/lib/libeufin/sandbox/sandbox-db.sqlite3
diff --git a/debian/libeufin.config b/debian/libeufin.config
@@ -10,13 +10,15 @@ _GROUPNAME=libeufin
# For now, we only support postgres
dbc_dbtypes=pgsql
dbc_dbuser=${_USERNAME}
+dbc_first_version="0.9.2"
dbc_authmethod_user=ident
dbc_authmethod_admin=ident
if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/config.pgsql
- dbc_go libeufin "$@"
+ dbc_go libeufin-nexus "$@"
+ dbc_go libeufin-sandbox "$@"
fi
db_stop
diff --git a/debian/libeufin.install b/debian/libeufin.install
@@ -5,4 +5,3 @@ debian/db/install/* usr/share/dbconfig-common/scripts/libeufin/install/
# Install the SPA + JS config:
debian/usr/share/libeufin/* usr/share/libeufin/
-
diff --git a/debian/libeufin.postinst b/debian/libeufin.postinst
@@ -30,6 +30,7 @@ libeufin_home=/var/lib/libeufin
# (for when we support sqlite3 in the future)
dbc_dbfile_owner="${_USERNAME}:${_GROUPNAME}"
dbc_dbfile_perms="0600"
+dbc_first_version="0.9.2"
. /usr/share/debconf/confmodule
@@ -58,7 +59,8 @@ case "${1}" in
if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_pgsql_createdb_encoding="UTF8"
- dbc_go libeufin "$@"
+ dbc_go libeufin-nexus "$@"
+ dbc_go libeufin-sandbox "$@"
fi
;;
diff --git a/debian/libeufin.postrm b/debian/libeufin.postrm
@@ -8,7 +8,8 @@ fi
if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postrm.pgsql
- dbc_go libeufin "$@"
+ dbc_go libeufin-nexus "$@"
+ dbc_go libeufin-sandbox "$@"
fi
case "${1}" in
diff --git a/debian/libeufin.prerm b/debian/libeufin.prerm
@@ -14,7 +14,8 @@ fi
if [ -f /usr/share/dbconfig-common/dpkg/prerm.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/prerm.pgsql
- dbc_go libeufin "$@"
+ dbc_go libeufin-nexus "$@"
+ dbc_go libeufin-sandbox "$@"
fi