Files
personal-site-bunext/deploy/deploy-summitlending-contabo.sh
T
2026-11-03 10:00:36 +01:00

32 lines
845 B
Bash
Executable File

#!/bin/bash
set -e
SOURCE_PATH="$HOME/Projects/Git/personal/new-personal-site-bunext"
SERVER_IP="195.26.246.243"
SERVER_PATH="/docker/tben-me"
cd $SOURCE_PATH
rsync -avz --exclude-from=.gitignore --delete $SOURCE_PATH/ root@$SERVER_IP:$SERVER_PATH/
rsync -avz $SOURCE_PATH/secrets/prod.env root@$SERVER_IP:$SERVER_PATH/.env
ssh -i $HOME/.ssh/tben root@$SERVER_IP << 'EOF'
set -e
DEPLOY_NAME="tben-me"
cd /docker/$DEPLOY_NAME
docker build -t $DEPLOY_NAME .
docker kill $DEPLOY_NAME 2>/dev/null || echo "Service already killed"
docker rm $DEPLOY_NAME 2>/dev/null || echo "Container already removed"
docker run --name $DEPLOY_NAME -d \
--network cloudflare --network mariadb \
-v /data/$DEPLOY_NAME/.data:/data \
--restart unless-stopped \
--cpus 0.5 --memory 1g \
--env-file /docker/$DEPLOY_NAME/.env \
$DEPLOY_NAME:latest
EOF