scrutiny: [BUG] Latest image crashes on startup
I just switched over to the docker images ghcr.io/analogj/scrutiny:master-web
and ghcr.io/analogj/scrutiny:master-collector
since the docker hub ones have been taken down. Now my web
instance is crashing on startup with this error message:
goroutine 1 [running]:
github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware.RepositoryMiddleware(0x129f920, 0xc00038a070, 0x12a4b00, 0xc0003faa80, 0x129f9a0)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware/repository.go:14 +0xe6
github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Setup(0xc000385610, 0x12a4b00, 0xc0003faa80, 0x1)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:26 +0xd8
github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Start(0xc000385610, 0x0, 0x0)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:97 +0x234
main.main.func2(0xc000387340, 0x4, 0x6)
/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:112 +0x198
github.com/urfave/cli/v2.(*Command).Run(0xc0003ef200, 0xc0003871c0, 0x0, 0x0)
/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/command.go:164 +0x4e0
github.com/urfave/cli/v2.(*App).RunContext(0xc0003fe000, 0x128e820, 0xc0000c8010, 0xc0000be020, 0x2, 0x2, 0x0, 0x0)
/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:306 +0x814
github.com/urfave/cli/v2.(*App).Run(...)
/go/pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:215
main.main()
/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:137 +0x65a
2022/05/13 14:38:05 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml
time="2022-05-13T14:38:05Z" level=info msg="Trying to connect to scrutiny sqlite db: \n"
time="2022-05-13T14:38:05Z" level=info msg="Successfully connected to scrutiny sqlite db: \n"
panic: a username and password is required for a setup
There is no mention in the readme or the examble configs of a username/password, so what are the credentials that the application is missing and crashing over? Also, this error feels a lot like something that should be handled by the application and an informative error presented to the user.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 30 (14 by maintainers)
@ThisIsTheOnlyUsernameAvailable please take a look at this example config file if you’d like to use your own influxdb docker container:
https://github.com/AnalogJ/scrutiny/blob/master/docker/example.hubspoke.docker-compose.yml
If using a preexisting Influxdb instance (already pre-configured with users & buckets) you’ll need to specify the following variables in your config file:
https://github.com/AnalogJ/scrutiny/blob/master/example.scrutiny.yaml#L42-L45
I ended up forking the InfluxDB sdk and just adding support for a
SetupWithToken()
method. This means I can leverage the same functionality as theinflux setup
cli command, without needing to pull in the CLI tooling and its dependencies.The docker image is building right now, but it everything is working correctly in my local testing. You may need to delete your
influxdb
folder, or retrieve your existing token and store it asweb.influx.token
in your existing config file.Appreciate your detailed response above. I had already considered most of your options before going the “write a config file” route, but I thought it would add additional complexity and maintenance burden on my side. Regarding your 12-factor app comment, even with a config file Scrutiny supports overrides using env variables. The Viper config library that we use merges CLI -> Env -> config file values before providing them to the application. Secrets could/should always be provided as env variables. As Scrutiny is primarily a “read-only” application with little-to-no need for secrets or dynamic configuration, I had thought the trade-off was worth it, but I’m happy to make this change to support this style of deployment.