feat: add LXC deployment automation scripts
This commit is contained in:
parent
2133364e3d
commit
2c81b348aa
16
scripts/deploy.sh
Executable file
16
scripts/deploy.sh
Executable file
@ -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"
|
||||
29
scripts/update-server.sh
Executable file
29
scripts/update-server.sh
Executable file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user