summaryrefslogtreecommitdiff
path: root/openstack/etc
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-02-11 18:30:32 +0000
commit14bcf47ade1cc85ef0d86cd4e0f248f375b2c01f (patch)
tree584725699dcf2ee85c51437364b07a8ffdf6760b /openstack/etc
parent6df07aca03b46537b9053b232967f4168480f8e9 (diff)
downloaddefinitions-14bcf47ade1cc85ef0d86cd4e0f248f375b2c01f.tar.gz
Add databases stratum to system and add configuration and services for postgres
Diffstat (limited to 'openstack/etc')
-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