W
Wasp3mo ago
cmilazzo

wasp build

What command should I use to build the wasp application if I have REACT_APP_API_URL=https://thehatchery.io:448 and WASP_SERVER_URL=http://thehatchery.io:3001
7 Replies
kapa.ai
kapa.ai3mo ago
Hi @cmilazzo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To build your Wasp application, you can use the wasp build command. This command generates the complete web app code, which is ready for deployment. The generated code is stored in the .wasp/build folder. Here is the command:
wasp build
wasp build
After running wasp build, you need to navigate to the .wasp/build/web-app directory and run the npm install and npm run build commands with the REACT_APP_API_URL environment variable set to your backend URL. Here are the commands:
cd .wasp/build/web-app
npm install && REACT_APP_API_URL=<https://thehatchery.io:448> npm run build
cd .wasp/build/web-app
npm install && REACT_APP_API_URL=<https://thehatchery.io:448> npm run build
Please note that the REACT_APP_API_URL should be the URL of the Wasp server that you previously deployed. Sources: - Wasp CLI Reference (https://wasp-lang.dev/docs/general/cli#project-commands) - Deploying the Web Client (frontend) (https://wasp-lang.dev/docs/advanced/deployment/manually#3-deploying-the-web-client-frontend) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @cmilazzo, 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?
cmilazzo
cmilazzoOP3mo ago
@kapa.ai how do I build the server code to deploy?
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- To build the server code for deployment, you first need to generate the deployable code using the wasp build command. This command generates deployable code for the whole app in the .wasp/build/ directory. Here is the command:
wasp build
wasp build
After running wasp build, a Dockerfile is created in the .wasp/build directory that defines an image for building the server. You can deploy this Docker image to a hosting provider and ensure the required environment variables on the provider are correctly set up. Please note that if you are using SQLite as a database (which is the default database), you won't be able to build the app. You'll have to switch to PostgreSQL before deploying to production. Sources: - Generating Deployable Code (https://wasp-lang.dev/docs/advanced/deployment/manually#1-generating-deployable-code) - Deploying the API Server (backend) (https://wasp-lang.dev/docs/advanced/deployment/manually#2-deploying-the-api-server-backend) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @cmilazzo, 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?
cmilazzo
cmilazzoOP3mo ago
@kapa.ai can I deploy the server without using Docker?
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Yes, it is possible to deploy the server without using Docker, but it might require additional setup and configuration depending on your hosting provider. The server is a standard Node.js application, so it can be deployed to any environment that supports Node.js. However, the official Wasp documentation and deployment guides primarily use Docker for deployment. Docker provides a consistent environment for your application, which can simplify deployment and reduce issues caused by differences between development and production environments. There is an open discussion on the Wasp GitHub repository about deployment to bare metal servers and running the server directly without Docker. You can follow the discussion here (https://github.com/wasp-lang/wasp/issues/1481) for more information and updates. Please note that if you choose to deploy without Docker, you'll need to ensure that all the necessary dependencies are correctly installed and configured in your production environment. This includes Node.js, npm, and any database systems or other services your application relies on. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @cmilazzo, 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
miho3mo ago
Docker is useful if you want to have the app packaged up so you can pick the best platform to deploy it without worrying the dependencies. If you install Node.js and whichever dependecy the app needs on the VPS and just run the app with npm run start-production - it should be fine. But of course, I'd recommend using something like pm2 to manage the process and restart it if it crashes.
cmilazzo
cmilazzoOP3mo ago
Thanks Miho!
Want results from more Discord servers?
Add your server