Netlify deployment query

Full guide on netlify deployment please, kapa
9 Replies
kapa.ai
kapa.ai2w ago
Hi @ArDev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Sure, here's a step-by-step guide on how to deploy your Wasp app's client on Netlify: 1. Prerequisites: You will need a Netlify account and Netlify CLI (https://docs.netlify.com/cli/get-started/) installed. Make sure you are logged in with Netlify CLI. You can check if you are logged in with netlify status, and if you are not, you can log in with netlify login. 2. Build the Wasp app: Make sure you have built the Wasp app (https://wasp-lang.dev/docs/advanced/deployment/manually#1-generating-deployable-code). 3. Build the web app: To build the web app, position yourself in .wasp/build/web-app directory:
cd .wasp/build/web-app

cd .wasp/build/web-app

Then run:
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build

npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build

where <url_to_wasp_backend> is the URL of the Wasp server that you previously deployed. 4. Deploy the client: We can now deploy the client with:
netlify deploy

netlify deploy

Carefully follow the instructions i.e. do you want to create a new app or use an existing one, the team under which your app will reside etc. 5. Final step: The final step is to run:
netlify deploy --prod

netlify deploy --prod

That is it! Your client should be live at <https://<app-name>.netlify.app.> 6. Set the URL: Make sure you set this URL as the WASP_WEB_CLIENT_URL environment variable in your server hosting environment (e.g., Fly.io or Heroku). For more details, you can refer to the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#netlify-client). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ArDev, 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?
ArDev
ArDev2w ago
@kapa.ai of the Wasp server that you previously deployed.
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you. One moment! :books: ---------------------- It seems like your question got cut off. Could you please provide more details or context? I'm here to help with any questions related to the Wasp framework. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ArDev, 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?
ArDev
ArDev2w ago
@kapa.ai what do you mean - "of the Wasp server that you previously deployed."
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you. One moment! :books: ---------------------- In the context of deploying a Wasp application, "the Wasp server that you previously deployed" refers to the backend part of your Wasp application that you have already deployed to a server. When you build and deploy a Wasp application, it consists of two main parts: 1. The API server (backend): This is the part of your application that interacts with the database and handles API requests from the client. It's typically deployed on a server. 2. The web client (frontend): This is the user interface of your application, typically built with React in the case of a Wasp application. It's usually deployed on a static hosting provider. When you're deploying the web client, you need to provide the URL of the API server (the backend) that you've already deployed. This is done by setting the REACT_APP_API_URL environment variable to the URL of your deployed Wasp server. This allows the web client to know where to send its API requests. Here's the command you'd run, where <url_to_wasp_backend> is the URL of your deployed Wasp server:
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build
For more details, you can refer to the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#netlify-client). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ArDev, 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?
ArDev
ArDev2w ago
@kapa.ai how to deploy to the backend and then frontend?
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Deploying a Wasp app involves deploying both the backend (API server) and the frontend (web client). Here's a general guide on how to do it: Backend (API Server): 1. Generate deployable code for the whole app by running the command wasp build in the root directory of your project. This will generate the code in the .wasp/build/ directory.
wasp build

wasp build

2. Navigate to the .wasp/build directory which contains a Dockerfile for building the server.
cd .wasp/build

cd .wasp/build

3. Deploy this Docker image to a hosting provider and ensure the required environment variables on the provider are correctly set up. The mechanism of setting these up is specific per provider. All necessary environment variables are listed in the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#environment-variables). Frontend (Web Client): 1. Navigate to the .wasp/build/web-app directory:
cd .wasp/build/web-app

cd .wasp/build/web-app

2. Build the web app by running:
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build

npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build

where <url_to_wasp_backend> is the URL of the Wasp server that you previously deployed. 3. Deploy the built web client to any static hosting provider. If you're using Netlify, you can deploy the client with:
netlify deploy

netlify deploy

Follow the instructions provided by the CLI, then run:
netlify deploy --prod

netlify deploy --prod

Your client should now be live at <https://<app-name>.netlify.app.> Remember to set the WASP_WEB_CLIENT_URL environment variable in your server hosting environment to the URL where your frontend app is running. For more detailed instructions, including how to deploy to specific providers like Fly.io, Netlify, Railway, and Heroku, refer to the Wasp deployment documentation (https://wasp-lang.dev/docs/advanced/deployment/manually). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ArDev, 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
miho2w ago
Please read the docs on manual deployment: https://wasp-lang.dev/docs/advanced/deployment/manually 1. Netlify is only for the client 2. You'll need to deploy the server somewhere else where Node.js servers are supported (Netlify only supports serverless functions)
Deploying Manually | Wasp
This document explains how to build and prepare your Wasp app for deployment.
ArDev
ArDev2w ago
yeah i just decided to use railway instead
Want results from more Discord servers?
Add your server