Monorepo
tuncay-dev
HOBBYOP

2 years ago

Hi l, I have 3 independant projects in my Git repo which are mapped to 3 different service in a Railway project. I dont want a change to one project build and deploy other projects or services whithen same repo. Is that possible ?

2 Replies

tuncay-dev
HOBBYOP

2 years ago

eb3e87db-2f5c-4c3d-9382-bf66a4bc4e0c


alexbalandi
PRO

2 years ago

Oh, I do this myself. I use "entrypoints" directory in root folder of the project.

I then structure it like this:

├── dev_demo
│   ├── railway.json
│   └── run.py
├── graphs_server
│   ├── railway.json
│   └── run.py
├── __init__.py
├── log_viewer
│   ├── railway.json
│   └── run.py

Each railway.json has config for running its specific thing, usually it just runs the run.py in its folder but you can configure it depending on your needs.

Then when deploying I go to settings -> config as code and put a path to that file, for example entrypoints/dev_demo/railway.json
My config here looks like this:

{
    "$schema": "https://railway.app/railway.schema.json",
    "build": {
      "builder": "DOCKERFILE"
    },
    "deploy": {
      "numReplicas": 1,
      "startCommand": "python -m entrypoints.dev_demo.run",
      "restartPolicyType": "ON_FAILURE",
      "restartPolicyMaxRetries": 3
    }
  }

alexbalandi
PRO

2 years ago

The "run.py" name and some other things with "." got some weird formatting, but the idea should be clear :)


brody
EMPLOYEE

2 years ago

as long as the individual apps don't need to access files from the other apps the correct way would be to set the root directory accordingly in the service settings


Loading...