From b8c333d8ac7944478b448768465b988d64b34582 Mon Sep 17 00:00:00 2001 From: Mark Asselstine Date: Thu, 29 Mar 2018 15:29:11 -0400 Subject: postgresql: follow move to recipes-dbs done in meta-openembedded Commit 742404cc8ab0 [postgres: move to recipes-dbs] in meta-openembedded moved the postgresql recipe to recipes-dbs. We usually try to match the bbappend's path with that of the bb so complete a matching move here. Signed-off-by: Mark Asselstine Signed-off-by: Bruce Ashfield --- .../postgresql/postgresql/postgresql | 40 ----------------- .../postgresql/postgresql/postgresql-init | 52 ---------------------- .../postgresql/postgresql/postgresql-init.service | 12 ----- .../postgresql/postgresql_9.%.bbappend | 46 ------------------- 4 files changed, 150 deletions(-) delete mode 100644 meta-openstack/recipes-support/postgresql/postgresql/postgresql delete mode 100644 meta-openstack/recipes-support/postgresql/postgresql/postgresql-init delete mode 100644 meta-openstack/recipes-support/postgresql/postgresql/postgresql-init.service delete mode 100644 meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend (limited to 'meta-openstack/recipes-support/postgresql') diff --git a/meta-openstack/recipes-support/postgresql/postgresql/postgresql b/meta-openstack/recipes-support/postgresql/postgresql/postgresql deleted file mode 100644 index 2bdd582..0000000 --- a/meta-openstack/recipes-support/postgresql/postgresql/postgresql +++ /dev/null @@ -1,40 +0,0 @@ -[Unit] -Description=PostgreSQL database server -After=network.target - -[Service] -Type=forking - -User=postgres -Group=postgres - -# Where to send early-startup messages from the server (before the logging -# options of postgresql.conf take effect) -# This is normally controlled by the global default set by systemd -# StandardOutput=syslog - -# Disable OOM kill on the postmaster -OOMScoreAdjust=-1000 -# ... but allow it still to be effective for child processes -# (note that these settings are ignored by Postgres releases before 9.5) -Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj -Environment=PG_OOM_ADJUST_VALUE=0 - -# Maximum number of seconds pg_ctl will wait for postgres to start. Note that -# PGSTARTTIMEOUT should be less than TimeoutSec value. -Environment=PGSTARTTIMEOUT=270 - -Environment=PGDATA=/usr/local/pgsql/data - - -ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT} -ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast -ExecReload=/usr/local/pgsql/bin/pg_ctl reload -D ${PGDATA} -s - -# Give a reasonable amount of time for the server to start up/shut down. -# Ideally, the timeout for starting PostgreSQL server should be handled more -# nicely by pg_ctl in ExecStart, so keep its timeout smaller than this value. -TimeoutSec=300 - -[Install] -WantedBy=multi-user.target diff --git a/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init b/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init deleted file mode 100644 index cc7b13e..0000000 --- a/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# set -x - -PN=postgresql -CONTROLLER_IP=%CONTROLLER_IP% -COMPUTE_IP=%COMPUTE_IP% -DB_USER=%DB_USER% -DB_PASSWORD=%DB_PASSWORD% -DATA_DIR=%DB_DATADIR% - -if [ ! -e $DATA_DIR ]; then - mkdir -p $DATA_DIR - chown postgres $DATA_DIR -fi - -if [ -e $DATA_DIR/PG_VERSION ]; then - # the database has already been initialized, return - exit 0 -fi - -# Create the DB -sudo -u postgres initdb -D $DATA_DIR - -# Allow readers/writers by IP -echo "listen_addresses = '*'" >> $DATA_DIR/postgresql.conf -echo "host all all ${CONTROLLER_IP}/32 trust" >> $DATA_DIR/pg_hba.conf -echo "host all all ${COMPUTE_IP}/32 trust" >> $DATA_DIR/pg_hba.conf -systemctl restart postgresql - -count=0 -done=0 -while [ $count -le 10 ] && [ $done -eq 0 ]; do - sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" 2> /dev/null - if [ $? -ne 0 ]; then - echo "[INFO] postgres: failed to create account for ${DB_USER}, trying again" - systemctl stop postresql - sleep 3 - systemctl start postgresql - sleep 3 - else - echo "[INFO] postgres: created account for ${DB_USER}, continuing .. " - done=1 - fi - count=`expr $count + 1` -done - -if [ $done -eq 0 ]; then - echo "[ERROR] postgres: unable to create admin account" - exit 1 -fi - -ln -s /usr/share/zoneinfo /usr/share/postgresql/timezone || true diff --git a/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init.service b/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init.service deleted file mode 100644 index 94206d2..0000000 --- a/meta-openstack/recipes-support/postgresql/postgresql/postgresql-init.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Postgresql setup for OpenStack -After=postgresql.service - -[Service] -Type=oneshot -ExecStart=%SYSCONFIGDIR%/postgresql/postgresql-init -ExecStartPost=/bin/systemctl --no-reload disable postgresql-init.service -RemainAfterExit=No - -[Install] -WantedBy=multi-user.target diff --git a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend b/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend deleted file mode 100644 index 5b87960..0000000 --- a/meta-openstack/recipes-support/postgresql/postgresql_9.%.bbappend +++ /dev/null @@ -1,46 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += " \ - file://postgresql-init \ - file://postgresql-init.service \ - " - -inherit identity hosts - -SYSTEMD_AUTO_ENABLE_${PN} = "enable" - -# default -DB_DATADIR ?= "/var/lib/postgres/data" - -do_install_append() { - D_DEST_DIR=${D}${sysconfdir}/postgresql - - install -d ${D_DEST_DIR} - install -m 0755 ${WORKDIR}/postgresql-init ${D_DEST_DIR}/postgresql-init - - sed -e "s:%DB_DATADIR%:${DB_DATADIR}:g" -i ${D_DEST_DIR}/postgresql-init - sed -e "s:\(PGDATA=\).*$:\1${DB_DATADIR}:g" -i ${D}${systemd_unitdir}/system/postgresql.service - - sed -e "s:%DB_USER%:${DB_USER}:g" -i ${D_DEST_DIR}/postgresql-init - sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${D_DEST_DIR}/postgresql-init - - sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${D_DEST_DIR}/postgresql-init - sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${D_DEST_DIR}/postgresql-init - - sed -e "s:%COMPUTE_IP%:${COMPUTE_IP}:g" -i ${D_DEST_DIR}/postgresql-init - sed -e "s:%COMPUTE_HOST%:${COMPUTE_HOST}:g" -i ${D_DEST_DIR}/postgresql-init - - install -d ${D}${systemd_unitdir}/system/ - PG_INIT_SERVICE_FILE=${D}${systemd_unitdir}/system/postgresql-init.service - install -m 644 ${WORKDIR}/postgresql-init.service ${PG_INIT_SERVICE_FILE} - sed -e "s:%SYSCONFIGDIR%:${sysconfdir}:g" -i ${PG_INIT_SERVICE_FILE} -} - -PACKAGES += " ${PN}-setup" - -SYSTEMD_PACKAGES += "${PN}-setup" -SYSTEMD_SERVICE_${PN}-setup = "postgresql-init.service" - -FILES_${PN}-setup = " \ - ${systemd_unitdir}/system \ -" -- cgit v1.2.3-54-g00ecf