W
Wasp-lang•2mo ago
yanchok

Running the backend as a regular node.js app?

Hi, I'm wondering if it's possible to run the backend as a regular node.js application like 'npm start' instead of using docker? If not why?
14 Replies
miho
miho•2mo ago
Wasp compiles to just regular Resct app and regular Node.js app. You are free to deploy it in any way you like. https://wasp-lang.dev/docs/advanced/deployment/manually read more in the manual deployment docs
Deploying Manually | Wasp
This document explains how to build and prepare your Wasp app for deployment.
miho
miho•2mo ago
We used docker to deploy the server on Fly since it's what worked the best for us and docker is kinda the industry standard. 🤗
yanchok
yanchok•2mo ago
Thank you! I thought I couldn't run it as a normal node.js app because I was getting an error. Turns out I didn't bundle because the npm run bundle command isn't mentioned in the readme
miho
miho•2mo ago
Oh that's a good catch! Which README were you following? 🙂
yanchok
yanchok•2mo ago
The one in /app/.wasp/build/server I found the commands in the package.json, but that's not very intuitive 😄 Also I don't find anithing in the docs mentioning that you need to bundle it in order to run it
martinsos
martinsos•2mo ago
@yanchok so you can run it manually as a regular node app, but indeed there are steps that need to happen in order to have that work. And those steps are basically documented in the Dockerfile we generate -> so the best thing would be too look into how Dockerfile is defined, and replicating relevant steps directly on your machine where you want to run the backend.
yanchok
yanchok•2mo ago
yeah, but still I think it will be good the commands to be described in the readme. Can I update the readme?
martinsos
martinsos•2mo ago
@yanchok you are probably right! It does put some additional burden on us though, because then we also have to maintain that piece of docs. Maybe we could something in the docs like "check Dockerfile to figure out how to deploy it on your machine without Docker" + some examples hm. Or, we should be more precise and describe it exactly. If you want to give it a try that would be great -> you can make a PR toward our docs! You mentioned README, but docs are probably the right place for this. What you will want to do is going to this page in docs https://wasp-lang.dev/docs/advanced/deployment/manually and adding this content to it. Maybe it could be a new section, called "Deploying the API Server without Docker"? You can just scroll to the bottom of the page and click "Edit this page" and it will allow you to edit it direclty in the browser and make a PR. Or you can clone the wasp repo, go into docs there and make a PR that way.
yanchok
yanchok•2mo ago
Ok, I'll update them later
martinsos
martinsos•2mo ago
@yanchok if you find that too complex / hard, you can create a GH issue describing how you got it working (which commands you used) and we can use that information later to update the docs properly, that will also be helpful.
martinsos
martinsos•2mo ago
Actually, I just remembered we already have a GH issue about this, check it out: https://github.com/wasp-lang/wasp/issues/1481 . It even links to a previous Discord convo where we helped another person get it running, you might find it helpful.
GitHub
Deployment to bare metal · Issue #1481 · wasp-lang/wasp
We should write a piece about deploying Wasp to bare metal and/or with Docker container + docker-compose.yml Using Caprover (self-hosted PaaS) Deploy script #!/bin/bash set -e set -u set -o pipefai...
martinsos
martinsos•2mo ago
This is that previous DIscord convo: https://discord.com/channels/686873244791210014/1171112746633400462/1171112746633400462 . Note however that this was some time ago, and Wasp changed quite a bit in the meantime, so those commands are probalby not correct anymore.
yanchok
yanchok•2mo ago
No problem, I will write it. I can post it here if you want to discuss the text before i make a pr
MEE6
MEE6•2mo ago
Wohooo @yanchok, you just became a Waspeteer level 3!