Strapi v4 server doesn't start up

Issues information

  • OS:
  • databases: PostgreSQL
  • Programming language and version: Strapi v4, Node 16
  • Link to your project on Github/Gitlab: Private

Your issue

Hello!

I’m trying to deploy my Strapi v4 application and I followed all the steps outlined in here Hello World. Deploy your first application. | Qovery

But for some reason my server doesn’t start, it can’t connect to the database. Can you please help me to figure out what’s going on?

These are the error logs:

yarn run v1.22.19
22 Aug, 18:40:05.414
app-z642c021d-85744f7d67-vm77c
$ strapi start
22 Aug, 18:40:11.710
app-z642c021d-85744f7d67-vm77c
[2022-08-22 16:40:11.708] debug: ⛔️ Server wasn't able to start properly.
22 Aug, 18:40:11.711
app-z642c021d-85744f7d67-vm77c
[2022-08-22 16:40:11.710] error: connect ECONNREFUSED 127.0.0.1:5432
22 Aug, 18:40:11.711
app-z642c021d-85744f7d67-vm77c
Error: connect ECONNREFUSED 127.0.0.1:5432
22 Aug, 18:40:11.711
app-z642c021d-85744f7d67-vm77c
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1138:16)
22 Aug, 18:40:11.734
app-z642c021d-85744f7d67-vm77c
error Command failed with exit code 1.

Hi @mayrsascha, welcome and thanks for asking here.
From what I see, you must properly configure your application with your database on Qovery. You can follow this guide.

BTW, I’ve created a guide on how to deploy a Strapi V4 application with Terraform and Qovery as well.

And you can find a video here.

@rophilogene Thanks for your answers!

I went with the first option, since I am not that experienced with Terraform and want to keep my deployment complexity low.

Creating the database worked as intended, just had to create some aliases for the auto-generated environment variables to give my application access to the database, since it’s expecting the ENVs to be called a certain way.
BTW, the database password was NOT automatically set for my application, I had to add that ENV manually, just FYI. The database password is also automatically set, just as a secret variable instead of an environment variable, so I didn’t see it in the UI at first.