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

Signed-off-by: Litao Gao <litao.gao@windriver.com>
Signed-off-by: Babak Sarashki <Babak.SarAshki@windriver.com>
This commit is contained in:
Litao Gao 2020-04-27 03:37:16 -04:00 committed by Babak Sarashki
parent 74ef8ddd47
commit e7a3da0cb3
3 changed files with 44 additions and 0 deletions

View File

@ -20,6 +20,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"
# /var/log is mounted as a logical volume for stx,
# so do not link to /var/volatile/log.

View File

@ -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
""

View File

@ -1,3 +1,17 @@
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"