how to deploy a custom typesense service with a railway.toml file
xih
HOBBYOP

7 months ago

Hi,

I'm trying to call /multisearch on my typesense service. However, with the template deployed from railway's template marketplace, i get a 404 error.

Therefore, I'd like to modify the railway.toml for me to be able to deploy 2 services.

With my current mental model, I think there are 2 approaches:

  1. Add a new service to my railway.toml so that it can deploy to railway? I got a bunch of errors here in the past, so curious if this is possible.

#  readcv-embeddings  —  Railway IaC spec
############################################
[project]
name = "readcv-embeddings"

[build]
builder = "DOCKERFILE"
dockerfilePath = "./Dockerfile"
buildEnvironment = "V2"

############################################
# :two:  FastAPI service
############################################
[services.api]
root          = "."
buildCommand  = "pip install --no-cache-dir uv && uv sync --frozen"
startCommand  = "uv run scripts/supabase_to_typesense.py --create-collection --index-data --test-search && uv run uvicorn main:app --host 0.0.0.0 --port $PORT --log-level debug"
dependsOn     = ["services.typesense"]
healthcheckPath = "/health"
healthcheckTimeout = 2
restartPolicyType = "on-failure"
restartPolicyMaxRetries = 0

[services.migrations]
root = "."
dockerfile = "Dockerfile"
startCommand = "cd services/migrations && uv run python migrate.py"
restartPolicyType = "never"
dependsOn = ["services.typesense", "services.api"]


############################################
# :four:  Testing service
############################################

[services.testing]
root = "services/testing"
buildCommand = "pip install uv && uv sync --frozen"
startCommand = "uv run hi.py"
  1. create a new service from railway's graph interface and link to a a github repo of the cloned typesense template with a few changes. Trying this now

15 Replies

xih
HOBBYOP

7 months ago

0dea74aa-c444-4dd6-a74c-40c939a9a792


xih
HOBBYOP

7 months ago

also, interested in developing better mental modles for complex railway.toml files. If there is an example of multiple services deployed with one railway.toml file , i would be interested in taking a look


7 months ago

Hello,

railway.toml/json files are to configure a single service only, what you showed is not supported syntax as this time.


xih
HOBBYOP

7 months ago

I see, what is the best way to deploy 2 of these services through code instead of GUI?

i have a readcv-api backend service and a typesense service


7 months ago

I think you are thinking in Heroku world, where they encourage you to deploy multiple applications within the same dyno, but on Railway, it is best practice to deploy multiple applications into multiple services.


xih
HOBBYOP

7 months ago

makes sense, so is there a code version for setting up multiple apps into multiple services

how can this be done with a script?
https://docs.railway.com/tutorials/deploying-a-monorepo

or is this the only / best way to do it?


7 months ago

We currently do not have any way to define multiple services in a config-as-code file. Deploying multiple services would be a manual process.


xih
HOBBYOP

7 months ago

sweet, good to know


xih
HOBBYOP

7 months ago

thank you


xih
HOBBYOP

7 months ago

I'll follow the manual guide and let you know if i have more issues

this cleared up my mental model a lot!


7 months ago

Awsome!


xih
HOBBYOP

7 months ago

how do i ensure that TYPESENSE_DATA_DIR="${{RAILWAY_VOLUME_MOUNT_PATH}}" is created?

i'm trying to copy over the typesense template into one of my own folders in my repo and deploying it as a separate service, but it's getting BUILD errors


7 months ago

How do you ensure that the variable or the path gets created?


tavindev
PRO

7 months ago

Are there plans to support this?


7 months ago

Deploying separate applications as separate services is the best practice, so we don't have any plans to support deploying multiple apps into a single service, after all we don't charge per service like how Heroku charges per dyno


Loading...