fix: systemd unit should block on startup until http endpoint is ready (#21895)

* fix: systemd unit should block on startup until http endpoint is ready

* chore: update changelog
pull/21863/head
Cody Shepherd 2021-07-20 11:08:03 -07:00 committed by GitHub
parent 23c3d35aab
commit d0772d7d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View File

@ -19,6 +19,7 @@
- [#21792](https://github.com/influxdata/influxdb/pull/21792): fix: error instead of panic for statement rewrite failure
- [#21795](https://github.com/influxdata/influxdb/pull/21795): fix: show shards gives empty expiry time for inf duration shards
- [#21843](https://github.com/influxdata/influxdb/pull/21843): fix: hard limit on field size while parsing line protocol
- [#21895](https://github.com/influxdata/influxdb/pull/21895): fix: systemd unit should block on startup until http endpoint is ready
v1.9.2 [unreleased]
- [#21631](https://github.com/influxdata/influxdb/pull/21631): fix: group by returns multiple results per group in some circumstances

View File

@ -88,6 +88,8 @@ elif [ "$OS" == "linux" ] || [ "$OS" == "darwin" ]; then
chmod 0644 "$PKG_ROOT/usr/lib/influxdb/scripts/init.sh"
cp /isrc/scripts/influxdb.service "$PKG_ROOT/usr/lib/influxdb/scripts/influxdb.service"
chmod 0644 "$PKG_ROOT/usr/lib/influxdb/scripts/influxdb.service"
cp /isrc/scripts/influxd-systemd-start.sh "$PKG_ROOT/usr/lib/influxdb/scripts/influxd-systemd-start.sh"
chmod 0744 "$PKG_ROOT/usr/lib/influxdb/scripts/influxd-systemd-start.sh"
# Copy logrotate script.
cp /isrc/scripts/logrotate "$PKG_ROOT/etc/logrotate.d/influxdb"

View File

@ -0,0 +1,17 @@
#!/bin/bash -e
/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS &
echo $! > /var/lib/influxdb/influxd.pid
BIND_ADDRESS=$(influxd print-config --key-name http-bind-address)
HOST=${BIND_ADDRESS%%:*}
HOST=${HOST:-"localhost"}
PORT=${BIND_ADDRESS##*:}
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

View File

@ -13,6 +13,8 @@ EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/var/lib/influxdb/influxd.pid
[Install]
WantedBy=multi-user.target