W
Wasp8mo ago
terrence

Is it possible to separate client and server wasp build?

each time I update stuff on client, and want to push to netlify, I need to run wasp build, but it rebuild both front and backend, it takes so much time(and sometime I only made change to client code, last second it could successfully build, but now it cannot find DATABASE_URL which is really weird), is it possible to only build front or back? and do we have a solution to integrate CI/CD? like I'm using coolify, let it automatically pull code from github when new code pushes triggered, so it can update automatically. @miho
10 Replies
kapa.ai
kapa.ai8mo ago
Hi @terrence. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, it is possible to separate the client and server build in Wasp. When you run wasp build, it generates both the client and server code. However, you can choose to only deploy the client or server code based on your needs. To build the web app (client), you can position yourself in the .wasp/build/web-app directory and run the following commands:
cd .wasp/build/web-app
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build
cd .wasp/build/web-app
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build
Replace <url_to_wasp_backend> with the URL of the Wasp server that you previously deployed. This 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 like Netlify[^1^]. As for CI/CD integration, there is an open issue on the Wasp GitHub repository discussing the implementation of a Github CI Action that builds your Wasp app[^4^]. However, as of now, there isn't a built-in solution for CI/CD in Wasp. You might need to set up your own CI/CD pipeline using tools like Jenkins, Travis CI, or GitHub Actions. Regarding the DATABASE_URL issue, make sure you have set this URL as the WASP_WEB_CLIENT_URL environment variable in your server hosting environment[^1^]. [^1^]: (https://wasp-lang.dev/docs/advanced/deployment/manually#netlify-client) [^4^]: (https://github.com/wasp-lang/wasp/issues/602) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @terrence, 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?
martinsos
martinsos8mo ago
@terrence you can certainly have CI/CD, that is not specific to Wasp! We have people normally building Wasp in CI/CD. It is certainly doable in Github Actions. I don't know much about coolify but it should be similar. We don't have a way to build just one piece of code currently. But wasp build should be quite fast I thought hm! How long does it take for you?
terrence
terrenceOP8mo ago
It's about 5-10mins, do you have tutorial to setup CI/CD for wasp?Thank you.
miho
miho8mo ago
We have a Github action to deploy to Caprover (self hosted PaaS), this might be useful for you? https://github.com/wasp-lang/deploy-to-caprover-action/blob/main/.github/workflows/deploy.yml
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.
martinsos
martinsos8mo ago
Wow 5 to 10 minutes for wasp build? Hmmm. What are your machine's specs?
terrence
terrenceOP8mo ago
I have one minipc 7840hs, one desktop 13700k, one old mac i9-9980hk, they all got 32GB mem, and 1-2tb ssd, but I'm doing development in docker dev container, I dont know if that matters a lot, I dont want to setup local env, it normally got messed up though
martinsos
martinsos8mo ago
Well I am not sure about minipc or deskotp one, nor do I konw whicn one are you using to build wasp, but i9 should certanly be powerful enough and 32GB is more than plenty. So if your CPU is relatively modern, you should be good, and 5 to 10 minutes for wasp build indeed sounds extreme. Docker might be an issue, if it is writing on the disk of your host machine in a way that slows it down, that has been a common issue https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076 and has some workarounds from what I remember. It depends on the details of the setup though.
Docker Community Forums
File access in mounted volumes extremely slow, CPU bound
(Submitted this via email, but since reports are happening on the forum now, I’m sharing here as well!) Expected behavior File access in volumes should be comparable to access times in non-volumes, similarly to Linux installations of docker, or docker on mac via docker-machine and VirtualBox. Actual behavior File access in volumes is many time...
terrence
terrenceOP8mo ago
and I'm pushing production to fly.io, it's indeed very convenient, but I need scale my project now, so I'm thinking migrating to aws, but I dont find a tutorial or solution on the website, I look through on here, there is one thread, but not very detailed, and it's like a month before, do you guys have tutorial for deploy to aws, azure or gcp manually? Thank you,
martinsos
martinsos8mo ago
So we don't have yet tutorials for those but we do have manual deployment instrutcions so those should give you enough info to pull it off! https://wasp-lang.dev/docs/advanced/deployment/manually You said you are looking to scale -> I am curious, how is it that Fly.io isn't enough, can't you scale there?
terrence
terrenceOP8mo ago
our startup got $5000 aws credits, so, you know, it's better just go with aws for now, basically it's gonnabe free for a while.
Want results from more Discord servers?
Add your server