Skip to content

Commit ced629c

Browse files
authored
Merge pull request #551 from influxdata/dm-influxdb-docker-doc
doc: add README comment to 2.x entrypoints
2 parents 015d702 + 23ad7f0 commit ced629c

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

influxdb/2.0/alpine/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
11
#!/bin/bash
22
set -eo pipefail
33

4+
5+
## READ ME
6+
##
7+
## This script handles a few use-cases:
8+
## 1. Running arbitrary shell commands other than `influxd`
9+
## 2. Running subcommands of `influxd` other than `run`
10+
## 3. Running `influxd run` with no auto-setup or auto-upgrade behavior
11+
## 4. Running `influxd` with automated setup of a fresh 2.x DB
12+
## 5. Running `influxd` with automated upgrade from a 1.x DB
13+
##
14+
## Use-cases 4 and 5 both optionally support running user-mounted scripts against the
15+
## initialized DB to perform arbitrary setup logic.
16+
##
17+
## Use-case 1 runs as root (the container's default user). All other use-cases
18+
## run as a non-root user. To support this, the script attempts to handle chown-ing
19+
## the data directories specified in config/env/CLI flags. We do this even for
20+
## use-case 2 so that commands like `influxd inspect` which modify files in the data
21+
## directory don't create files will later be inaccessible to the main `influxd run`
22+
## process.
23+
##
24+
## Use-case 4 requires booting a temporary instance of `influxd` so we can access the
25+
## server's HTTP API. This script handles tracking the PID of that instance and shutting
26+
## it down appropriately. The instance is booted on a port other than what's specified in
27+
## config. We do this so:
28+
## 1. We can ignore any TLS settings in config while performing initial setup calls
29+
## 2. We don't have to worry about users accessing the DB before it's fully initialized
30+
##
31+
## Use-case 5 requires booting a temporary instance only when the user has mounted setup scripts.
32+
## If no scripts are present, we can `upgrade` and then immediately boot the server on the
33+
## user-configured port.
34+
35+
436
# Do our best to match the logging requested by the user running the container.
537
declare -rA LOG_LEVELS=([error]=0 [warn]=1 [info]=2 [debug]=3)
638
declare LOG_LEVEL=error

influxdb/2.0/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
11
#!/bin/bash
22
set -eo pipefail
33

4+
5+
## READ ME
6+
##
7+
## This script handles a few use-cases:
8+
## 1. Running arbitrary shell commands other than `influxd`
9+
## 2. Running subcommands of `influxd` other than `run`
10+
## 3. Running `influxd run` with no auto-setup or auto-upgrade behavior
11+
## 4. Running `influxd` with automated setup of a fresh 2.x DB
12+
## 5. Running `influxd` with automated upgrade from a 1.x DB
13+
##
14+
## Use-cases 4 and 5 both optionally support running user-mounted scripts against the
15+
## initialized DB to perform arbitrary setup logic.
16+
##
17+
## Use-case 1 runs as root (the container's default user). All other use-cases
18+
## run as a non-root user. To support this, the script attempts to handle chown-ing
19+
## the data directories specified in config/env/CLI flags. We do this even for
20+
## use-case 2 so that commands like `influxd inspect` which modify files in the data
21+
## directory don't create files will later be inaccessible to the main `influxd run`
22+
## process.
23+
##
24+
## Use-case 4 requires booting a temporary instance of `influxd` so we can access the
25+
## server's HTTP API. This script handles tracking the PID of that instance and shutting
26+
## it down appropriately. The instance is booted on a port other than what's specified in
27+
## config. We do this so:
28+
## 1. We can ignore any TLS settings in config while performing initial setup calls
29+
## 2. We don't have to worry about users accessing the DB before it's fully initialized
30+
##
31+
## Use-case 5 requires booting a temporary instance only when the user has mounted setup scripts.
32+
## If no scripts are present, we can `upgrade` and then immediately boot the server on the
33+
## user-configured port.
34+
35+
436
# Do our best to match the logging requested by the user running the container.
537
declare -rA LOG_LEVELS=([error]=0 [warn]=1 [info]=2 [debug]=3)
638
declare LOG_LEVEL=error

