From 88964e2f7cc8cc724fe56f62e86ccf03ef1d0c88 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 19 Dec 2017 13:53:30 +0100 Subject: [PATCH] Alpinize Postgres Docker service --- postgres.sh | 7 +++---- postgres/etc/init.d/postgres | 16 ++++++++++++++++ postgres/lib/systemd/system/postgres.service | 11 ----------- 3 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 postgres/etc/init.d/postgres delete mode 100644 postgres/lib/systemd/system/postgres.service diff --git a/postgres.sh b/postgres.sh index 593ed74..31f6bfe 100644 --- a/postgres.sh +++ b/postgres.sh @@ -22,7 +22,6 @@ if [ ${DEBUG:-0} -eq 1 ]; then fi # Configure Postgres service -cp ${SOURCE_DIR}/lib/systemd/system/postgres.service /lib/systemd/system/postgres.service -systemctl daemon-reload -systemctl enable postgres -systemctl start postgres +cp ${SOURCE_DIR}/etc/init.d/postgres /etc/init.d/postgres +rc-update add postgres boot +service postgres start diff --git a/postgres/etc/init.d/postgres b/postgres/etc/init.d/postgres new file mode 100644 index 0000000..77729e8 --- /dev/null +++ b/postgres/etc/init.d/postgres @@ -0,0 +1,16 @@ +#!/sbin/openrc-run + +description="Postgres docker container" + +depend() { + need docker net + use dns logger netmount +} + +start() { + /usr/bin/docker run --rm --name postgres -v /srv/postgres:/var/lib/postgresql postgres +} + +stop() { + /usr/bin/docker stop postgres +} diff --git a/postgres/lib/systemd/system/postgres.service b/postgres/lib/systemd/system/postgres.service deleted file mode 100644 index 0234555..0000000 --- a/postgres/lib/systemd/system/postgres.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=PostgreSQL + PostGIS Docker container -After=network.target - -[Service] -Type=simple -ExecStart=/usr/bin/docker run --rm --name postgres -v /srv/postgres:/var/lib/postgresql postgres -ExecStop=/usr/bin/docker stop postgres - -[Install] -WantedBy=multi-user.target