R
Railway

✋|help

Bun with turborepo support

Ddivmode9/18/2023
Hey guys,

Just switched over to bun from fastify but having some trouble setting it up properly to work with railway.

Im using turborepo and I just want railway to build the elysia app and I added the nixpacks.toml to root. The nextjs app itself is using vercel.

Here is the github repo: https://github.com/DivMode/turbo-test

railway server: 4392cf24-3b39-4f8b-a38b-2a47273c234b
[phases.setup]
nixpkgsArchive = 'd68b3b0c914aea10eee7cf2e59ef44e39bc221c9' # https://github.com/NixOS/nixpkgs/commit/d68b3b0c914aea10eee7cf2e59ef44e39bc221c9

[phases.build]
cmds = []

[start]
cmds = ["pnpm run start --filter server"]
Bbrody1929/18/2023
for starters, it looks like you are missing a bun lock file, bun won't be automatically detected without a bun lock file
Ddivmode9/18/2023
I added the bun.lockb file to root and tried it inside the server but no luck with getting it to work
Bbrody1929/18/2023
you have yet to tell us what isn't working
Ddivmode9/18/2023
"server:start: sh: 1: bun: not found"
it also trys to start the nextjs app but I do have in the nixfile
[start]
cmds = ["pnpm run start --filter server"]
Bbrody1929/18/2023
ah gotcha, you still have a pnpm lock file, so node is still being detected
Ddivmode9/18/2023
-----
> [stage-0 6/9] RUN --mount=type=cache,id=s/4392cf24-3b39-4f8b-a38b-2a47273c234b-/root/bun,target=/root/.bun npm install -g corepack && corepack enable:
0.340 /bin/bash: line 1: npm: command not found
-----
 
Dockerfile:20
-------------------
18 |     ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
19 |     COPY . /app/.
20 | >>> RUN --mount=type=cache,id=s/4392cf24-3b39-4f8b-a38b-2a47273c234b-/root/bun,target=/root/.bun npm install -g corepack && corepack enable
21 |     RUN --mount=type=cache,id=s/4392cf24-3b39-4f8b-a38b-2a47273c234b-/root/bun,target=/root/.bun bun i --no-save
22 |
-------------------
 
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm install -g corepack && corepack enable" did not complete successfully: exit code: 127
 
Error: Docker build failed

Getting this after removing the lockfile but is there a way I can have bo the the pnpm lockfile and use bun?
Bbrody1929/18/2023
you want to use pnpm instead of buns package manager? I'm sorry but I don't see the point in that?
what is your usecase for using bun in the first place?
Ddivmode9/18/2023
esm and commonjs compatability, was having some trouble with it in fastify, I just want to use bun with elysia as the backend on railway and nextjs app in the frontend with vercel
Bbrody1929/18/2023
then the backend being part of the turbo repo is probably only hindering the deployable of this repo
Ddivmode9/18/2023
I was hoping to keep everything inside the monorepo. Im assuming that isnt possible at this time?
Bbrody1929/18/2023
you can still do a monorepo, but an isolated monorepo would probably work much better for this type of thing
Ddivmode9/18/2023
Would love to get it working with turborepo on railway as it simplifies things for me but I guess support for bun isnt really there yet.
Bbrody1929/18/2023
to be honest I don't think you will ever be able to just no config deploy this repo how you have it now with pnpm mixed in with bun, that's why I suggested an isolated monorepo
Ddivmode9/18/2023
I guess your right, one thing I really liked about the monorepo approach was I could easily share the database schemas and types between frontend and backend.
Bbrody1929/18/2023
yeah but you are mixing technologies
Nngeloxyz9/18/2023
Yea, @divmode - sans addtl. Railway features, there wouldn't be a way for us to automatically detect it as you are still pinning some deps via pnpm and cJS. Unless you are giving us a custom build script that you have yourself to rectify the difference, you will need to beat Nixpacks into shape or use a Dockerfile
Bbrody1929/18/2023
beautifully said
Ddivmode9/18/2023
Using a dockerfile to try and get this to work sounds interesting, ill take a look into it, appreciate your guys input

Looking for more? Join the community!

Recommended Posts
How does pro plan upgrade works for application? particularly Spring boot app...Hi all, I find it difficult to understand how pro plan upgrade works. I upgraded my Spring boot app Deploying Rust tries to copy binaries that don't exist.I'm not using my own nixpacks.toml, and railway is attempting to copy binaries that it doesn't need Cron skipingSo my Cron Schedule keeps skipping every time?Request to free up custom domainMy project id : 5df73bd5-7d04-40dd-9e57-97f1cdd89a60 Can u pls delete the given custom domain, it sPR PreviewsHi everyone. Is it possible to setup PR previews with it's own set of environment variables?Looking for way to run LibreTranslate as a service on railwayI'm looking for a way to run https://libretranslate.com on my railway instance. Ideally it would beRTT to nearby datacenter has gone way up in the past few daysRegions have been amazing and are super helpful for our use case. We host our database in AWS us-easPublishing .net 7 app - project file not foundHi, I'm new in railway and i'm faced with file structure problem. I heared that way to publish is sIssue with staging: The value needs to be expressed as a valid JSON string.i'm trying to make a dev and product env's, but now i created a service on the dev env and trying toIssue with staging: The value needs to be expressed as a valid JSON string.i'm trying to make a dev and product env's, but now i created a service on the dev env and trying toUse Volume with grafana will permission deniedI was configed volume and data path, but when i start my grafana, it will crash. This is log: Error:if i disconect an account of github ?whats going on with the repository are linking with this account ? fb928ae2-62f0-4f8f-be68-9f7902efCommunication between projects without requestsHey everyone, a question. Is it possible to establish communication between projects? For example, Ihow to setup webhooks?Hey guys I'm looking for how to setup a deploy webhook similar to vercel for my website with sanity.Template services in forked environment not deployingHi! When I create a new environment from the base one the two services, that I created from a templaHow can I update the file permissions inside a railway development instance?I receive this error: "PermissionError: [Errno 13] Permission denied: './src/engines/komodo-14/LinudockerIs it possible to use commands or access through a terminal a docker image? I have a Docker image ofDeployment failingI am trying to deploy some updates to my app and I am getting errors during the build process. DockPayload CMS app 500 errorURL: https://edit.gravybo.at/ ID: 9c654a5e-96b8-42bd-a2a0-d82a9e0b8d11 App builds/runs locally, howConfiguring Redis TemplateHi, I was wondering how we can configure the new Redis from the templates. In particular setting the