deploy in fly.io with multiple environment
need to deploy client and server even the database for prod and dev or staging
6 Replies
Hi @victor. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To deploy your Wasp app on Fly.io, you can use the Wasp CLI's
setup
command. This command creates your client and server apps on Fly.io and adds some secrets, but it does not deploy them. The command is as follows:
The <app-name>
is the name of your app and <region>
is the region where your app will be deployed. You can find the available regions here (https://wasp-lang.dev/docs/advanced/deployment/cli#flyio-regions).
After running setup
, Wasp creates two new files in your project root directory: fly-server.toml
and fly-client.toml
. You should include these files in your version control. You can edit these files to further configure your Fly deployments.
If you want to maintain multiple apps (for example, for different environments like production, staging, and development), you can add the --fly-toml-dir <abs-path>
option to point to different directories.
Remember to only run setup
once per app. If you run it multiple times, it will create unnecessary apps on Fly.
For deploying the app, you can use the launch
command which runs setup
, create-db
, and deploy
in sequence.
If your app requires any other environment variables, you can set them with the --server-secret
option:
Please refer to the Wasp CLI documentation (https://wasp-lang.dev/docs/advanced/deployment/cli#setup) for more details.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @victor, 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?Hm that is interesting idea by Kapa! Did that work for you @victor ?
Nope that’s not work
What failed?
One solution is always not to use Wasp's
wasp deploy fly deploy
command but instead to deploy manually to Fly or other provider, which will give you needed control to do multiple deployments as you wish.
@miho do you have any ideas here? THis is something we will likely want to support in the future, right? I believe this is related to https://github.com/wasp-lang/wasp/issues/169 and to that RFC about deployment you made some time ago?GitHub
Add deploy notion to Wasp files · Issue #169 · wasp-lang/wasp
Right now deployment of Wasp apps is pretty manual -> you generate code with wasp build and then you have to manually deploy different parts (frontend, backend), the procedure depending on which...
For this - I'd advise going full manual mode smth like having folders for your Fly TOML files and having a Bash script that copies things around and redeploys things using the Fly CLI
@miho might be useful for us to have a recommendation for this in the docs (deplyoting to staging AND production). I think we will want to also have explcit support for it in the future, but in the meantime, a bit of direction in the docs could go a long way.
I linked this here https://github.com/wasp-lang/wasp/issues/2201 also.