R
Railway•12mo ago
infntLoop

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
Percy
Percy•12mo ago
Project ID: N/A
infntLoop
infntLoopOP•12mo ago
7f64daff-585a-4948-99d9-3722f6dfefe5 Project ID: 7f64daff-585a-4948-99d9-3722f6dfefe5 @Percy that wasn't even 5 minutes =)) 🤣
Brody
Brody•12mo ago
what kind of app?
infntLoop
infntLoopOP•12mo ago
@Brody strapi app with postgres
Brody
Brody•12mo ago
are you running strapi in development mode when on railway? (please dont do this)
infntLoop
infntLoopOP•12mo ago
@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
Brody
Brody•12mo ago
did you set the start command to development in the service settings in the development env?
infntLoop
infntLoopOP•12mo ago
No! Searched everywhere for it with no luck And do I need to redeploy once I switch between environments?
Brody
Brody•12mo ago
well strapi will print the mode it was ran in, what mode is it running in on the prod env?
infntLoop
infntLoopOP•12mo ago
Let me check the latest logs Production!
Brody
Brody•12mo ago
well something somewhere has ran and cleared your databases, maybe you ran a force seed somehow?
infntLoop
infntLoopOP•12mo ago
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
infntLoop
infntLoopOP•12mo ago
No description
Brody
Brody•12mo ago
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
infntLoop
infntLoopOP•12mo ago
Let me try something and come back here in the morning. Hopefully will be sorted out, there must be something
Brody
Brody•12mo ago
sounds good
infntLoop
infntLoopOP•12mo ago
Btw what did you mean by service settings? Where can I find it?
Brody
Brody•12mo ago
click the settings tab in your service
infntLoop
infntLoopOP•12mo ago
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
Brody
Brody•12mo ago
the start command will be replicated across all envs just so you know
infntLoop
infntLoopOP•12mo ago
Well noted Not sure if I will go with two environments, will set it up Local -> Github -> Railway
Brody
Brody•12mo ago
that does seen like the safest way to go about this you are at least using postgres right?
infntLoop
infntLoopOP•12mo ago
Yes Once again, thank you
Brody
Brody•12mo ago
no problem!
BlindMonkey
BlindMonkey•12mo ago
Hi there, I'm trying to run Strapi in Develop mode but I keep getting an deployment error, are there any guides showing this?
Brody
Brody•12mo ago
please open your own #✋|help thread
Want results from more Discord servers?
Add your server