How do you deploy multiple environment in fly.io like dev, staging and production
I have application built with WASP v15 and deployed to fly.io and I want to have two environment like staging and production
2 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 multiple environments like staging and production for your Wasp v15 application on Fly.io, you can use the Wasp CLI's deployment features along with some Fly.io-specific configurations. Here's how you can approach this:
1. Use different app names for each environment:
You can create separate apps for staging and production by using different app names when deploying. For example:
This will create separate apps for staging and production Deploying (https://wasp-lang.dev/docs/advanced/deployment/cli#deploying).
2. Use environment-specific configuration files:
After running the
setup
command, Wasp creates fly-server.toml
and fly-client.toml
files in your project root. You can maintain separate configuration files for each environment by using the --fly-toml-dir
option:
This allows you to have different configurations for each environment Setup (https://wasp-lang.dev/docs/advanced/deployment/cli#setup).
3. Set environment-specific variables:
You can set different environment variables for each deployment using the secrets set
command:
This allows you to have different configurations for staging and production Fly.io Regions (https://wasp-lang.dev/docs/advanced/deployment/cli#flyio-regions).
4. Deploy to each environment:
When you're ready to deploy, you can use the deploy
command with the appropriate configuration:
Remember to manage your environment variables carefully, especially for production. You should never store secrets in client-side environment variables Defining Env Vars in Production (https://wasp-lang.dev/docs/project/env-vars#defining-env-vars-in-production).
By following these steps, you can maintain separate staging and production environments for your Wasp application on Fly.io. Each environment will have its own configuration, allowing you to test changes in staging before deploying to production.
----------------------
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?--fly-toml-dir
looks like a good option to explore, have you tried doing what the bot suggested?