I am trying to deploy monorepo with shared packages but two unique services in my railway project
zavien1
PROOP

a year ago

I am trying to deploy my project. I have a scraper service and a crud api service inside a monorepo both of these services used a shared package at the root level of the monorepo

I want to deploy the scraper service and api service separately. Right now my setup is to have a dockerfile and railway toml in each file but then the dockerfile doesnt have context of the shared packages

47 Replies

zavien1
PROOP

a year ago

ae620a01-d3a8-4dca-a2b5-93af7c8cd912


zavien1
PROOP

a year ago

Not sure what the right setup should look like, I also am doing deploys manually from dockerfile and not from repo


zavien1
PROOP

a year ago

Not sure what best setup is but reason I was using dockerfile was to install chromium for scraper service in docker and some other necessary stuff


zavien1
PROOP

a year ago

in both services, I have a deploy command I'd like to work

"deploy": "railway up --service scraper"



medim
MODERATOR

a year ago

did u take a look at this?


zavien1
PROOP

a year ago

I did


zavien1
PROOP

a year ago

I'm not sure if I'm structuring project correctly


zavien1
PROOP

a year ago

I have one project, and multiple services


zavien1
PROOP

a year ago

where the project should be built im assuming each app should have their own builds and start commands


zavien1
PROOP

a year ago

I deployed the api just fine but now that I've made the scraper service im not sure how to structure dockerfile and railway.toml


zavien1
PROOP

a year ago

my assumption was that api & scraper have their own dockerfile and railway.toml but then the dockerfile doesnt have scope of the shared packages


zavien1
PROOP

a year ago

but if I have a root directory dockerfile the builds for both services are different


brody
EMPLOYEE

a year ago

why not have multiple dockerfiles at the root?


zavien1
PROOP

a year ago

I just realized I could do that


zavien1
PROOP

a year ago

so then would the railway.toml exist at the app level?


zavien1
PROOP

a year ago

so say apps/scraper has a railway.toml
```[build]
builder = "DOCKERFILE"
dockerfilePath = "../../Dockerfile.scraper"

[deploy]
startCommand = "yarn prod"
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3

[service]
port = 3100
autoDeploy = true ```


brody
EMPLOYEE

a year ago

someone has been using AI to write this


zavien1
PROOP

a year ago

yeah


brody
EMPLOYEE

a year ago

but yeah then you just set the railway.toml's location in the service settings


zavien1
PROOP

a year ago

what gives it away


zavien1
PROOP

a year ago

is the syntax old?


brody
EMPLOYEE

a year ago

just this part -

[service]
port = 3100
autoDeploy = true 

brody
EMPLOYEE

a year ago

it may be valid toml, but its not close to anything we support in that file


zavien1
PROOP

a year ago

one more question

~ railway up --help
Upload and deploy project from the current directory

Usage: railway up [OPTIONS] [PATH]

what is path


zavien1
PROOP

a year ago

path to what


brody
EMPLOYEE

a year ago

the path to the files you want to upload


zavien1
PROOP

a year ago

So if I wanted to deploy apps/scraper which has a railway.toml

and railway.toml references a dockerfile that is at the root of the monorepo

where would I need to call railway up from?


brody
EMPLOYEE

a year ago

why are you calling railway up?


brody
EMPLOYEE

a year ago

arent you deploying from github?


zavien1
PROOP

a year ago

no I am not


zavien1
PROOP

a year ago

I deploy manually right now


brody
EMPLOYEE

a year ago

then you run railway up from the root of your project


zavien1
PROOP

a year ago

gotcha, then how does railway up now which docker file to call? or railway.toml to call


brody
EMPLOYEE

a year ago

railway up just uploads the code, after that its up to what is defined in the service settings, the railway.toml file is set in the service settings, and the railway.toml file defines the location of the dockerfile


zavien1
PROOP

a year ago

gotcha


zavien1
PROOP

a year ago

I understand it now


zavien1
PROOP

a year ago

okay thank you


zavien1
PROOP

a year ago

you are the man brody


zavien1
PROOP

a year ago

that took me way too long to figure out


brody
EMPLOYEE

a year ago

do you have it working now?


zavien1
PROOP

a year ago

yes


brody
EMPLOYEE

a year ago

awsome!


zavien1
PROOP

a year ago

.railwayignore will not upload files that are defined in there right?


brody
EMPLOYEE

a year ago

correct


zavien1
PROOP

a year ago

@Brody is it possible to have different railwayignore files


brody
EMPLOYEE

a year ago

nope, the cli does not provide that functionality


Loading...