influxdata / influxdata-docker

Official docker images for the influxdata stack
327 stars 248 forks source link

Starting a v2 container throws property not found: `tls-cert`, `tls-key` #740

Open jstirnaman opened 7 months ago

jstirnaman commented 7 months ago

A user reported the problem below in Community and I can consistently reproduce it.

/home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-cert
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-key

Note: While trying to troubleshoot, I removed all config files and was then able to run a container that didn't throw the dasel errors, and did throw the expected "missing TLS cert file" error. But, then after breaking it again, I wasn't able to repeat my "fix" by making the same changes.

Reproduced on my system.

OS: Mac OS X

In the following example, $HOME/apps/influxdb-docker-files/data and $HOME/apps/influxdb-docker-files/config are empty directories:

(env1) (base) ja@MacBook-Pro influx-docker-test % docker run \
    -p 8086:8086 \
    -v "$HOME/apps/influxdb-docker-files/data:/var/lib/influxdb2" \
    -v "$HOME/apps/influxdb-docker-files/config:/etc/influxdb2-custom" \
    -e INFLUXD_CONFIG_PATH="/etc/influxdb2-custom" \
    -e INFLUXD_LOG_LEVEL=debug \
    -e DOCKER_INFLUXDB_INIT_MODE=setup \
    -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
    -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
    -e DOCKER_INFLUXDB_INIT_ORG=my-org \
    -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
    -e DOCKER_INFLUXDB_INIT_TOKEN=my-token \
    influxdb:2 > log.out
Error: could not get read parser: read parser required when reading from stdin
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x40001b4ee8?)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x40001e9980?, 0x0?})
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x40001e9980, 0x16}, 0x0, 0x0, 0x0})
        /home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
        /home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x40006167a0, 0x0, 0x0})
        /home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x400033cab0, 0x1, 0x4?})
        /home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400050a400, 0x1ef874?, {0x40006167b0, 0x1, 0x40001b5668?})
        /home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
        /home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x40002f57c0)
        /home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400050a400)
        /home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
        /home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x400033ca50}, {0xffffcc61dd01, 0x11}, {0x310e80?, 0x4000616790?})
        /home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x40001b5c68, 0x37391c?)
        /home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000184200?, {0x40002f5680, 0x1, 0x370836?})
        /home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x40004b4300, {0x40002f5630, 0x5, 0x5})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x40004b4000)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x4000078000?)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
        /home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x4000166ee8?)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x4000152020?, 0x0?})
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x4000152020, 0x16}, 0x0, 0x0, 0x0})
        /home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
        /home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x400001f690, 0x0, 0x0})
        /home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x40001c61b0, 0x1, 0xffff671414b8?})
        /home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400030b280, 0x1ef874?, {0x400001f6a0, 0x1, 0x4000167668?})
        /home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
        /home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x4000020370)
        /home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400030b280)
        /home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
        /home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x40001c6150}, {0xffffd29fcd0f, 0x8}, {0x310e80?, 0x8e0ee0?})
        /home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x4000167c68, 0x37391c?)
        /home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000136200?, {0x4000020230, 0x1, 0x370836?})
        /home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x400044a300, {0x40000201e0, 0x5, 0x5})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x400044a000)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x400008c000?)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
        /home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x4000166ee8?)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:265 +0xfc
reflect.flag.mustBeAssignable(...)
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:259
reflect.Value.Set({0x0?, 0x0?, 0x20?}, {0x3542a0?, 0x40001803c0?, 0x0?})
        /opt/hostedtoolcache/go/1.21.3/x64/src/reflect/value.go:2254 +0x54
github.com/tomwright/dasel/v2.newContextWithFunctions.func1({{0x3542a0, 0x40001803c0, 0x16}, 0x0, 0x0, 0x0})
        /home/runner/work/dasel/dasel/context.go:62 +0x78
github.com/tomwright/dasel/v2.Value.Set(...)
        /home/runner/work/dasel/dasel/value.go:151
github.com/tomwright/dasel/v2.Value.initEmptydencodingMap({{0x0, 0x0, 0x0}, 0x40003eb3f0, 0x0, 0x0})
        /home/runner/work/dasel/dasel/value.go:325 +0x138
github.com/tomwright/dasel/v2.Values.initEmptydencodingMaps({0x40001c61b0, 0x1, 0xffff60f1cb98?})
        /home/runner/work/dasel/dasel/value.go:502 +0x124
github.com/tomwright/dasel/v2.glob..func26(0x400030b280, 0x1ef874?, {0x40003eb400, 0x1, 0x4000167668?})
        /home/runner/work/dasel/dasel/func_property.go:38 +0x188
github.com/tomwright/dasel/v2.BasicFunction.Run(...)
        /home/runner/work/dasel/dasel/func.go:144
github.com/tomwright/dasel/v2.(*Step).execute(0x4000020370)
        /home/runner/work/dasel/dasel/step.go:30 +0xd4
github.com/tomwright/dasel/v2.(*Context).Next(0x400030b280)
        /home/runner/work/dasel/dasel/context.go:227 +0x1a4
github.com/tomwright/dasel/v2.(*Context).Run(0x36e040?)
        /home/runner/work/dasel/dasel/context.go:195 +0x34
github.com/tomwright/dasel/v2.Put({0x36e040, 0x40001c6150}, {0xffffc5d56d10, 0x7}, {0x310e80?, 0x8e0ee0?})
        /home/runner/work/dasel/dasel/context.go:130 +0x9c
github.com/tomwright/dasel/v2/internal/command.runPutCommand(0x4000167c68, 0x37391c?)
        /home/runner/work/dasel/dasel/internal/command/put.go:144 +0x4b0
github.com/tomwright/dasel/v2/internal/command.putRunE(0x4000136200?, {0x4000020230, 0x1, 0x370836?})
        /home/runner/work/dasel/dasel/internal/command/put.go:95 +0x4e8
github.com/spf13/cobra.(*Command).execute(0x4000572300, {0x40000201e0, 0x5, 0x5})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x4000572000)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(0x400008c000?)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c
main.main()
        /home/runner/work/dasel/dasel/cmd/dasel/main.go:10 +0x24
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-cert
Error: cannot use property selector on non map/struct types: invalid: property not found: tls-key
2024-04-17T21:40:32.192036801Z  warn    cleaning bolt and engine files to prevent conflicts on retry    {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt", "engine_path": "/var/lib/influxdb2/engine"}
jstirnaman commented 6 months ago

The error occurs from specifying -e INFLUXD_CONFIG_PATH="/etc/influxdb2-custom" \

user1537 commented 5 months ago

I've also encountered this error, but at least in my case, after checking the entrypoint.sh script, I realized that I was providing a path to a directory containing the configuration file in the INFLUXD_CONFIG_PATH environment variable (/etc/influxdb2), where what is actually expected there is the full path to the config file (e.g. /etc/influxdb2/config.yaml).

hoo29 commented 5 months ago

The docs do say set it to a directory https://docs.influxdata.com/influxdb/v2/reference/config-options/#influxdb-configuration-file

To customize the directory path of the configuration file, set the INFLUXD_CONFIG_PATH environment variable to your custom path.

export INFLUXD_CONFIG_PATH=/path/to/custom/config/directory