Skip to content

Commit

Permalink
fix(systemctl) fixes systemctl reload kong.service (#216)
Browse files Browse the repository at this point in the history
* test(systemctl) test all systemctl actions

* fix(systemctl) fix systemctl reload kong command
  • Loading branch information
hutchic authored Feb 7, 2020
1 parent 08b3bf8 commit f19ece3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kong.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
ExecStartPre=/usr/local/bin/kong prepare -p /usr/local/kong
ExecStart=/usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf
ExecReload=/usr/local/openresty/nginx/sbin/nginx -s reload
ExecReload=/usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

Expand Down
2 changes: 2 additions & 0 deletions test/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -x

source test/util.sh

if $VERBOSE; then
Expand Down
15 changes: 14 additions & 1 deletion test/tests/01-package/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,24 @@ docker run ${USE_TTY} --user=root --rm ${KONG_TEST_IMAGE_NAME} /bin/sh -c "ls -l
# TODO enable this test in other distros containing systemd
if [[ "$RESTY_IMAGE_TAG" == "bionic" ]]; then
cp $PACKAGE_LOCATION/*.deb kong.deb
docker run -d --rm --name systemd-ubuntu --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PWD:/src jrei/systemd-ubuntu
docker run -d --rm --name systemd-ubuntu -e KONG_DATABASE=off --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v $PWD:/src jrei/systemd-ubuntu
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "dpkg -i /src/kong.deb || true"
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "apt-get update"
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "apt-get install -f -y"
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "mkdir -p /etc/systemd/system/kong.service.d/"
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "cat <<\EOD > /etc/systemd/system/kong.service.d/override.conf
[Service]
Environment=KONG_DATABASE=off
EOD"
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl daemon-reload"
sleep 5
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl start kong"
sleep 5
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl reload kong"
sleep 5
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl restart kong"
sleep 5
docker exec ${USE_TTY} systemd-ubuntu /bin/bash -c "systemctl stop kong"
docker stop systemd-ubuntu
rm kong.deb
fi

0 comments on commit f19ece3

Please sign in to comment.