a month 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
a month ago
Did you map the port correctly?
a month ago
Make sure the port your site is hosted on is the same port your URL is mapped to.
a month ago
Well this depends on what port Bun is using to host the site.
a month ago
You have to set the PORT env variable to match
a month ago
Lemme find docs
a month ago
-# That's if Bun uses PORT no?
a month ago
a month 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
a month ago
Oh alright in that case you might need to setup a proxy like caddy or nginx to actually serve the content.
a month ago
Well, one way is to use a Dockerfile.
a month ago
Alternatively
a month ago
You could use a package like this or the bun server to serve your dist folder
a month ago
That too.
There are lots of ways to host a static site.
a month ago
a month ago
Good choice!
Status changed to Open medim • about 1 month ago
Status changed to Solved brody • about 1 month ago