From 7b7cde1149ec358aa032d0cc13a8f1b2a7403495 Mon Sep 17 00:00:00 2001 From: Litao Gao Date: Mon, 27 Apr 2020 03:37:16 -0400 Subject: [PATCH] postgresql: fix behaviour inconsistency in stx - change data_directory to /var/lib/postgresql/19.12 - remove the initdb before service start, which is not needed - disable postgresql service as default Issue-ID: INF-39 Signed-off-by: Litao Gao Change-Id: I14dd9723212d9b5f0c7669ccba57c881aba481e5 --- meta-stx/conf/distro/poky-stx.conf | 1 + .../postgresql/postgresql.service.update | 29 ++++++++++++++++++++++ .../postgresql/postgresql_%.bbappend | 13 ++++++++++ 3 files changed, 43 insertions(+) create mode 100644 meta-stx/recipes-extended/postgresql/postgresql/postgresql.service.update diff --git a/meta-stx/conf/distro/poky-stx.conf b/meta-stx/conf/distro/poky-stx.conf index 8eb85dc..119c416 100644 --- a/meta-stx/conf/distro/poky-stx.conf +++ b/meta-stx/conf/distro/poky-stx.conf @@ -33,6 +33,7 @@ TASK_BASIC_SSHDAEMON = "openssh-sshd openssh-sftp openssh-sftp-server" # Disable services by default SYSTEMD_AUTO_ENABLE_pn-haproxy = "disable" SYSTEMD_AUTO_ENABLE_pn-lighttpd = "disable" +SYSTEMD_AUTO_ENABLE_pn-postgresql = "disable" # networking sysv service is required SYSTEMD_DISABLED_SYSV_SERVICES_remove = "networking" diff --git a/meta-stx/recipes-extended/postgresql/postgresql/postgresql.service.update b/meta-stx/recipes-extended/postgresql/postgresql/postgresql.service.update new file mode 100644 index 0000000..9fe8b51 --- /dev/null +++ b/meta-stx/recipes-extended/postgresql/postgresql/postgresql.service.update @@ -0,0 +1,29 @@ +[Unit] +Description=PostgreSQL database server +After=network.target + +[Service] +Type=forking +User=postgres +Group=postgres + +# Port number for server to listen on +Environment=PGPORT=5432 + +# Location of database directory +Environment=PGDATA=/var/lib/postgresql/19.12 + +# Disable OOM kill on the postmaster +OOMScoreAdjust=-17 + +PermissionsStartOnly=true +ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 +ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast +ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +[Install] +WantedBy=multi-user.target +"" diff --git a/meta-stx/recipes-extended/postgresql/postgresql_%.bbappend b/meta-stx/recipes-extended/postgresql/postgresql_%.bbappend index 41d1c03..284b22a 100644 --- a/meta-stx/recipes-extended/postgresql/postgresql_%.bbappend +++ b/meta-stx/recipes-extended/postgresql/postgresql_%.bbappend @@ -15,3 +15,16 @@ COMPUTE_IP="127.0.0.1" CONTROLLER_IP="127.0.0.1" + +FILESEXTRAPATHS_prepend := "${THISDIR}/postgresql:" + +SRC_URI += " \ + file://postgresql.service.update \ + " + +do_install_append() { + install -d ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/postgresql.service.update ${D}${systemd_unitdir}/system/postgresql.service +} + +FILES_${PN} += "${systemd_unitdir}/system/postgresql.service" -- 2.16.6