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

xih
HOBBY

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

0 Replies

xih
HOBBY

2 days ago

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


xih
HOBBY

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


2 days ago

Hello,

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


xih
HOBBY

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


2 days 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
HOBBY

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


2 days 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
HOBBY

2 days ago

sweet, good to know


xih
HOBBY

2 days ago

thank you


xih
HOBBY

2 days ago

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

this cleared up my mental model a lot!


2 days ago

Awsome!


xih
HOBBY

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


2 days ago

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