W
Wasp12h ago
Ramon

Deploying a Wasp app to a VPS

Hey! I'm trying to deploy the Wasp backend app on Hetzner using Caddy, following these guidelines https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe. However, my reverse proxy doesn’t seem to be working. I checked with netstat inside the Docker container, and it looks like no ports are being exposed. Do you have any idea what might be going wrong?
3 Replies
kapa.ai
kapa.ai12h ago
Hi @Ramon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources, here are some key points and possible reasons why your reverse proxy (Caddy) isn’t working with your Wasp app on Hetzner: 1. Docker Container Ports Must Be Exposed - If netstat inside your Docker container shows no ports being exposed, it likely means your Docker container was not started with the correct -p (publish) or --expose flags. You need to map the internal ports (e.g., 3000 for client, 3001 for server) to the host so Caddy can access them. For example:
docker run -p 3000:3000 -p 3001:3001 ...

docker run -p 3000:3000 -p 3001:3001 ...

- If you don’t expose the ports, services inside the container won’t be reachable from outside, including by your reverse proxy. 2. Wasp Default Ports - By default, Wasp runs the client on port 3000 and the server on port 3001. If these are not available or you want to use different ports, you need to configure them both in your Docker setup and in your environment variables. There are discussions and examples about changing these ports and the required environment variables in the knowledge sources. For example, you can set the PORT environment variable for the server and REACT_APP_API_URL for the client to point to the correct backend URL. Make sure these are set correctly in your Docker environment and Caddy config as well Make it easy to use different ports (than 3000 and 3001) during Wasp development. 3. Reverse Proxy Configuration - If Caddy is running on the host, it needs to proxy requests to the correct host and port where your Wasp app is running. If the Docker container’s ports are not published to the host, Caddy cannot reach them. 4. Docker Compose - If you are using Docker Compose, ensure your docker-compose.yml exposes the necessary ports and that your Caddy service is configured to proxy to the correct internal Docker network addresses. There is a mention that a typical setup would include a PostgreSQL container, server container, client container, and an optional reverse proxy like Caddy or Nginx Deployment to bare metal. Summary of what to check: - Ensure you are exposing the necessary ports when running your Docker containers. - Double-check your Caddy configuration to make sure it proxies to the correct host:port. - Make sure your environment variables inside the containers are set to match the ports you are using. If you provide your Docker run or compose commands and your Caddyfile, I can help you debug further. But based on your description, the most likely issue is that the Docker container ports are not being published to the host, so Caddy cannot reach your Wasp app. Let me know if you need more specific help with your Docker or Caddy configuration! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Ramon, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Ramon
RamonOP11h ago
sudo tee /etc/caddy/Caddyfile > /dev/null <<EOF api.mysaas.com { reverse_proxy 127.0.0.1:3001 } EOF sudo caddy validate --config /etc/caddy/Caddyfile sudo systemctl reload caddy PORT=3001
docker run -d \ --name mysaas \ -p ${{ vars.PORT }}:${{ vars.PORT }} \ --restart unless-stopped \ -v /var/log/mysaas:/var/log \ -v /var/mysaas/uploads:/var/mysaas/uploads \ -e DATABASE_URL="${{ secrets.DATABASE_URL }}" \ -e WASP_WEB_CLIENT_URL="${{ vars.WASP_WEB_CLIENT_URL }}" \ -e WASP_SERVER_URL="${{ vars.WASP_SERVER_URL }}" \ -e JWT_SECRET="${{ secrets.JWT_SECRET }}" \ -e PORT="${{ vars.PORT }}" \ -e SMTP_HOST="${{ vars.SMTP_HOST }}" \ -e SMTP_USERNAME="${{ secrets.SMTP_USERNAME }}" \ -e SMTP_PASSWORD="${{ secrets.SMTP_PASSWORD }}" \ -e SMTP_PORT="${{ vars.SMTP_PORT }}" \ -e GOOGLE_CLIENT_ID="${{ secrets.GOOGLE_CLIENT_ID }}" \ -e GOOGLE_CLIENT_SECRET="${{ secrets.GOOGLE_CLIENT_SECRET }}" \ mysaas @kapa.ai
kapa.ai
kapa.ai11h ago
Let me check the knowledge base for you again. One moment! :books: Sorry @Ramon, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?

Did you find this page helpful?