a year ago
I succeed in building my project with NodeJS. At least I think so... Is there some way I could check that as a result of the build I get a dist/ directory with the files?
After that I'd like to serve the static files from dist/
directory. I don't really know how to do that. I added the Staticfile provider to the list of providers in my service (after the Node provider) and reran the build, but that seems to make no difference. When I navigate to the URL of my service I just see "Application failed to respond" message.
Perhaps the Staticfile provider doesn't detect the right directory by itself. But the documentation doesn't even hint at any way of configuring this.
One possible issue is that I have a monorepo. I have configured the correct Root directory, which is correctly recognized by the build, but perhaps it's not recognized by Staticfile provider.
I think I'm trying to do something very basic, but perhaps that's not at all the use-case that Railway can handle?
8 Replies
a year ago
This is just a Vite app with react.
https://github.com/brody192/vite-react-template
Copy the nixpacks.toml and Caddyfile into your project.
a year ago
Thanks. I tried this, but nothing really seems to have changed as a result. When I navigate to the URL of the service, I still see 502 Bad Gateway "Application failed to respond".
How should I go about debugging why it's not working? I looked through the config in Caddyfile and nixpacks.toml for something I should modify for the specifics of my app, but saw nothing that I obviously should change.
a year ago
When I look at the deploy log I see the following:
Starting Container
using config from file
adapted config to JSON
admin endpoint disabled
automatic HTTPS is completely disabled for server
started background certificate maintenance
server running
serving initial configuration
cleaning storage unit
finished cleaning storage units
cleaning storage unit
finished cleaning storage units
There seems to be nothing about the Caddy server. Perhaps there should be. No idea, I've never use Caddy before.
a year ago
Thanks for the info. But how do I figure out the right port? And a port of what?
I tried using port 3000, which was specified in Caddyfile. That didn't do the trick.
I also tried the standard HTTP port 80 and HTTPS port 443. No luck again.
a year ago
The port that caddy runs on, you will be given an option and shown that when choosing a port.
a year ago
Ah, thanks a lot. This did the trick.
It now finally works. :) :) :)
Status changed to Solved brody • about 1 year ago