W
Wasp3mo ago
neogeofun

Thank You and Some Deployment Questions For All

Thanks for developing this tool, I have enjoyed using it for building an MVP. Now that I am close to release, however, I'd like to hear thoughts about deployment. Certainly, I would like to have an automated CI setup. I would like to be able to deploy to GitHub and see changes online without much friction. What would be a nice setup for this? Another question is about server providers. What about Hetzner, Fly.io, vs. Digital Ocean droplets? It seems like Hetzner and DO are both cheap and reliable alternatives. What would be a nice tooling with these services considering CI? Finally, I'll certainly get a CDN and DDOS protection layer. Cloudflare looks very attractive for this purpose. Thoughts? Also, there is something called Cloudflare Pages, how does it sound compared to the earlier services I mentioned? Feel free to chime in even if you are not a maintainer of Wasp. I think everyone would benefit from this discussion.
16 Replies
MEE6
MEE63mo ago
Wohooo @neogeofun, you just became a Waspeteer level 6!
kapa.ai
kapa.ai3mo ago
Hi @neogeofun. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm glad to hear that you've enjoyed using Wasp for building your MVP. Let's address your questions one by one. 1. Automated CI setup: There's an open issue on the Wasp GitHub repository about implementing a Wasp Github CI Action that builds your Wasp app. This could be a good starting point for setting up an automated CI setup. You can track the progress of this feature here (https://github.com/wasp-lang/wasp/issues/602). 2. Server Providers: Wasp currently supports automated deployment to Fly.io via the Wasp CLI. Fly.io offers free allowances for up to 3 VMs, making it a cost-effective choice. You can deploy your full-stack application with a single command using the Wasp CLI. Here's how you can do it:
wasp deploy fly launch my-wasp-app mia
wasp deploy fly launch my-wasp-app mia
This command deploys your app to the Miami, Florida (US) region. You can read more about deploying with the Wasp CLI here (https://wasp-lang.dev/docs/advanced/deployment/cli#deploying). As for Hetzner and Digital Ocean, while they are not directly supported for automated deployment via the Wasp CLI, you can still manually deploy your Wasp apps to these providers. Wasp apps are full-stack apps that consist of a Node.js server, a static client, and a PostgreSQL database. You can deploy each part anywhere where you can usually deploy Node.js apps or static apps. You can read more about manual deployment here (https://wasp-lang.dev/docs/advanced/deployment/overview). 3. CDN and DDOS protection: Cloudflare is indeed a popular choice for CDN and DDOS protection. There's an open issue on the Wasp GitHub repository about moving Wasp docs from Github Pages to Cloudflare Pages. This indicates that the Wasp team is considering using Cloudflare Pages, which could be a good fit for your needs. You can track the progress of this feature here (https://github.com/wasp-lang/wasp/issues/1929). Remember, the choice of deployment tools and services largely depends on your specific needs and constraints. It's always a good idea to explore different options and choose the one that best fits your project. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @neogeofun, 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?
VS
VS3mo ago
@neogeofun Let me know what you figure out as well!
Vinny (@Wasp)
Vinny (@Wasp)3mo ago
@neogeofun the bot did a pretty good job with suggestions. We've already created a github deploy action for you, that you can use here: https://github.com/wasp-lang/deploy-action Put that in your .github folder and follow the instructions in the readme, then everytime you push changes to main it will redeploy to fly.io. Hence, we suggest using Fly.io as that's the only hosting provider we support with one command deploys for now. More will definitely come in the future though
GitHub
GitHub - wasp-lang/deploy-action: Github Action to deploy with Wasp...
Github Action to deploy with Wasp to Fly.io. Contribute to wasp-lang/deploy-action development by creating an account on GitHub.
VS
VS3mo ago
Hey Vinny, wasp is great, fanboy here (especially when mobile auth works!) I know you have an issue about setting up a guide about migrations, here is what I've learned, and can you fact check something? 1. If there is a breaking change that requires you to destroy your migrations, you will have to destroy your entire app. It is not enough to destroy the database because it is linked (passwords) with the server and client. fly apps destroy my-wasp-app-server fly apps destroy my-wasp-app-client fly apps destroy my-wasp-app-db 2. If I change my database schema and push to prod to my website, the website/database would take over the new schema.prisma, right? A slightly altered schema.prisma is okay correct? (This seems not the case though, as I pushed to prod and still the old schema.prisma is being used) 3. In Fly, one should modify the server autoscale to 0 does not occur 4. Upgrade the IP to be a dedicated IP (for server and for client or just for server?) 5. https://uptimerobot.com/ is a good tool to monitor uptime 6. env.server is NOT propogated to fly, all secrets including sendgrid and so must be manually set to the fly server. 7. there is a good Github action, but one could also call wasp deploy fly deploy Sounds about right?
miho
miho3mo ago
@neogeofun we have multiple different tools for deployment: - Wasp CLI supports deploying to Fly.io directly - you can use the Github action which uses the Wasp CLI to redeploy on push - you can use the Caprover action if you want to use Caprover on your VPS: https://github.com/wasp-lang/deploy-to-caprover-action - you can follow this guide for a generic VPS deployment: https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe - you can check out this repo to see how we deployed to Render.com + Cloudflare Pages: https://github.com/wasp-lang/render-ghcr/pull/1
Finally, I'll certainly get a CDN and DDOS protection layer. Cloudflare looks very attractive for this purpose. Thoughts? Also, there is something called Cloudflare Pages, how does it sound compared to the earlier services I mentioned?
Cloudflare is a great addon 👍 I always use it. I mention it in the VPS guide linked above. @Adam
If there is a breaking change that requires you to destroy your migrations, you will have to destroy your entire app.
Hmm, the point of migrations is usually to do them in a way which preserves the production DB. Sometimes you'll need to manually intervene with custom SQL to make sure things are working correctly or make a dump of our production data which can then reapply to a new DB structure (this should be an extreme case)
It is not enough to destroy the database because it is linked (passwords) with the server and client.
Server connects to the DB via env vars and that's the only connection. The server app and the client app don't need to be destroyed if you are doing something with the DB app.
If I change my database schema and push to prod to my website, the website/database would take over the new schema.prisma, right? A slightly altered schema.prisma is okay correct? (This seems not the case though, as I pushed to prod and still the old schema.prisma is being used)
Yep! Small changes with each migrations are the exact point of migrations. It should just apply the changes. If there is something wrong - you'll see in the server logs.
In Fly, one should modify the server autoscale to 0 does not occur
If you don't want the server app to "go to sleep", make sure the minimum instance count is 1.
Upgrade the IP to be a dedicated IP (for server and for client or just for server?)
If you are having some issues with being flagged a spam website (this happened to opensaas.sh due to a shared IP) - do this. Otherwise, there is no need. @Adam cntd
https://uptimerobot.com/ is a good tool to monitor uptime
We use it, works great.
env.server is NOT propogated to fly, all secrets including sendgrid and so must be manually set to the fly server.
Yes, we have a section about how env vars work here: https://wasp-lang.dev/docs/project/env-vars
there is a good Github action, but one could also call wasp deploy fly deploy
Yep, deploying with the Wasp CLI directly is a common thing to do 🙂
VS
VS3mo ago
Thanks for this -- I'll hook up Cloudflare. I dont know why, but my schema.prisma wasnt taken up until I deployed a second time. Ok, for others as well that need a little guide, use fromEmail = '[email protected]'; if using sendgrid. I'll summarize what I've learned and what to keep track of and I'll make a fork of the deployment cli.md
neogeofun
neogeofunOP3mo ago
Great thanks, let me read these guides and make a final decision. What would you suggest about value of these services? Let's say I expect no more than 1000 visitors a day and I don't have compute and memory heavy processes (no image processing etc.). Also, I have seen some discussions about Fly.io DDOS protection, any experience with this? If they provide close to Cloudflare DDOS protection that's one less hop and one less thing to set up.
Killshot
Killshot3mo ago
Hey, Were you able to do this via cloudflare?
VS
VS3mo ago
Hey, partially but not all the way, I focused on some other things, were you having problems? @neogeofun I think Fly and Vercel and so on are new to the DDOS world, I think it would suffice, but I would do Cloudflare just to be on the safe side.
NEROX
NEROX3mo ago
As far as I know you can change the Nameservers to CloudFlare's and that's it (at least the last time I did it), it automatically detects and imports the DNS Records. After that you can enable or disable the feature you need through the Cloudflare panel. Edit: In my case I have the domain in Hostinger but deployed the app in Fly, later I will change the domain nameservers (I will replace Hostinger's with Cloudflare's) and I will work from there.
Killshot
Killshot3mo ago
i seem to be having some nginx error, and as i am not using caddy as mentioned in the guide by @miho i don't know where i am messing up and even Ai isn't much helpful. yeah can't get it to work via nginx and cloudflare.
martinsos
martinsos3mo ago
@miho is our expert for stuff like this but he is out this week, will probalby be able to respond on Monday. There are a couple convos here in #🙋questions thougha bout setting up nginx for Wasp so maybe one of those can offer useful information.
Killshot
Killshot3mo ago
yeah i did went through them, but somehow didn't help, but no worries i am working on it and if i find something relevant. i will update here and on all relevant threads.
miho
miho3mo ago
Move to using Caddy? 😂 Let me know if there is something I can help with - Nginx or otherwise.
Killshot
Killshot3mo ago
i already have a few containers working with nginx so i am kinda biased 😅 But yeah finally got it working with nginx
Want results from more Discord servers?
Add your server