Database Resets Every Deployment
Hello .. I have an app with a Postgres in two projects and both in Production Environment. Everytime I deploy new changes through Github, the app gets rebuilt and redeployed succesffuly as expected. but the data gets purged from the DB completely and I get the fresh tables usually created upon build.
I have decided to go with Railway as it is efficient, easy to deploy especially for time-sensitive deliverables.
Any help on this would be extremely appreciated.
26 Replies
Project ID:
N/A
7f64daff-585a-4948-99d9-3722f6dfefe5
Project ID: 7f64daff-585a-4948-99d9-3722f6dfefe5
@Percy that wasn't even 5 minutes =))
🤣
what kind of app?
@Brody strapi app with postgres
are you running strapi in development mode when on railway? (please dont do this)
@Brody I am and here is why:
1- Created the project on production environment
2- Later tried to create a development environment but the postgres kept crashing
3- Changed the start script in package.json to the development start
Ultimately I was hoping to have a branch for development and another one for production where it would only reflect in production once dev branch gets deployed to main. But not sure how to do that in Railway
The fix is stupid I know, but had to come up with something not to hinder the development. Especially that I am making major changes in strapi code itself
did you set the start command to development in the service settings in the development env?
No! Searched everywhere for it with no luck
And do I need to redeploy once I switch between environments?
well strapi will print the mode it was ran in, what mode is it running in on the prod env?
Let me check the latest logs
Production!
well something somewhere has ran and cleared your databases, maybe you ran a force seed somehow?
It was in Development. Latest deployment I switched to Production by changing the start script in package.json
What is the best setup in this case
ive never ran strapi in dev mode on railway, only locally, and this is not the first thread about how someone ran strapi in dev mode on railway and lost their data
not a railway issue, and im sure theres a way you could do it, but id stay away from doing it
Let me try something and come back here in the morning. Hopefully will be sorted out, there must be something
sounds good
Btw what did you mean by service settings? Where can I find it?
click the settings tab in your service
Whaaat.. just found it! Came across this multiple times. The problem is when you get stuck in a problem you zoom in and you lose focus on many things
This should help a lot! Thank you @Brody
the start command will be replicated across all envs just so you know
Well noted
Not sure if I will go with two environments, will set it up Local -> Github -> Railway
that does seen like the safest way to go about this
you are at least using postgres right?
Yes
Once again, thank you
no problem!
Hi there,
I'm trying to run Strapi in Develop mode but I keep getting an deployment error, are there any guides showing this?
please open your own #✋|help thread