-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Latest image crashes on startup #248
Comments
Hey, Can you paste your docker run command or docker-compose file? |
I don't use docker cli or docker-compose, I'm running it on Nomad, but here is the file anyway:
|
@AnalogJ here's mine as well.
|
@tommyalatalo you'll need to remove the @evulhotdog you'll need to remove the same environmental variables I mentioned to @tommyalatalo , but you'll also need to update your image to I'm going to close this issue for now, feel free to comment/reopen it if you run into any other issues. |
Removing
|
So now I switched to the omnibus image on my api node, but it also fails...
|
Hey @tommyalatalo can you unset the |
actually, can you try setting it to |
same problem here with latest docker: yesterday at 17:25:48 It woorks fine until latest docker update. |
|
I switched for latest analogj Image and worrks fine, my new yaml file is:
|
I've tried both unsetting and setting it to localhost, now the error I'm getting is this:
|
Hey @tommyalatalo That new error related to onboarding is because the influxdb data directory is not currently mounted/persisted outside the container. If you're using the official omnibus image, you can add a volume mount like: Please confirm that these steps fixed the issue and I can close this :) |
I don't have any references left to anything outside
this is the container that should be starting up:
|
@tommyalatalo no other error messages? Can you enable debug mode by setting the |
Okay, I found that the database location was wrong in my
|
Stop scrutiny, backup then delete your infkuxdb directory, then restart
scrutiny.
That should fix it
…On Tue, May 17, 2022 at 10:13 AM Tommy Alatalo ***@***.***> wrote:
Okay, I found that the database location was wrong in my scrutiny.yaml
file, after fixing that I now get this error:
goroutine 1 [running]:github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware.RepositoryMiddleware(0x129f920, 0xc00040a068, 0x12a4b00, 0xc000470bd0, 0x129f9a0)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware/repository.go:14 +0xe6gitpro.ttaallkk.top/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Setup(0xc000405620, 0x12a4b00, 0xc000470bd0, 0x14)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:26 +0xd8gitpro.ttaallkk.top/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Start(0xc000405620, 0x0, 0x0)
/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:97 +0x234
main.main.func2(0xc000411240, 0x4, 0x6)
/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:112 +0x198gitpro.ttaallkk.top/urfave/cli/v2.(*Command).Run(0xc0004730e0, 0xc0004110c0, 0x0, 0x0)
***@***.***/command.go:164 +0x4e0gitpro.ttaallkk.top/urfave/cli/v2.(*App).RunContext(0xc00047e000, 0x128e820, 0xc000130010, 0xc000126020, 0x2, 0x2, 0x0, 0x0)
***@***.***/app.go:306 +0x814gitpro.ttaallkk.top/urfave/cli/v2.(*App).Run(...)
***@***.***/app.go:215
main.main()
/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:137 +0x65a
2022/05/17 17:12:13 Loading configuration file: /opt/scrutiny/config/scrutiny.yaml
time="2022-05-17T17:12:13Z" level=info msg="Trying to connect to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n"
time="2022-05-17T17:12:13Z" level=info msg="Successfully connected to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n"
time="2022-05-17T17:12:13Z" level=debug msg="InfluxDB url: http://localhost:8086"
time="2022-05-17T17:12:13Z" level=debug msg="No influxdb token found, running first-time setup..."
panic: conflict: onboarding has already been completed
—
Reply to this email directly, view it on GitHub
<#248 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGZXYY3MRU4RQ24B7ZT6U3VKPHTLANCNFSM5V3TXU4A>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Yeah, that does get scrutiny to start, but if I restart the web container it errors out again with the same message.
|
That means your config.yaml file is not being persisted correctly.
Is that I'm guessing your In that case, you can authenticate to the InfluxDB webui, retrieve the API token, and store it in your scrutiny.yaml file. |
You're right,
|
Hope that answers all your questions? |
Thanks for answering all the questions, I appreciate it. I definitely agree that uncommon practice is not equal to bad practice, though in this case I'm pretty confident that it's also the latter. So I work in devops/sysops and have deployed hundreds of applications, and I can honestly say that not a single one so far has ever overwritten it's own config file when started up. There are two main reasons for this, both are present in my issue above. The first is that the application cannot assume that the config file is writable, and shouldn't expect it to be since it's a user supplied config which can contain credentials like the api token or pushover token, meaning that a user like me can use an in-memory filesystem like nomad's secrets folder, or kubernetes secrets etc, and never persist the file to disk in order to not leak the credentials. The file could also just be mounted as read-only into docker with The second reason is that if an application writes parameters back into its config file it makes the behavior of the application non-deterministic, which you can see in my case where I first start up scrutiny from having no database, it works, and then when restarting after the database has been initialized it fails instead, while I'm still using the same config. So the application behavior changes, but from a user standpoint my application config is exactly the same and so results should be expected to be the same as well. Since I said that it's bad practice I should of course give an example of what is considered to be good practice, one of the best examples I know of is the 12factor app method, where configuration should be primarily in env vars; https://12factor.net/config. When considering this you quickly realize that if all the config was set as env vars there would be nowhere to write the api token back to in order to persist it, which is a strong indication that the current api token handling is suboptimal. But that's all fine, scrutiny is a work in progress and I hope you appreciate that this is a tangent on what as a whole is a great project and very useful to me as well, so let's discuss possibilities of how to handle the api token in a different way. I've built an application myself that uses influxdb heavily, but that was v1.8 so the SDK is clearly a bit different since the api token is now necessary. I'm currently thinking of two approaches;
The official influxdb docker image does exactly this in its entrypoint: https://github.com/influxdata/influxdata-docker/blob/master/influxdb/2.2/entrypoint.sh#L224-L226 This would be by far the best way to handle this, since you can have the token supplied immediately as an env var, (or in the
Well that was a whole lot of discussion, I hope you didn't fall asleep halfway through :D |
I ended up forking the InfluxDB sdk and just adding support for a The docker image is building right now, but it everything is working correctly in my local testing. 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. |
That sounds like a good solution, I thought you already bootstrapped the database with the Ah yes, I've used Viper myself, it's an excellent library especially when paired with Cobra. And there's nothing wrong with supporting both config files and env, that gives a lot of flexibility for templating etc. I'm looking forward to trying the new image when you have it ready! I'm using scrutiny across 3 hosts where one is a remote backup server, all in a hub/spoke setup, overall I really like being able to monitor all my disks and have Pushover notifications set up so that I can immediately move on changing a disk if I start to get errors. It's so great to be able to do this across a cluster and manage it from one central place and not have to set it up per-host as with smartctl. |
Is it possible to use an external influxdb instance? If so, can anyone suggest what the Docker environment variables (or config options) should be? |
@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 |
Closing this issue now that If you're using Docker, you'll need to wait until https://github.com/AnalogJ/scrutiny/actions/runs/2359630681 completes to use the fixed image. Thanks for all your help and feedback @tommyalatalo ! 🎉 |
I looked at the pipeline, are you not tagging the image with the version number in addition to just I force pulled the new image tagged |
not sure what you looked at:
The It seems that the |
Looks like the failure was due to a timeout, retrying fixed the issue: https://github.com/AnalogJ/scrutiny/pkgs/container/scrutiny/22808074?tag=v0.4.6-omnibus |
I just switched over to the docker images
ghcr.io/analogj/scrutiny:master-web
andghcr.io/analogj/scrutiny:master-collector
since the docker hub ones have been taken down. Now myweb
instance is crashing on startup with this error message: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.
The text was updated successfully, but these errors were encountered: