mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 23:15:49 +03:00
[GH-ISSUE #861] Healthchecks is not working after update #606
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#606
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hamx01 on GitHub (Jul 17, 2023).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/861
Hi! I recently updated HC to version 2.10
And after update, I can reach main menu with projects, but I can't reach project.
After I'm clicking on project, everything I have is "This page is not working".
In logs, one error that I have is:
Could you please help me with that?
@cuu508 commented on GitHub (Jul 17, 2023):
I think there are two issues here:
@hamx01 commented on GitHub (Jul 17, 2023):
@cuu508
Okay, how can I fix this error with ADMINS or there is no fix because I'm using linuxserver image?
My env variable looks like this:
ADMINS='myemail@mydomain.com'
And what about exception with project page, I found this line in logs (seems that when I'm trying to reach page there are 0 bytes generated):
[pid: 151|app: 0|req: 4421/4466] 192.168.1.42 () {38 vars in 1123 bytes} [Mon Jul 17 09:28:28 2023] GET /projects/42ae0cc6-36d7-4518-a2c9-b52098d74a34/checks/ => generated 0 bytes in 1636 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
One more question. Is there possibility to reinstall HC without losing everything. Like ping URLs and projects? (In case if this exception can't be fixed)
@cuu508 commented on GitHub (Jul 17, 2023):
Take a look what the generated
local_settings.pyinside the healthchecks container looks like. ADMINS in there should look something like:If it doesn't, that's an issue that should be reported to linuxserver maintainers, and fixed in the linuxserver image.
ADMINS is a standard Django setting: https://docs.djangoproject.com/en/4.2/ref/settings/#admins
The logs show the server generated a HTTP 500 "Internal Server Error" response, but there are no details on what caused the error.
All of Healthchecks state is stored in the database. If you switch to a different container image, but point it to the same database, you will keep the same user accounts, projects, checks, etc. To make sure you don't lose your data, make sure to back up the database before any major changes.
@hamx01 commented on GitHub (Jul 17, 2023):
@cuu508
I checked
local_setting.pyand the ADMINS are looked like this:ADMINS="myemail@mydomain.com"I changed it to:
ADMINS=[("myemail@mydomain.com")]But it gives nothing, the error of ADMINS is not 2-tuples list is all the time in logs.
@cuu508 commented on GitHub (Jul 17, 2023):
Change it to
@hamx01 commented on GitHub (Jul 17, 2023):
@cuu508 Yep, it helps, thank you! I will try to report it to linuxserver.
What about another problem. Now I see Internal Server Error 500 when trying to enter my project.
And some new logs appeared (sorry for that big amount, I just don't know which are the most important logs):
@cuu508 commented on GitHub (Jul 17, 2023):
This is likely because database schema migrations (
manage.py migrate) have not been applied.The
healthchecks/healthchecksimage applies migrations automatically on startup. I'm not sure how to apply migrations with the linuxserver image.@hamx01 commented on GitHub (Jul 17, 2023):
If I switch
linuxserverimage tohealthchecks. And will use my database which I have now. Will it be a problem?Or we can give it a try?
@cuu508 commented on GitHub (Jul 17, 2023):
If the database also runs in a container, and you manage it with docker compose, I'm not sure, you should consult with docker expert, I'm not docker expert :-)
If the database runs as a normal system process, use the same
DB_...settings and there should be no problems.Whenever in doubt, make backups first.
@hamx01 commented on GitHub (Jul 17, 2023):
Database runs in container, but without docker compose. Like if I replace docker-compose.yml file of HC, it will not affect DB.
So I will give it a try and get back to you if I would have any problems further.
@hamx01 commented on GitHub (Jul 18, 2023):
@cuu508
There is a new day and new problems.
I changed docker image to
healthchecksand the database remains as it was.And now when I'm trying to reach the login page, I have
Bad Request (400)code.I would really appreciate it if you could help with this problem, because we are using it in production, and it will be very nice if there won't be any necessity to edit about 30+ scripts with new ping URL.
I'm attaching logs for you:
_healthchecks_logs.txt
If you want a database structure, I can share it.
@cuu508 commented on GitHub (Jul 18, 2023):
What do your
ALLOWED_HOSTSandSITE_ROOTsettings look like?What is the site URL when you view it in the browser?
@hamx01 commented on GitHub (Jul 18, 2023):
I set
ALLOWED_HOSTSandSITE ROOTas URL that I'm trying to reach in browser, and now it is allowing me to enter the system, and I even logged in my account and see my project but when I'm trying to reach project I haveServer Error (500).And at the top of the page there is a label that says:
Running with an insecure SECRET_KEY value, do not use in production.Attaching logs that shows what's going on when trying to open project:
_healthchecks_logs_opening_project.txt
@cuu508 commented on GitHub (Jul 18, 2023):
As an experiment, I started a MariaDB server, created a database, and applied all migrations. The
accounts_profiletable looks like so for me:The contents of
django_migrationstable:Can you please run the same commands on your database, and show the results?
@hamx01 commented on GitHub (Jul 18, 2023):
Here it is:
And the second command:
@cuu508 commented on GitHub (Jul 18, 2023):
Did you by any chance add or modify the
accounts_profile.deletion_scheduled_datemanually?On my database it is nullable, on yours it is not, and the data types are also different.
Backup the database, then try undoing the migrations that created this column:
And the reapplying them:
@hamx01 commented on GitHub (Jul 19, 2023):
Yeah, I modified something manually, after I check the logs and saw that there is some problem with this column. Of course, it was after I changed the image of HC to latest version.
I executed this command that you send me and there is the result:
And now it's working, I can open my project, and ping my checks, but label with
SECRET_KEYis still there. How can I fix that, and is there something that I need to do else?@cuu508 commented on GitHub (Jul 19, 2023):
Glad to hear you got it working.
You need to set SECRET_KEY to a random, secret value, see: https://healthchecks.io/docs/self_hosted_configuration/#SECRET_KEY
I would suggest to also review the other available configuration settings: https://healthchecks.io/docs/self_hosted_configuration/
And the "Running in Production" section in README: https://github.com/healthchecks/healthchecks#running-in-production
@hamx01 commented on GitHub (Jul 20, 2023):
I generated
SECRET_KEYwith the help of this pagehttps://djecrety.ir/. And pasted it into .env of docker-compose.yml. But it gives nothing. Still, there is some label saying about my secret key.@cuu508 commented on GitHub (Jul 20, 2023):
If you see the "Running with an insecure SECRET_KEY value, do not use in production." banner, it means the SECRET_KEY value is not set and Healthchecks is using the default, insecure
---value. The custom value you generated is not being picked up for some reason. When you say ".env of docker-compose.yml" what do you mean precisely? Did you put it right next to theDB_*settings, theALLOWED_HOSTSsetting, etc.?@hamx01 commented on GitHub (Jul 20, 2023):
Yes, exactly in this place.
I'm using Portainer to deploy docker containers, so I have defined stack that simply mean that I have
docker-compose.ymland inside this file I haveenvironmentsection and there are all env variables are placed.@cuu508 commented on GitHub (Jul 20, 2023):
You can check what SECRET_KEY value the python code sees like so:
It should show the same value you specified in
docker-compose.yml. If it shows anything different, your task is to debug where and why your SECRET_KEY value is lost.@hamx01 commented on GitHub (Jul 20, 2023):
Done, found the problem, it was related to quotes.
I had
SECRET_KEY='randomsafetystring'I changed to
SECRET_KEY=randomsafetystringAnd now in python shell I see the same key that I set in env section.
So for now all problems are solved.
Thank you very much for your help! I really appreciate your support.