2 months ago
I have a Bun static site that I'm trying to use on Railway. I was able to get it to detect how to build Bun by adding 'bun run build' start command in the UI, but not able to get it to host the static site for me. AI seems to think it will automatically detect it, but it isn't. Do I need to setup a dockerfile to run Caddy to host these, or can Railway do this for me?
24 Replies
I tried adding a public Railway subdomain, but no luck. Getting an error message
Attachments
2 months ago
Did you map the port correctly?
2 months ago
Make sure the port your site is hosted on is the same port your URL is mapped to.
2 months ago
Well this depends on what port Bun is using to host the site.
2 months ago
You have to set the PORT env variable to match
2 months ago
Lemme find docs
2 months ago
-# That's if Bun uses PORT no?
2 months ago
2 months ago
You'll need some kind of proxy (eg, Nginx) to forward traffic to the site if nothing's hosting your site right now.
How can I configure Caddy or Nginx to do this? I tried using Caddy template, but I couldn't figure out how to feed the build to Caddy
2 months ago
Oh alright in that case you might need to setup a proxy like caddy or nginx to actually serve the content.
2 months ago
Well, one way is to use a Dockerfile.
2 months ago
Alternatively
2 months ago
2 months ago
You could use a package like this or the bun server to serve your dist folder
2 months ago
That too.
There are lots of ways to host a static site.
2 months ago
2 months ago
Good choice!
Status changed to Open medim • about 2 months ago
Status changed to Solved brody • about 1 month ago