W
Wasp8mo ago
Jeremy_Xie

Deploying a new Module as Separate App to fly.io

I'm using the Open SaaS template. In the client module, I'd like to establish a new module that can be deployed as a separate app to fly.io or other providers. How can I accomplish this?
5 Replies
MEE6
MEE68mo ago
Wohooo @Jeremy_Xie, you just became a Waspeteer level 1!
kapa.ai
kapa.ai8mo ago
Hi @Jeremy_Xie. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To deploy a new module as a separate app to Fly.io, you would need to follow similar steps as deploying your main Wasp app. Here's a general guide based on the information provided in the knowledge sources: 1. Build the App: First, you need to generate the deployable code for your new module. This is done by running the wasp build command in your project directory. This will create a .wasp/build/ directory with the built code. 2. Set Up a Fly.io App: Next, you need to create a new Fly.io app. Navigate to the .wasp/build/ directory and run the flyctl launch --remote-only command. This will set up a new app and create a fly.toml file. During this process, you'll be asked a series of questions, such as choosing a region and whether you'd like a database. 3. Set Environment Variables: After setting up the Fly.io app, you need to set up several environment variables using the flyctl secrets set command. 4. Deploy the App: Finally, you can deploy your new module to Fly.io. While still in the .wasp/build/ directory, run the flyctl deploy --remote-only --config ../../fly.toml command. This will build and deploy your new module on Fly.io. Here are the relevant commands:
# Build the app
wasp build

# Navigate to the build directory
cd .wasp/build/

# Set up a new Fly.io app
flyctl launch --remote-only

# Set environment variables
flyctl secrets set PORT=8080
flyctl secrets set JWT_SECRET=<random_string_at_least_32_characters_long>
flyctl secrets set WASP_WEB_CLIENT_URL=<url_of_where_client_will_be_deployed>
flyctl secrets set WASP_SERVER_URL=<url_of_where_server_will_be_deployed>

# Deploy the app
flyctl deploy --remote-only --config ../../fly.toml
# Build the app
wasp build

# Navigate to the build directory
cd .wasp/build/

# Set up a new Fly.io app
flyctl launch --remote-only

# Set environment variables
flyctl secrets set PORT=8080
flyctl secrets set JWT_SECRET=<random_string_at_least_32_characters_long>
flyctl secrets set WASP_WEB_CLIENT_URL=<url_of_where_client_will_be_deployed>
flyctl secrets set WASP_SERVER_URL=<url_of_where_server_will_be_deployed>

# Deploy the app
flyctl deploy --remote-only --config ../../fly.toml
Please replace <random_string_at_least_32_characters_long>, <url_of_where_client_will_be_deployed>, and <url_of_where_server_will_be_deployed> with your actual values. Remember, your app name must be unique across all of Fly or deployment will fail. Also, you should only run setup once per app. If you run it multiple times, it will create unnecessary apps on Fly. For more detailed instructions, you can refer to the Wasp deployment documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#set-up-a-flyio-app). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Jeremy_Xie, 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?
miho
miho8mo ago
The answer by the bot is not really useful IMHO. First, we need to understand what do you mean by a “module”? Wasp apps are full stack apps with a client and a server bit. If you want a new “client” or “server”, you’d need to create a new Wasp app and deploy it like that. You can do that with wasp new. Let me know if this works for you or this is not what you meant by “module” 🙂
Jeremy_Xie
Jeremy_XieOP8mo ago
Thank you for taking the time to respond. I appreciate the clarification. I will take some time to go through the documentation further and make sure I understand everything correctly. Thank you again for your guidance! 😊
Filip
Filip8mo ago
Hey @Jeremy_Xie, how's it going? Need any help? 🙂
Want results from more Discord servers?
Add your server