summaryrefslogtreecommitdiff
path: root/openstack/etc/systemd/system
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2014-12-17 18:02:47 +0000
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-01-22 12:46:28 +0000
commitb18f85176ffefafbe91b1ac0c0f7141bb7a59dea (patch)
tree9cd9604cafd3e86070cca7a4468b649be6de80cd /openstack/etc/systemd/system
parent94e657440e11a33adbff3eeec367f28fa7612a7f (diff)
downloaddefinitions-b18f85176ffefafbe91b1ac0c0f7141bb7a59dea.tar.gz
Add databases stratum to system and add configuration and services for postgres
Diffstat (limited to 'openstack/etc/systemd/system')
-rw-r--r--openstack/etc/systemd/system/postgres-server.service26
-rw-r--r--openstack/etc/systemd/system/postgres-setup.service11
2 files changed, 37 insertions, 0 deletions
diff --git a/openstack/etc/systemd/system/postgres-server.service b/openstack/etc/systemd/system/postgres-server.service
new file mode 100644
index 00000000..6ee25e98
--- /dev/null
+++ b/openstack/etc/systemd/system/postgres-server.service
@@ -0,0 +1,26 @@
+[Unit]
+Description=PostgreSQL database server
+Requires=postgres-setup.service
+After=postgres-setup.service
+
+[Service]
+Type=forking
+TimeoutSec=120
+User=postgres
+Group=postgres
+
+Environment=PGROOT=/var/lib/pgsql
+
+SyslogIdentifier=postgres
+PIDFile=/var/lib/pgsql/data/postmaster.pid
+
+ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
+ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
+ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
+
+# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
+# killing Postgres, so adjust it downward
+OOMScoreAdjust=-200
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/etc/systemd/system/postgres-setup.service b/openstack/etc/systemd/system/postgres-setup.service
new file mode 100644
index 00000000..281d0d77
--- /dev/null
+++ b/openstack/etc/systemd/system/postgres-setup.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Run postgres-setup (once)
+After=network.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/share/openstack/postgres-setup
+Restart=no
+
+[Install]
+WantedBy=multi-user.target