-
-
Notifications
You must be signed in to change notification settings - Fork 502
(psycopg2.OperationalError) FATAL: the database system is starting up #1191
Comments
Hmm.... Aren't there system startup gates to handle just this kind of situation? Seems like in the Unix startup sequence this kind of thing would happen all the time. |
If pressed I would put this in |
Well, for me it is just an observation. Also, I think it is common just to initiate the startup process for some "long to start" processes. I believe we do that e.g. for fail2ban - daemon is started "fully" but then it starts establishing its jails and that might take awhile. https://serverfault.com/questions/886641/systemctl-wait-for-start hints that it is not uncommon. I guess also in typical usecases, the time passes from starting core service such as postgresql to the moment of starting leaf projects, like runestone service, would take a bit so it would not be noted. In my case it didn't happen when I build a new docker image, but when I start from a commit of a running container (so may be it gets committed a bit dirty and services require some house keeping to start properly) - I run into above case. |
Wouldn’t it be better to set up Postgres in its own container and have it use some kind of persistent volume storage for the database? Using git to provide persistence across docker runs seems like a really bad idea. |
Sorry for a lengthy reply, I will try to be more succinct in the future ;-)
"docker compose" recipe (to orchestrate multiple containers - one for DB and one for the server) is one of the possible TODOs I left in #1178 . Myself I haven't used it much (if at all) so I can't judge objectively, but for me it always felt like an overkill for any of my usecases, and somewhat lacking the point whenever all components could be consistently and coherently (the same OS distribution) be installed within a single container. May be in some cases where containers modularity is really needed (e.g. to provide reverse proxy service on top of regular www server containers etc), I could see the point, but not here really. |
Why? ;-) |
Why — because that’s why databases exist: to provide super reliable persistence of the data they store. Forcing your database to “recreate” itself from some undetermined state that is captured by git just seems mean, and honestly it sounds to me like a good way to end up losing data. Maybe I’m old school — I’ve been using databases for 25 years, and only recently starting to discover Docker. I have one instance of Runestone hosted on webfaction that has been running since 2012. The server has only needed to be rebooted a handful of times in all those years and I’ve never lost any data. Maybe I’m just missing something on why one would need to regularly reboot / restart their Runestone services?? I’m willing to adapt/modernize but I’d like to understand why before I invest the time needed to do so. I’ve been using git for years but this is the first I’ve heard of git-annex. — always something new to learn. |
oh no -- I don't want to recreate it from some state -- I want to capture the entire state after DB is successfully powered down. Isn't DB underneath uses regular files for the storage? |
anyways -- git/git-annex desire is orthogonal to this issue that it might take DB service some time to spin back up, and then Runestone server start would keep crashing until the DB is fully up. |
Stale issue message |
in the light of #1178 , runestone server could be ran very shortly after
service postresql start
, which is what I think leads to:full traceback:
Outside workaround was to add an generous sleep of 100 sec (10 was not enough in my case, oldish server), and then it started ok. So ideally, there is a guard within RunestoneServer to loop for some predefined timeout period (e.g. 2 minutes) trying to establish connection e.g. each 5 seconds.
The text was updated successfully, but these errors were encountered: