Skip to content

Commit 70543be

Browse files
devanbenzphiljb
andauthored
fix(packaging): init.sh should run buildtsi as influxdb user (#26699) (#26862)
Co-authored-by: Phil Bracikowski <13472206+philjb@users.noreply.github.com> fixes #26698
1 parent 31cb61f commit 70543be

File tree

1 file changed

+6
-5
lines changed
  • .circleci/packages/influxdb/fs/usr/lib/influxdb/scripts

1 file changed

+6
-5
lines changed

.circleci/packages/influxdb/fs/usr/lib/influxdb/scripts/init.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,12 @@ function start() {
155155
WAL_DIR="$( influxd_config data wal-dir )"
156156
if [[ ( -d "${DATA_DIR}" ) && ( -d "${WAL_DIR}" ) ]]
157157
then
158-
# If this daemon is configured to run as root, influx_inspect hangs
159-
# waiting for confirmation before executing. Supplying "yes" allows
160-
# the service to continue without interruption.
161-
yes | /usr/bin/influx_inspect buildtsi -compact-series-file \
162-
-datadir "${DATA_DIR}" \
158+
# buildtsi prompts with a warning if it is run as root as the files it creates will be owned by root which
159+
# influxd won't be able to read. Best to run it as the influxdb user instead. sudo and su are options but
160+
# difficult to use; setpriv is more direct and available in the util-linux package
161+
echo "Building tsi with influxd_inspect buildtsi."
162+
setpriv --reuid influxdb --regid influxdb --clear-groups /usr/bin/influx_inspect buildtsi -compact-series-file \
163+
-datadir "${DATA_DIR}" \
163164
-waldir "${WAL_DIR}"
164165
fi
165166

0 commit comments

Comments
 (0)