a year ago
The strapi app deployed successfully, crashes after 5 seconds and the restarts. I have added all the necessary Postgres Variables and update config/database.ts still it doesn’t work.
66 Replies
a year ago
Are you using the template?
a year ago
this one https://railway.com/template/strapi
I deployed my project on railway and deployed a new Postgres for the project
a year ago
Please check the DB credentials
a year ago
Check if strapi is using the correct ones
In database.ts: there are configs like PGHOST, PGDATABASE etc but environment variables are DATABASEHOST, DATABASENAME. Which is the right one to use
a year ago
just updated it to use latest, do you want to give that a go?
a year ago
https://railway.com/template/strapi all instructions r here
a year ago
Yeah, because locally ur postgres instance has other creds, ur trying to log in with "root" while the default user on the railway postgres db is "postgres"
a year ago
Anyway, did u manage to deploy it through the template @frankiefab ?
Using this template requires me create new content types and documents on strapi
I can’t tell why the developer relations team at Railway suggest this same template for every problem. There should a better solution
a year ago
hello, these people are community members and moderators, them recommending something that is known working is a good recommendation.
a year ago
either way, the project you linked has been deleted
a year ago
would you like to provide a new project id for me to look into?
a year ago
alright fixed it up for you, you can look at your activity logs to see what i needed to do to fix your project up
Thank you. But any reason why the strapi content still doesn’t show up on the frontend even after successful deployment.
a year ago
link to frontend please?
Seems I will need to update config/database.ts to match the Postgres env. variables
https://frankiefab.vercel.app/projects
Here is the page where the strapi content should display.
I already create config/env/production/database.ts:
module.exports = ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('PGHOST', '127.0.0.1'),
port: env.int('PGPORT', 5931),
database: env('PGDATABASE', 'railway'),
user: env('PGUSER', 'postgres'),
password: env('PGPASSWORD', 'password'),
ssl: env.bool(true),
},
},
});a year ago
nope, i aleady set the needed variables, please look at the changes i made in your activity tab
a year ago
this page is not makeing an api request to strapi to begin with
When the STRAPI_URL is already updated in the client side fetch request
a year ago
have you logged into your strapi /admin pannel and made sure the needed data is there?
a year ago
i'm sorry but i can't help with deleted data
I just run strapi locally via localhost:1337/admin. I see the contents.
a year ago
when you develop locally, are you connecting to the postgres database on railway?
a year ago
then of course there isnt going to be any data when you deploy to railway
This too. After updating config/database.ts to connect to Postgres on railway

a year ago
you need to use the public host and port when connecting to the database locally
Port is 5432, Host is my strapi server.railway.app??
a year ago
Neither of those are the public host or port, you can find the public host and port of your database under its public networking section
This. But on railway the Postgres port is 5432 and Public host points to DATABASEPUBLICURL which is different too. Sorry, this can be confusing. Do I need to update the Postgres variables again since the Strapi variables references it.

a year ago
that is the public domain of your app, please look at the public networking section of the database, and please do not modify any variables on railway again as I have set them how they need to be
a year ago
you need to use the TCP proxy
a year ago
yes
a year ago
postgres does not use WebSockets
a year ago
connect to the database with [viaduct.proxy.rlwy.net:17157](viaduct.proxy.rlwy.net:17157)
a year ago
it does, the data tab can connect to it, and the data tab uses that host and port
You mean it now works as the STRAPI URL? Nothing still shows up.here
a year ago
when you develop locally you need to have strapi connect to the database on railway
Any helpful resources. What needs to be updated in config/database or config/server
a year ago
this is why the community has recommended you the template -
please read its overview and look at how its setup -
a year ago
going to mark this as solved now that you have all the resources you need to succeed now!
a year ago
!s
Status changed to Solved brody • about 1 year ago