influxdb/2.1/alpine/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
11
#!/bin/bash
22
set -eo pipefail
33

4+
5+
## READ ME
6+
##
7+
## This script handles a few use-cases:
8+
## 1. Running arbitrary shell commands other than `influxd`
9+
## 2. Running subcommands of `influxd` other than `run`
10+
## 3. Running `influxd run` with no auto-setup or auto-upgrade behavior
11+
## 4. Running `influxd` with automated setup of a fresh 2.x DB
12+
## 5. Running `influxd` with automated upgrade from a 1.x DB
13+
##
14+
## Use-cases 4 and 5 both optionally support running user-mounted scripts against the
15+
## initialized DB to perform arbitrary setup logic.
16+
##
17+
## Use-case 1 runs as root (the container's default user). All other use-cases
18+
## run as a non-root user. To support this, the script attempts to handle chown-ing
19+
## the data directories specified in config/env/CLI flags. We do this even for
20+
## use-case 2 so that commands like `influxd inspect` which modify files in the data
21+
## directory don't create files will later be inaccessible to the main `influxd run`
22+
## process.
23+
##
24+
## Use-case 4 requires booting a temporary instance of `influxd` so we can access the
25+
## server's HTTP API. This script handles tracking the PID of that instance and shutting
26+
## it down appropriately. The instance is booted on a port other than what's specified in
27+
## config. We do this so:
28+
## 1. We can ignore any TLS settings in config while performing initial setup calls
29+
## 2. We don't have to worry about users accessing the DB before it's fully initialized
30+
##
31+
## Use-case 5 requires booting a temporary instance only when the user has mounted setup scripts.
32+
## If no scripts are present, we can `upgrade` and then immediately boot the server on the
33+
## user-configured port.
34+
35+
436
# Do our best to match the logging requested by the user running the container.
537
declare -rA LOG_LEVELS=([error]=0 [warn]=1 [info]=2 [debug]=3)
638
declare LOG_LEVEL=error

influxdb/2.1/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
11
#!/bin/bash
22
set -eo pipefail
33

4+
5+
## READ ME
6+
##
7+
## This script handles a few use-cases:
8+
## 1. Running arbitrary shell commands other than `influxd`
9+
## 2. Running subcommands of `influxd` other than `run`
10+
## 3. Running `influxd run` with no auto-setup or auto-upgrade behavior
11+
## 4. Running `influxd` with automated setup of a fresh 2.x DB
12+
## 5. Running `influxd` with automated upgrade from a 1.x DB
13+
##
14+
## Use-cases 4 and 5 both optionally support running user-mounted scripts against the
15+
## initialized DB to perform arbitrary setup logic.
16+
##
17+
## Use-case 1 runs as root (the container's default user). All other use-cases
18+
## run as a non-root user. To support this, the script attempts to handle chown-ing
19+
## the data directories specified in config/env/CLI flags. We do this even for
20+
## use-case 2 so that commands like `influxd inspect` which modify files in the data
21+
## directory don't create files will later be inaccessible to the main `influxd run`
22+
## process.
23+
##
24+
## Use-case 4 requires booting a temporary instance of `influxd` so we can access the
25+
## server's HTTP API. This script handles tracking the PID of that instance and shutting
26+
## it down appropriately. The instance is booted on a port other than what's specified in
27+
## config. We do this so:
28+
## 1. We can ignore any TLS settings in config while performing initial setup calls
29+
## 2. We don't have to worry about users accessing the DB before it's fully initialized
30+
##
31+
## Use-case 5 requires booting a temporary instance only when the user has mounted setup scripts.
32+
## If no scripts are present, we can `upgrade` and then immediately boot the server on the
33+
## user-configured port.
34+
35+
436
# Do our best to match the logging requested by the user running the container.
537
declare -rA LOG_LEVELS=([error]=0 [warn]=1 [info]=2 [debug]=3)
638
declare LOG_LEVEL=error

0 commit comments

Comments
 (0)