Turbo Repo Static Site

We have a vite frontend and nextjs backend in a turborepo monorepo. We can easily get the api working by running the build command with filter, same with start. However, with the vite frontend, i'm having difficulty figuring out how to get nixpack's staticfile stuff working. Because it's not an isolated monorepo, i can't change the root directory. But I can't seem to figure out how to specify that it should detect static files since the build command will output files in the app subfolder. It seems to want to use npx turbo run start as the start command, which is wrong. Any suggestions on how to configure an app in turborepo to be a staticfile app in railway?
16 Replies
Percy
Percy11mo ago
Project ID: 54205b43-ca6b-4c89-a842-83e476b6541c
Brody
Brody11mo ago
this is a pr i did for a user that used npm workspaces instead of turbo, it uses caddy to serve the frontend, hopefully you can get an idea of whats going on and modify to work with turbo https://github.com/4vinn/cypher-code-editor/pull/1
LordZardeck
LordZardeckOP11mo ago
is there no way to configure it to use the staticfile provider in nixpack? I'd prefer to just use the NGINX setup rather than some other static file server my thought was something like this:
providers = ["staticfile"]

[start]
onlyIncludeFiles = ['./apps/web/dist']
providers = ["staticfile"]

[start]
onlyIncludeFiles = ['./apps/web/dist']
but the problem i'm having right now is having multiple nixpacks in my monorepo and getting railway to use the right one
Brody
Brody11mo ago
dont know never tried it because i know you cant configure it to serve single page apps correctly
LordZardeck
LordZardeckOP11mo ago
oh wait really?
Brody
Brody11mo ago
yeah the nginx config is hardcoded into the staticfile provider unlike the php provider where you can provide your own nginx.conf file railway isn't designed with serving frontend apps in mind, so trust me, caddy is going to be your best bet
LordZardeck
LordZardeckOP11mo ago
seems like long-term getting a docker container with nginx configured is the right choice
Brody
Brody11mo ago
may I ask why you are opposed to caddy? caddy would do just as good as nginx, and in my opinion is far more user friendly
LordZardeck
LordZardeckOP11mo ago
Don’t have the time to really vet another new piece of tech
Brody
Brody11mo ago
caddy? or my proposed solution to using caddy on railway?
LordZardeck
LordZardeckOP11mo ago
Caddy
Brody
Brody11mo ago
fair enough, reputation doesn't cut it I take it?
LordZardeck
LordZardeckOP11mo ago
We are already scrambling to fix crap cause by trying to use fancy new things ( looking at you Vercel 🤬 ) Rep can be a factor for sure But not looking to add yet one more thing no one on the team has any experience with Rep is why we are on railway to be fair
Brody
Brody11mo ago
makes sense, then nginx is the way to go, I'm sure you can implement it in some similar manner to how I have shown with caddy, but I've never used nginx extensively on railway so I'm noy much help there
LordZardeck
LordZardeckOP11mo ago
Thanks for the input. I’m sure we’ll look into caddy at some point when things aren’t on fire Our team does love learning about new technologies. Just don’t have the bandwidth for more right now lol
Brody
Brody11mo ago
for sure, I get ya best of luck and if you have any more questions about the platform you know where to ask!
Want results from more Discord servers?
Add your server