Health check not working for Strapi instance
I have a Strapi v4 instance running together with a Postgres Server. It seems that due to a knex error Strapi crashes the server from time to time. All of this is OK for now but it seems to me that no matter what health check / restart policy I have the server never actually restarts. Running the same project on Render with the same restart policy does what I'd expect it to do so I was wondering if anyone has some ideas?
Solution:Jump to solution
though actually fixing this issue should be as simple as setting
pool.min
to zero as shown in the offical template
https://github.com/railwayapp-templates/strapi/blob/main/config/database.js#L12...12 Replies
Project ID:
78f1716a-88aa-4f72-bab8-2fa121ab1d5b
78f1716a-88aa-4f72-bab8-2fa121ab1d5b
even though that restart number field is hidden for some reason, the always restart will not infinitely restart the deployment, that could cause infinite crashes
always will restart the deployment if the app exits with any error code
Solution
though actually fixing this issue should be as simple as setting
pool.min
to zero as shown in the offical template
https://github.com/railwayapp-templates/strapi/blob/main/config/database.js#L12this issue is documented in strapis docs here
https://docs.strapi.io/dev-docs/configurations/database#database-pooling-options
I don't see the number of restarts field as an option. But either way it is concerning that the app doesn't restart at all. I appreciate the Strapi pool size fix! Implementing that now. I just would like to be comfortable and know the app actually restarts when it fails. That's kinda what the policy describes, no?
as previously mentioned, the always restart will not infinitely restart the deployment, it will still only restart up to the set restart attempt amount, even though that field is hidden the value still applies, that is a ui bug
.. but will still only restart up to the set amount
Oh I see but no way in the observability logs does it look like it actually restarted even once?
A click on the restart button temporarly fixes the issue immediately so I am assuming it never even tried to restart once.
the screenshot you sent, it shows a crash and then shows the start command again, so yes it was restarted
Hm ok thanks. I'll keep observing this. I could swear it showed EXIT at let's say 3pm and then it was off until hours later when I realized and manually restarted. I didn't notice the retries but perhaps I didn't look close enough.
if railway has already restarted the deployment 10 times (default value) then it wont attempt any more restarts
either way, ive seen this connection reset by peer strapi issue a hundred times, the fix has always been setting
pool.min
to 0
as the strapi docs mentionawesome thanks!