Need Help deploying a monorepo
fwedy
TRIALOP

2 years ago

So my project is a React frontend and my backend is Flask.

I understand that I should deploy theses as two different services in railway even thought they are in the same repo (backend and frontend folder)

I'm just unsure as to how to deploy the frontend since it's just a build.

I would like to know the steps needed to make it happen (settings I need to use in both services.)

Thanks in advance.

Solved

7 Replies

2 years ago

Hello,

Are you able to share your repo so I can make suggestions on what needs to be changed?


fwedy
TRIALOP

2 years ago

Hi! Yes, I send you an invite trough GitHub.

I'm wondering if i should just but the dist folder in my backend and only run the backend ?


2 years ago

That's a possibility but I personally don't like that solution.

Will look at the repo.


fwedy
TRIALOP

2 years ago

Yeah, neither do I.

Let me know, i would love your help.


2 years ago

I see a few things wrong with the repo -

Frontend -
- You are commiting your dist folder, please remove that from the repo and make sure it's in your .gitignore

- You are attempting to run a dev server - https://github.com/brody192/vite-react-template - copy the nixpacks.toml and Caddyfile from this repo into your frontend.

Backend -

- Missing a railway.json file -

{
    "$schema": "https://railway.app/railway.schema.json",
    "deploy": {
        "runtime": "V2",
        "numReplicas": 1,
        "startCommand": "gunicorn wsgi:appcontext",
        "sleepApplication": false,
        "restartPolicyType": "ON_FAILURE",
        "restartPolicyMaxRetries": 10
    }
}

Once you have these done, follow this guide - https://docs.railway.app/tutorials/deploying-a-monorepo


fwedy
TRIALOP

2 years ago

Wow! You're a life saver. Thank you so much!

It works so well! Appreciate it


2 years ago

Awsome, I'm happy to help!


Status changed to Solved brody over 1 year ago


Loading...