@@ -331,19 +331,6 @@ function init_influxd () {
331
331
sed -i " s#http://localhost:${INFLUXD_INIT_PORT} #${final_host_scheme} ://localhost:${final_port} #g" " ${INFLUX_CONFIGS_PATH} "
332
332
}
333
333
334
- # Run influxd, with optional setup logic.
335
- function influxd_main () {
336
- if [ -f " ${BOLT_PATH} " ]; then
337
- log info " found existing boltdb file, skipping setup wrapper" bolt_path " ${BOLT_PATH} "
338
- elif [ -z " ${DOCKER_INFLUXDB_INIT_MODE} " ]; then
339
- log warn " boltdb not found at configured path, but DOCKER_INFLUXDB_INIT_MODE not specified, skipping setup wrapper" bolt_path " ${bolt_path} "
340
- else
341
- init_influxd " ${@ } "
342
- fi
343
-
344
- exec influxd " ${@ } "
345
- }
346
-
347
334
# Check if the --help or -h flag is set in a list of CLI args.
348
335
function check_help_flag () {
349
336
for arg in " ${@ } " ; do
@@ -376,7 +363,6 @@ function main () {
376
363
shift 1
377
364
fi
378
365
379
-
380
366
if ! check_help_flag " ${@ } " ; then
381
367
# Configure logging for our wrapper.
382
368
set_global_log_level " ${@ } "
@@ -386,12 +372,25 @@ function main () {
386
372
create_directories
387
373
fi
388
374
375
+ if [ -f " ${BOLT_PATH} " ]; then
376
+ log info " found existing boltdb file, skipping setup wrapper" bolt_path " ${BOLT_PATH} "
377
+ elif [ -z " ${DOCKER_INFLUXDB_INIT_MODE} " ]; then
378
+ log warn " boltdb not found at configured path, but DOCKER_INFLUXDB_INIT_MODE not specified, skipping setup wrapper" bolt_path " ${bolt_path} "
379
+ else
380
+ init_influxd " ${@ } "
381
+ # Set correct permission on volume directories again. This is necessary so that if the container was run as the
382
+ # root user, the files from the automatic upgrade/initialization will be correctly set when stepping down to the
383
+ # influxdb user.
384
+ create_directories
385
+ fi
386
+
389
387
if [ " $( id -u) " = 0 ]; then
390
388
exec gosu influxdb " $BASH_SOURCE " " ${@ } "
391
389
return
392
390
fi
393
391
394
- influxd_main " ${@ } "
392
+ # Run influxd.
393
+ exec influxd " ${@ } "
395
394
}
396
395
397
396
main " ${@ } "
0 commit comments