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