deployment with Digital Ocean

Hello everyone, after more than 5 months i’m near to the deployment of my wasp WebApp. I have chosen Digital Ocean as hosting and i would like to hear if someone have already deployed with this provider. What are the basic steps? I need to install directly PostgreSQL or is better to install Docker and after postgres? And after I need to run something else relevant with digital ocean? Thank for you advice
8 Replies
kapa.ai
kapa.ai3w ago
Hi @DanjelDurmo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hello! While the Wasp documentation doesn't provide a specific guide for deploying on Digital Ocean, the general steps for manual deployment should still apply. Here's a high-level overview of the process: 1. Generating Deployable Code: Run the command wasp build to generate deployable code for the whole app in the .wasp/build/ directory. Note that you won't be able to build the app if you are using SQLite as a database. You'll have to switch to PostgreSQL before deploying to production [source (https://wasp-lang.dev/docs/advanced/deployment/manually#deploying-a-wasp-app)]. 2. Deploying the API Server (backend): There's a Dockerfile that defines an image for building the server in the .wasp/build directory. To run the server in production, deploy this Docker image to a hosting provider (in your case, Digital Ocean) and ensure the required environment variables on the provider are correctly set up [source (https://wasp-lang.dev/docs/advanced/deployment/manually#deploying-a-wasp-app)]. 3. Deploying the Web Client (frontend): To build the web app, position yourself in .wasp/build/web-app directory and run npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build. The command will build the web client and put it in the build/ directory in the web-app directory. Since the app's frontend is just a bunch of static files, you can deploy it to any static hosting provider [source (https://wasp-lang.dev/docs/advanced/deployment/manually#3-deploying-the-web-client-frontend)]. 4. Deploying the Database: Any PostgreSQL database will do, as long as you provide the server with the correct DATABASE_URL env var and ensure that the database is accessible from the server [source (https://wasp-lang.dev/docs/advanced/deployment/manually#4-deploying-the-database)]. As for your question about PostgreSQL and Docker, it depends on your preference and the specific requirements of your project. If you're comfortable with Docker, it can be a good way to manage your PostgreSQL database. However, you can also install PostgreSQL directly if that's more convenient for you. Remember, these are general steps and might need to be adjusted based on the specifics of Digital Ocean. If you encounter any issues, feel free to ask for help in the Wasp community. Good luck with your deployment! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @DanjelDurmo, 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?
Kelly Ellie
Kelly Ellie3w ago
Keeping an eye on this thread. I originally was thinking digital ocean too but i think there is documentation for deploying to a couple other sites I dont really know.
DanjelDurmo
DanjelDurmo3w ago
Right, like fly.io but i think that digital ocean is better because we can deploy front to back to db here with cheap. Maybe someone of @Wasp Team can provide a quick guide?
Wlski
Wlski3w ago
Not on wasp team but was able to get something up and running with docker compose earlier today. Make sure everything is set up with proper env vars (wasp handles these differently, need to be injected either through docker-compose.yml or script in build process as opposed to .env files) and also mind your way around using wasp build etc. would definitely recommend a dockerfile similar to the one they outline for railway manual deployment in the docs. to clarify this is currently on digital ocean
miho
miho3w ago
I like using self-hosted PaaS solutions e.g. Caprover, Coolify, Dokku etc. which enable you to have your server but get some of the benefits of the Flys, Railways and similar. I found it the easiest to have a Github action to build Docker images for the server and the client. Store them in the Github Container Registry and then just use those images in Caprover: https://github.com/wasp-lang/deploy-to-caprover-action/blob/main/.github/workflows/deploy.yml @Wlski good tip about using the Dockerfile from the Railway manual deployment instructions, that's what I used as well. Another similar repo I setup recently where I used render.com (but you can use Coolify easily instead): https://github.com/wasp-lang/render-ghcr
GitHub
deploy-to-caprover-action/.github/workflows/deploy.yml at main · wa...
Contribute to wasp-lang/deploy-to-caprover-action development by creating an account on GitHub.
GitHub
GitHub - wasp-lang/render-ghcr: Example app that is deployed to Ren...
Example app that is deployed to Render.com using Github Container Registry - wasp-lang/render-ghcr
DanjelDurmo
DanjelDurmo3w ago
@Wlski @miho thank you for the good advice
MEE6
MEE63w ago
Wohooo @DanjelDurmo, you just became a Waspeteer level 2!
martinsos
martinsos2w ago
Let us know if you get deployment going, on how you did it! Might be useful for other Wasp users :).
Want results from more Discord servers?
Add your server