Service keeps crashing and will not restart

The last time my CMS deployed properly was yesterday and there have been no code changes on my code bases for 5 months. Now however my server crashes and when I restart I get the following connection error message; yarn run v1.22.19 $ strapi start [2024-02-05 10:33:14.237] debug: ⛔️ Server wasn't able to start properly. [2024-02-05 10:33:14.239] error: connect ECONNREFUSED 35.230.57.124:7870 Error: connect ECONNREFUSED 35.230.57.124:7870 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) error Command failed with exit code 1.
Solution:
with that said, the issue is that you are trying to connect to your deprecated and shut down legacy database, please read this docs page https://docs.railway.app/guides/database-migration-guide#switching-over-connections...
Jump to solution
22 Replies
Percy
Percy10mo ago
Project ID: b5bfdc68-e6f6-4a25-903c-7ccd329c8f97
Blackbeak
BlackbeakOP10mo ago
Project ID: b5bfdc68-e6f6-4a25-903c-7ccd329c8f97 MOre to the point despite the crashes why would it suddenly do this? I can investigate myself if I know where to start. Anyone in Railway working today? Am I doing something against the rules here? I have been waiting all day for some kind of support.
Brody
Brody10mo ago
hey sorry for not being able to get to this thread sooner, but this is community support.
Blackbeak
BlackbeakOP10mo ago
No worries.
Solution
Brody
Brody10mo ago
with that said, the issue is that you are trying to connect to your deprecated and shut down legacy database, please read this docs page https://docs.railway.app/guides/database-migration-guide#switching-over-connections
Blackbeak
BlackbeakOP10mo ago
I changed all the variables in Strapi to match earlier today. Still no luck. Same issue. And why did it work yeasterday? I was under the assumption on Jan 31st the old legacy DB would shut down.
Brody
Brody10mo ago
the legacy databases are shut down in waives, it would create far too much support load if they where all shut down at the same time please look for any hardcoded database credentials and update them to use environment variables in conjunction with variable references
Blackbeak
BlackbeakOP10mo ago
your reference variables page is "page not found" in your docs.
Brody
Brody10mo ago
oh wow, good catch
Blackbeak
BlackbeakOP10mo ago
Still having trouble with this so let me know if this is updated. I recognise it's my connection errors but I am having difficulty setting it up right.
Brody
Brody10mo ago
my bad, this is the section the docs should have taken you to https://docs.railway.app/guides/variables#reference-variables
Blackbeak
BlackbeakOP10mo ago
Ok, that's confusing me evn more. 🙂 I have a local .env file that matches what is in Railway's new server and I am referencing them there. Is this what I am doing wrong?
Blackbeak
BlackbeakOP10mo ago
IE the variables here;
No description
Blackbeak
BlackbeakOP10mo ago
match my .env file and I reference them from strapi like so; module.exports = ({ env }) => ({ connection: { client: 'postgres', connection: { host: env('PGHOST'), port: env.int('PGPORT'), database: env('PGDATABASE'), user: env('PGUSER'), password: env('PGPASSWORD'), }, }, }); i thought this would be enough as there are no hard coded vars there?
Brody
Brody10mo ago
this is an example of what the raw variables for your database would look like on your app's service (assuming your database service is named Postgres)
PGDATABASE=${{Postgres.PGDATABASE}}
PGUSER=${{Postgres.PGUSER}}
PGPASSWORD=${{Postgres.PGPASSWORD}}
PGHOST=${{Postgres.PGHOST}}
PGPORT=${{Postgres.PGPORT}}
PGDATABASE=${{Postgres.PGDATABASE}}
PGUSER=${{Postgres.PGUSER}}
PGPASSWORD=${{Postgres.PGPASSWORD}}
PGHOST=${{Postgres.PGHOST}}
PGPORT=${{Postgres.PGPORT}}
Blackbeak
BlackbeakOP10mo ago
So I update my .env to look like the above?
Brody
Brody10mo ago
nope, those are for railway
Brody
Brody10mo ago
No description
Blackbeak
BlackbeakOP10mo ago
Ahh ok. So I update them here;
No description
Brody
Brody10mo ago
im seeing a hardcoded database url but you dont use that in code from what you have shown me, so you can just remove that
Blackbeak
BlackbeakOP10mo ago
Ok. Thanks. That's where I was going wrong. I didn't understand the railway vars needed changing. So hardcoded variables there were the problem not in my app. Service is back up and running now. Thanks for the support. You can close this.
Brody
Brody10mo ago
happy to help!
Want results from more Discord servers?
Add your server