R
Railwayβ€’15mo ago
FNDEVVE

Railway Strapi

Hi. It's taken me entire day and I think I am getting close. I deployed Strapi with postgres on Railway - everything is okay. First issue was getting that thing to be in development mode so I can add new content-types, I did it by modifying package.json like in this tutorial: https://dev.to/candidosales/deploying-strapi-4-to-railway-589b Everything worked till first "rebuild". DB is wiped, starting from 0. I read about this issue and I really have no idea what to do. Even if I did data transfer from local version like this: https://docs.strapi.io/dev-docs/data-management/transfer there would be schema issues (for example there wouldn't be "post" types created). I have truly no idea what to do.
DEV Community
Deploying Strapi 4 to Railway
Step by step on how to deploy Strapi 4 to Railway
Data transfer | Strapi Documentation
Transfer data using the Strapi CLI
21 Replies
Percy
Percyβ€’15mo ago
Project ID: N/A
FNDEVVE
FNDEVVEOPβ€’15mo ago
7a9a91c1-3dbb-499f-ab6a-50767c5b05d0 I spent last 30 minutes on reading strapi issues/thoughts and one thing that @Brody said made me wonder - if I clone the repo to my own PC and I run it in development mode, make some changes (it should be connected to postgres railway DB) and then i change back to production and push it should work?
Brody
Brodyβ€’15mo ago
thats correct run in development mode locally with railway run strapi develop so that strapi has access to the database credentials from railway. make sure your start script is set to strapi start so when you deploy to railway its run in production mode
FNDEVVE
FNDEVVEOPβ€’15mo ago
i dont get it, i linked railway to project and i cant do anything how do i download it, its weird
FNDEVVE
FNDEVVEOPβ€’15mo ago
No description
FNDEVVE
FNDEVVEOPβ€’15mo ago
Ok, I had to clone repo, run npx railway here and its slowly getting to work i think i will journalize my efforts here - now i will run 'npx railway run strapi develop', add some stuff, then push github and hopefully mt DB doesnt get wiped also updated strapi to 4.13.5 and pgsql to new version with yarn install, pushed and it also worked - miracle now final test, if i add new content on railway in PROD mode will it stay after "rebuild"
ThallesComH
ThallesComHβ€’15mo ago
Also I don't recommend using your production database to develop locally, I recommend using SQLite. Docs: https://docs.strapi.io/dev-docs/configurations/database
Database | Strapi Documentation
Strapi offers a single entry point file to configure its databases.
FNDEVVE
FNDEVVEOPβ€’15mo ago
at this point i just want it to work πŸ˜„ its literally portfolio project because im looking for a front-end job and i coded nice react blog with strapi yoo looks like it works thank u @Brody so much, without all your replies to people aruond i'd never do it it FU**ING WORKS
Brody
Brodyβ€’15mo ago
that's awesome!!
FNDEVVE
FNDEVVEOPβ€’15mo ago
@Brody https://erryf-magazine.vercel.app/ Thank you for making it possible
Brody
Brodyβ€’15mo ago
looks like you have some styling issues to sort out
No description
FNDEVVE
FNDEVVEOPβ€’15mo ago
its not responsive yet it will be, but just wanted it to "be alive" as its my first next.js project ever
Brody
Brodyβ€’15mo ago
pretty damn good for your first next project
FNDEVVE
FNDEVVEOPβ€’15mo ago
after 3 days of fighting strapi making it responsive is the easiest part (note: i was designing simple bootstrap html landing pages for last 7 years and this year i decided to learn real javascript + react)
Brody
Brodyβ€’15mo ago
I still don't know real JavaScript+React
FNDEVVE
FNDEVVEOPβ€’15mo ago
u know how to set up strapi that puts u ahead of 99% πŸ˜„
Brody
Brodyβ€’15mo ago
I've also never used strapi
FNDEVVE
FNDEVVEOPβ€’15mo ago
damn!
Brody
Brodyβ€’15mo ago
I've only read their documentation so that reminds me, do you have pool.min set to 0 in your database.js file?
FNDEVVE
FNDEVVEOPβ€’15mo ago
yes sir thank u for being cautious i copied official strapi railway repo
Brody
Brodyβ€’15mo ago
perfect then I'm glad I put the pool min thing in the template
Want results from more Discord servers?
Add your server