7 months ago
I am trying to set up deployments for my apps. My folder structure is like this:
my-workspace/
├── apps/
│ ├── app-1-be/ # NestJS
│ ├── app-1-fe/ # React Vite
│ ├── app-2-be/ # NodeJS
│ └── app-2-fe/ # React Vite app
├── pnpm-workspace.yaml
├── package.json # workspace root
├── pnpm-lock.yamlMy steps for app 1:
Create 2 services.
Connected the Git Repo
Set the root directory to
apps/app-1-beandapps/app-1-ferespectivelySet up a
railway.jsonin theapp-1-befolder like this:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "cd ../.. && pnpm install --force && pnpm run build --filter=app-1-be && cd apps/app-1-be && npx prisma generate && npx prisma migrate deploy"
},
"deploy": {
"startCommand": "pnpm run start:prod",
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}Set up a
railway.jsonin theapp-1-fefolder like this:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "cd ../.. && pnpm install && pnpm run build --filter=app-1-fe"
},
"deploy": {
"startCommand": "pnpm run preview",
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}Project ID: c243ded6-9e79-4752-857d-5b6f31fd8cc2
3 Replies
Errors I am getting:
For the NestJS service, I am not sure why it is using
npm i(I guess because there is no pnpm-lock in the folder rather it is only in the root of the workspace so I don't know how to get around this):
"npm i" did not complete successfully: exit code: 1The error above is dependency issue and can be fixed with --force but it is using npm instead of pnpm and not my railway.json file
For app1 FE (vite react app),
/bin/bash: line 1: pnpm: command not found
7 months ago
This thread as been deleted on Discord and will therefore be closed. Judging by the project's architecture, this is mostly related to the fact that it was configured as an isolated monorepo as opposed to a shared one.
Status changed to Closed uxuz • 7 months ago