Fly.io's WASP_SERVER_URL and WASP_WEB_CLIENT_URL
I'm setting up fly.io to deploy my application, and I need to setup the secrets WASP_SERVER_URL and WASP_WEB_CLIENT_URL. Where do I get those from? I thought they were provided by Fly.io, or do I have to setup domain names somewhere?
11 Replies
Hi @Kynetix. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The values for
You determine these URLs based on where your server and client are deployed. If you use Fly.io's default domains, use those. If you set up custom domains, use your custom domains. You must set these values yourself as secrets in your Fly.io app configuration. Fly.io does not automatically provide them for you. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Kynetix, 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?
WASP_SERVER_URL
and WASP_WEB_CLIENT_URL
are not automatically provided by Fly.io—you need to set them yourself based on where your server and client are deployed.
- WASP_SERVER_URL: This should be the URL where your Wasp server (backend) is accessible. If you deploy your server to Fly.io and use the default Fly.io domain, it will look like <https://<your-app-name>-server.fly.dev
.> If you set up a custom domain, use that instead. You set this value as a Fly secret using:
or, if using the Wasp CLI:
Defining Env Vars in Production, Manual Fly.io Setup
- WASP_WEB_CLIENT_URL: This should be the URL where your client (frontend) is accessible. If you deploy your client to Fly.io, it will be something like <https://<your-app-name>-client.fly.dev
.> If you use a custom domain or another hosting provider (like Netlify), use that URL. Set it as a Fly secret:
or, with the Wasp CLI:
Manual Fly.io Setup, Using a Custom Domain
Summary:You determine these URLs based on where your server and client are deployed. If you use Fly.io's default domains, use those. If you set up custom domains, use your custom domains. You must set these values yourself as secrets in your Fly.io app configuration. Fly.io does not automatically provide them for you. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Kynetix, 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?
@kapa.ai I'm using Fly.io's default domain, which is https://build-hidden-pond-2826.fly.dev/ , so would that be the client & server URLs?
Let me check the knowledge base for you again. One moment! :books:
----------------------
If you are using Fly.io's default domain and your app is deployed as a single app (not split into separate client and server apps), then your URL (e.g.,
- If you have only one Fly.io app and both client and server are served from
<https://build-hidden-pond-2826.fly.dev/
>) would typically be used for both WASP_SERVER_URL
and WASP_WEB_CLIENT_URL
.
However, Wasp's Fly.io deployment usually creates separate apps for the server and client, resulting in different subdomains like:
- <https://<your-app-name>-server.fly.dev
> (for the server)
- <https://<your-app-name>-client.fly.dev
> (for the client)
If you only have one Fly.io app and both your client and server are served from <https://build-hidden-pond-2826.fly.dev/
,> then you would set both environment variables to that URL:
But if you have separate deployments for client and server, you should use their respective URLs. The knowledge sources do not explicitly confirm if a single-app deployment is standard for Wasp on Fly.io, but they do show that by default, Wasp creates separate client and server apps with different URLs (Deploying with the Wasp CLI).
Summary:- If you have only one Fly.io app and both client and server are served from
<https://build-hidden-pond-2826.fly.dev/
,> use that URL for both variables.
- If you have separate client and server apps, use their respective URLs.
If you are unsure, check your Fly.io dashboard to see if you have separate apps for client and server, and use the appropriate URLs accordingly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Kynetix, 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?Hey @Kynetix , you'll need two Fly apps, one for the server and one for the client. The URLs for those apps are respectively WASP_SERVER_URL and WASP_WEB_CLIENT_URL.
But our recommended approach is to use
wasp deploy fly
which already should handle most stuff for you
https://wasp.sh/docs/deployment/deployment-methods/cli#flyioWasp CLI | Wasp
Wasp CLI can deploy your full-stack application with only a single command.
Thanks @Carlos I was following these instructions https://wasp.sh/docs/deployment/deployment-methods/paas#set-up-a-flyio-app which seem a bit different from the one you posted
Platform as a Service (PaaS) | Wasp
This document explains how to build and prepare your Wasp app for deployment.
So if I run "wasp deploy fly" it'll create both apps, assign the secrets, etc? And I should run it from the root, I presume (I don't see that in the instructions)?
Yes! The folder where you have your main.wasp file
@kapa.ai since "wasp deploy fly" is for deploying a new app, is it the same command for deploying changes to the app? I added a couple of secrets in the Fly dashboard, as well as made some code changes. How do I push those changes to Fly?
Let me check the knowledge base for you again. One moment! :books:
----------------------
To deploy changes (such as code updates or new secrets) to your existing Fly.io app, you should not use
wasp deploy fly launch
again. The launch
command is intended for the initial deployment only—it sets up the app, database, and does the first deploy. For subsequent updates, you should use:
This command will push your latest code and configuration changes to your already-deployed app. You can run this command whenever you want to update your deployed app with the latest changes (Deploy command docs).
Summary:
- Use wasp deploy fly launch
only for the first deployment.
- For redeploying after code or secret changes, use wasp deploy fly deploy
(Deploying with the Wasp CLI, Deploy command docs).
You do not need to delete or recreate your app—just run the deploy command to update it.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Kynetix, 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?good bot