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

2 years 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

Closed

47 Replies

zavien1
PROOP

2 years ago

ae620a01-d3a8-4dca-a2b5-93af7c8cd912


zavien1
PROOP

2 years ago

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


zavien1
PROOP

2 years 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

2 years ago

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

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



2 years ago

did u take a look at this?


zavien1
PROOP

2 years ago

I did


zavien1
PROOP

2 years ago

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


zavien1
PROOP

2 years ago

I have one project, and multiple services


zavien1
PROOP

2 years ago

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


zavien1
PROOP

2 years 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

2 years 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

2 years ago

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


2 years ago

why not have multiple dockerfiles at the root?


zavien1
PROOP

2 years ago

I just realized I could do that


zavien1
PROOP

2 years ago

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


zavien1
PROOP

2 years ago

so say apps/scraper has a railway.toml

builder = "DOCKERFILE"
dockerfilePath = "../../Dockerfile.scraper"

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

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


2 years ago

someone has been using AI to write this


zavien1
PROOP

2 years ago

yeah


2 years ago

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


zavien1
PROOP

2 years ago

what gives it away


zavien1
PROOP

2 years ago

is the syntax old?


2 years ago

just this part -

[service]
port = 3100
autoDeploy = true 

2 years ago

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


zavien1
PROOP

2 years 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

2 years ago

path to what


2 years ago

the path to the files you want to upload


zavien1
PROOP

2 years 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?


2 years ago

why are you calling railway up?


2 years ago

arent you deploying from github?


zavien1
PROOP

2 years ago

no I am not


zavien1
PROOP

2 years ago

I deploy manually right now


2 years ago

then you run railway up from the root of your project


zavien1
PROOP

2 years ago

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


2 years 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

2 years ago

gotcha


zavien1
PROOP

2 years ago

I understand it now


zavien1
PROOP

2 years ago

okay thank you


zavien1
PROOP

2 years ago

you are the man brody


zavien1
PROOP

2 years ago

that took me way too long to figure out


2 years ago

do you have it working now?


zavien1
PROOP

2 years ago

yes


2 years ago

awsome!


zavien1
PROOP

2 years ago

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


2 years ago

correct


zavien1
PROOP

2 years ago

@Brody is it possible to have different railwayignore files


2 years ago

nope, the cli does not provide that functionality


Welcome!

Sign in to your Railway account to join the conversation.

Loading...