Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1.8 kB ยท 56 lines
at commit e8d5e41e
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#!/usr/bin/env fish# Deploy session server to production# This script pulls latest code, installs dependencies, and restarts the service
set SERVER "root@157.245.134.225"set SSH_KEY "$HOME/.ssh/session_server"set REPO_PATH "/home/aesthetic-computer"
echo "๐ Deploying session server to production..."echo ""
# Step 1: Pull latest codeecho "๐ฅ Step 1/4: Pulling latest code from GitHub..."ssh -i $SSH_KEY $SERVER "cd $REPO_PATH && git fetch origin && git reset --hard origin/main"
if test $status -ne 0 echo "" echo "โ Failed to pull code from GitHub" exit 1end
# Step 2: Install dependencies (skip if node_modules exists)echo ""echo "๐ฆ Step 2/4: Checking dependencies..."ssh -i $SSH_KEY $SERVER "cd $REPO_PATH/session-server && if [ ! -d node_modules ]; then echo 'Installing...'; npm install; else echo 'Dependencies already installed'; fi"
if test $status -ne 0 echo "" echo "โ Failed to install dependencies" exit 1end
# Step 3: Restart serviceecho ""echo "๐ Step 3/4: Restarting session server..."ssh -i $SSH_KEY $SERVER "pkill -f 'node.*session.mjs' && sleep 2 && cd $REPO_PATH/session-server && nohup node session.mjs > /tmp/session-server.log 2>&1 &"
if test $status -ne 0 echo "" echo "โ Failed to restart session server" exit 1end
# Step 4: Show logsecho ""echo "๐ Step 4/4: Checking server status..."sleep 3ssh -i $SSH_KEY $SERVER "ps aux | grep 'session.mjs' | grep -v grep && echo '' && tail -20 /tmp/session-server.log"
echo ""echo "โ
Deployment complete!"echo ""echo "๐ก Test the endpoints:"echo " curl -k https://session-server.aesthetic.computer/build-stream \\"echo " --header 'Content-Type: application/json' \\"echo " --data '{\"line\": \"Test message\"}'"