Skip to content

Commit

Permalink
fix: add systemd-notify wrapper script around influxd for debs/rpms
Browse files Browse the repository at this point in the history
  • Loading branch information
codyshepherd committed Jul 14, 2021
1 parent e787113 commit 8e0dea6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ nfpms:
dst: /etc/logrotate.d/influxdb
- src: scripts/influxdb2-upgrade.sh
dst: /usr/share/influxdb/influxdb2-upgrade.sh
- src: scripts/influxd_wrapper.sh
dst: /usr/bin/influxd_wrapper.sh
scripts:
preinstall: "scripts/pre-install.sh"
postinstall: "scripts/post-install.sh"
Expand Down
15 changes: 15 additions & 0 deletions scripts/influxd_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -e
/usr/bin/influxd

HOST=${INFLUXDB_HOSTNAME:-"localhost"}
PORT=${INFLUXDB_HTTP_BIND_ADDRESS:-"8086"}

set +e
result=$(curl -s -o /dev/null http://$HOST:$PORT/ready -w %{http_code})
while [ "$result" != "200" ]; do
sleep 1
result=$(curl -s -o /dev/null http://$HOST:$PORT/ready -w %{http_code})
done
set -e

systemd-notify --ready
2 changes: 1 addition & 1 deletion scripts/influxdb.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb2
ExecStart=/usr/bin/influxd
ExecStart=/usr/bin/influxd_wrapper.sh
KillMode=control-group
Restart=on-failure

Expand Down

0 comments on commit 8e0dea6

Please sign in to comment.