W
Wasp4mo ago
Conspyre

One click deploy on baremetal?

Railway deploy is super simple, but VPS lack sufficient computrons for video tasks. Couple weeks ago, I tried deploying to baremetal/Ubuntu and was brickwalled on some $^%^% thing (details of which have long since popped off my stack). Is there any guidance to create a "one click" deploy script?
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @Conspyre. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Currently, Wasp does not provide a one-click deployment script for bare metal servers. However, there are some discussions and suggestions on how to deploy Wasp to bare metal servers or with Docker containers. One of the suggestions is to use Caprover, a self-hosted PaaS. Here is a deploy script example for Caprover:
#!/bin/bash

set -e
set -u
set -o pipefail

SERVER_APP=socialpostgpt-server
CLIENT_APP=socialpostgpt-client
CAPROVER_URL=<https://captain.apps.twoducks.dev>

IS_BUILDING=false
IS_DEPLOYING_SERVER=false
IS_DEPLOYING_CLIENT=true

if [ "$IS_BUILDING" = true ] ; then
echo "Building server..."
wasp build
fi
if [ ! -d ".wasp/build" ] ; then
echo "Error: .wasp/build doesn't exist"
exit 1
fi

cd .wasp
if [ "$IS_DEPLOYING_SERVER" = true ] ; then
echo "Tar-ing server..."
tar -czf server.tar.gz --exclude "node_modules" ./build/*
echo "Deploying server..."
caprover deploy -a $SERVER_APP -t ./server.tar.gz -u $CAPROVER_URL
rm server.tar.gz
fi

if [ "$IS_DEPLOYING_CLIENT" = true ] ; then
echo "Building client..."
cd ./build/web-app
REACT_APP_API_URL=<https://$SERVER_APP.apps.twoducks.dev> npm run build
CLIENT_DOCKERFILE=$(cat <<EOF
FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html", "-enable-logging"]
COPY ./build /srv/http
EOF
)
echo "$CLIENT_DOCKERFILE" > ./Dockerfile
echo "!build" > .dockerignore

echo "Tar-ing client..."
tar -czf ../../client.tar.gz --exclude "node_modules" ./*
echo "Deploying client..."
caprover deploy -a $CLIENT_APP -t ../../client.tar.gz -u $CAPROVER_URL
rm ../../client.tar.gz
fi
#!/bin/bash

set -e
set -u
set -o pipefail

SERVER_APP=socialpostgpt-server
CLIENT_APP=socialpostgpt-client
CAPROVER_URL=<https://captain.apps.twoducks.dev>

IS_BUILDING=false
IS_DEPLOYING_SERVER=false
IS_DEPLOYING_CLIENT=true

if [ "$IS_BUILDING" = true ] ; then
echo "Building server..."
wasp build
fi
if [ ! -d ".wasp/build" ] ; then
echo "Error: .wasp/build doesn't exist"
exit 1
fi

cd .wasp
if [ "$IS_DEPLOYING_SERVER" = true ] ; then
echo "Tar-ing server..."
tar -czf server.tar.gz --exclude "node_modules" ./build/*
echo "Deploying server..."
caprover deploy -a $SERVER_APP -t ./server.tar.gz -u $CAPROVER_URL
rm server.tar.gz
fi

if [ "$IS_DEPLOYING_CLIENT" = true ] ; then
echo "Building client..."
cd ./build/web-app
REACT_APP_API_URL=<https://$SERVER_APP.apps.twoducks.dev> npm run build
CLIENT_DOCKERFILE=$(cat <<EOF
FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html", "-enable-logging"]
COPY ./build /srv/http
EOF
)
echo "$CLIENT_DOCKERFILE" > ./Dockerfile
echo "!build" > .dockerignore

echo "Tar-ing client..."
tar -czf ../../client.tar.gz --exclude "node_modules" ./*
echo "Deploying client..."
caprover deploy -a $CLIENT_APP -t ../../client.tar.gz -u $CAPROVER_URL
rm ../../client.tar.gz
fi
Another suggestion is to write a docker-compose.yml to run a built Wasp app. The docker-compose.yml should include a PostgreSQL container, a server container with properly set up environment variables, a client container, and an optional reverse-proxy in front (Nginx or Caddy). Please note that these are just suggestions and might require additional adjustments based on your specific needs and environment. For more information, you can refer to the Github Issue (https://github.com/wasp-lang/wasp/issues/1481) where these suggestions were discussed. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Conspyre, 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
martinsos4mo ago
Yup, the link Kapa provided is it!
miho
miho4mo ago
I've deployed stuff to bare metal with Caproer before 🤷‍♂️ 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.
Want results from more Discord servers?
Add your server