Add server update scripts and fix repository URLs
All checks were successful
CI / Lint Code (push) Successful in 1m39s
CI / Security Checks (push) Successful in 1m30s
CI / Validate i18n Files (push) Successful in 9s
CI / TypeScript Type Check (push) Successful in 1m49s
CI / Build Project (push) Successful in 1m59s
CI / Run Tests (Node 18) (push) Successful in 2m8s
Auto Tag Release / Create Auto Tag (push) Successful in 2m22s
CI / Run Tests (Node 20) (push) Successful in 2m18s
CI / Test Coverage (push) Successful in 3m13s
Deploy Scripts to S3 / deploy-scripts (push) Successful in 34s
All checks were successful
CI / Lint Code (push) Successful in 1m39s
CI / Security Checks (push) Successful in 1m30s
CI / Validate i18n Files (push) Successful in 9s
CI / TypeScript Type Check (push) Successful in 1m49s
CI / Build Project (push) Successful in 1m59s
CI / Run Tests (Node 18) (push) Successful in 2m8s
Auto Tag Release / Create Auto Tag (push) Successful in 2m22s
CI / Run Tests (Node 20) (push) Successful in 2m18s
CI / Test Coverage (push) Successful in 3m13s
Deploy Scripts to S3 / deploy-scripts (push) Successful in 34s
- Add scripts/server-update.sh for production deployments - Add scripts/dev-update.sh for development updates - Update repository URLs to signal-works/icewatch - Document update scripts in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
047456b1d8
commit
a8f2078e5b
4 changed files with 140 additions and 2 deletions
12
CLAUDE.md
12
CLAUDE.md
|
@ -33,6 +33,18 @@ tea pr create
|
|||
|
||||
## Development Commands
|
||||
|
||||
### Quick Update Scripts
|
||||
|
||||
For easier development and deployment updates:
|
||||
|
||||
```bash
|
||||
# Development update (pull, install, build, test)
|
||||
./scripts/dev-update.sh
|
||||
|
||||
# Production server update (requires sudo, handles service restart)
|
||||
sudo ./scripts/server-update.sh
|
||||
```
|
||||
|
||||
### Running the Application
|
||||
```bash
|
||||
# Install dependencies
|
||||
|
|
40
scripts/dev-update.sh
Executable file
40
scripts/dev-update.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Development Update Script for Ice Watch Application
|
||||
# Quick script for updating during development
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log() {
|
||||
echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo -e "${YELLOW}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}"
|
||||
}
|
||||
|
||||
log "Starting development update..."
|
||||
|
||||
# Pull latest changes
|
||||
log "Pulling latest changes from git..."
|
||||
git pull origin main
|
||||
|
||||
# Install dependencies
|
||||
log "Installing/updating dependencies..."
|
||||
npm install
|
||||
|
||||
# Build the application
|
||||
log "Building application..."
|
||||
npm run build
|
||||
|
||||
# Run tests
|
||||
log "Running tests..."
|
||||
npm test
|
||||
|
||||
log "✅ Development update completed successfully!"
|
||||
log "You can now run 'npm start' or 'npm run dev:full' to start the application"
|
|
@ -25,7 +25,7 @@ try {
|
|||
commitDate: commitDate,
|
||||
commitMessage: commitMessage,
|
||||
buildDate: new Date().toISOString(),
|
||||
gitUrl: 'https://git.deco.sh/deco/ice'
|
||||
gitUrl: 'https://git.deco.sh/signal-works/icewatch'
|
||||
};
|
||||
|
||||
// Ensure dist directory exists
|
||||
|
@ -55,7 +55,7 @@ try {
|
|||
commitDate: new Date().toISOString(),
|
||||
commitMessage: 'No git information available',
|
||||
buildDate: new Date().toISOString(),
|
||||
gitUrl: 'https://git.deco.sh/deco/ice'
|
||||
gitUrl: 'https://git.deco.sh/signal-works/icewatch'
|
||||
};
|
||||
|
||||
const distDir = path.join(__dirname, '..', 'dist');
|
||||
|
|
86
scripts/server-update.sh
Executable file
86
scripts/server-update.sh
Executable file
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Server Update Script for Ice Watch Application
|
||||
# This script handles updating the production server with proper user permissions
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
APP_DIR="/opt/icewatch"
|
||||
APP_USER="icewatch"
|
||||
SERVICE_NAME="icewatch"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Functions
|
||||
log() {
|
||||
echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')] $1${NC}"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo -e "${YELLOW}[$(date +'%Y-%m-%d %H:%M:%S')] WARNING: $1${NC}"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: $1${NC}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if running as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
error "This script must be run as root (use sudo)"
|
||||
fi
|
||||
|
||||
# Check if app directory exists
|
||||
if [[ ! -d "$APP_DIR" ]]; then
|
||||
error "Application directory $APP_DIR does not exist"
|
||||
fi
|
||||
|
||||
# Check if service exists
|
||||
if ! systemctl list-unit-files | grep -q "$SERVICE_NAME.service"; then
|
||||
error "Service $SERVICE_NAME does not exist"
|
||||
fi
|
||||
|
||||
log "Starting server update process..."
|
||||
|
||||
# Stop the service
|
||||
log "Stopping $SERVICE_NAME service..."
|
||||
systemctl stop "$SERVICE_NAME"
|
||||
|
||||
# Navigate to app directory as app user and update
|
||||
log "Updating application code..."
|
||||
sudo -u "$APP_USER" bash -c "
|
||||
cd '$APP_DIR' && \
|
||||
git fetch origin && \
|
||||
git reset --hard origin/main && \
|
||||
npm install --production && \
|
||||
npm run build
|
||||
"
|
||||
|
||||
# Check if build was successful
|
||||
if [[ $? -ne 0 ]]; then
|
||||
error "Build failed! Check the logs above."
|
||||
fi
|
||||
|
||||
# Start the service
|
||||
log "Starting $SERVICE_NAME service..."
|
||||
systemctl start "$SERVICE_NAME"
|
||||
|
||||
# Check service status
|
||||
sleep 2
|
||||
if systemctl is-active --quiet "$SERVICE_NAME"; then
|
||||
log "✅ Service $SERVICE_NAME is running successfully"
|
||||
else
|
||||
error "❌ Service $SERVICE_NAME failed to start"
|
||||
fi
|
||||
|
||||
# Show recent logs
|
||||
log "Recent service logs:"
|
||||
journalctl -u "$SERVICE_NAME" -n 10 --no-pager
|
||||
|
||||
log "🎉 Server update completed successfully!"
|
||||
log "Application is now running the latest version from main branch"
|
Loading…
Add table
Add a link
Reference in a new issue