From 2c81b348aabf7c5ab09ce9f2e6128ab6c9a42f14 Mon Sep 17 00:00:00 2001 From: mARTin Date: Fri, 27 Feb 2026 09:21:10 +0100 Subject: [PATCH] feat: add LXC deployment automation scripts --- scripts/deploy.sh | 16 ++++++++++++++++ scripts/update-server.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 scripts/deploy.sh create mode 100755 scripts/update-server.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..65a8c92 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Local Deployment Script: Push dev to main and notify +set -e + +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +echo -e "${YELLOW}Step 1: Pushing 'dev' to remote 'main'...${NC}" +git push origin dev:main + +echo -e "${GREEN}Done! Changes pushed to GitHub main branch.${NC}" +echo "" +echo -e "${YELLOW}Step 2: Log into your LXC and run:${NC}" +echo -e "cd ~/My-Weekly-ToDo-List" +echo -e "./scripts/update-server.sh" diff --git a/scripts/update-server.sh b/scripts/update-server.sh new file mode 100755 index 0000000..162fb1e --- /dev/null +++ b/scripts/update-server.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Server Update Script: Pull latest main, build, and restart PM2 +set -e + +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +echo -e "${YELLOW}Step 1: Pulling latest changes from GitHub (main)...${NC}" +git checkout main +git pull origin main + +echo -e "${YELLOW}Step 2: Installing dependencies...${NC}" +npm install + +echo -e "${YELLOW}Step 3: Updating database schema...${NC}" +npx prisma db push + +echo -e "${YELLOW}Step 4: Regenerating Prisma client...${NC}" +npx prisma generate + +echo -e "${YELLOW}Step 5: Building application...${NC}" +npm run build + +echo -e "${YELLOW}Step 6: Restarting server with PM2...${NC}" +pm2 restart my-weekly-todo || pm2 start npm --name "my-weekly-todo" -- start + +echo -e "${GREEN}Update complete! App is running on LXC.${NC}" +pm2 list