Add Hostinger deployment configuration
- Created docker-compose.hostinger.yml with BunkerWeb labels - Added deployment script for automated deployment - Configured for admin.thebankofdebbie.giize.com - Integrated with SilverPay at pay.thebankofdebbie.giize.com 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
156
deploy-hostinger.sh
Normal file
156
deploy-hostinger.sh
Normal file
@@ -0,0 +1,156 @@
|
||||
#!/bin/bash
|
||||
|
||||
# LittleShop Hostinger Deployment Script
|
||||
# admin.thebankofdebbie.giize.com
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 LittleShop Deployment to Hostinger VPS"
|
||||
echo "========================================="
|
||||
|
||||
# Configuration
|
||||
REMOTE_HOST="srv1002428.hstgr.cloud"
|
||||
REMOTE_USER="sysadmin"
|
||||
REMOTE_PORT="2255"
|
||||
SSH_KEY="/home/sysadmin/.claude/Knowledge/Infrastructure/vps_hardening_key"
|
||||
REGISTRY="localhost:5000"
|
||||
IMAGE_NAME="littleshop"
|
||||
IMAGE_TAG="latest"
|
||||
|
||||
echo "📦 Building Docker image locally..."
|
||||
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .
|
||||
|
||||
echo "🏷️ Tagging image for registry..."
|
||||
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
|
||||
echo "📤 Creating deployment package..."
|
||||
# Save the Docker image
|
||||
docker save ${IMAGE_NAME}:${IMAGE_TAG} | gzip > littleshop-docker.tar.gz
|
||||
|
||||
# Create deployment archive
|
||||
tar czf littleshop-deployment.tar.gz \
|
||||
littleshop-docker.tar.gz \
|
||||
docker-compose.hostinger.yml \
|
||||
Dockerfile
|
||||
|
||||
echo "🔑 Connecting to Hostinger VPS..."
|
||||
# Use sshpass if key is not available
|
||||
if [ -f "$SSH_KEY" ]; then
|
||||
SSH_CMD="ssh -p ${REMOTE_PORT} -i ${SSH_KEY} ${REMOTE_USER}@${REMOTE_HOST}"
|
||||
SCP_CMD="scp -P ${REMOTE_PORT} -i ${SSH_KEY}"
|
||||
else
|
||||
echo "Using password authentication (SSH key not found)"
|
||||
SSH_CMD="sshpass -p 'Phenom12#.' ssh -p ${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST}"
|
||||
SCP_CMD="sshpass -p 'Phenom12#.' scp -P ${REMOTE_PORT}"
|
||||
fi
|
||||
|
||||
echo "📁 Creating deployment directory on server..."
|
||||
$SSH_CMD "mkdir -p /opt/littleshop"
|
||||
|
||||
echo "⬆️ Uploading deployment package..."
|
||||
$SCP_CMD littleshop-deployment.tar.gz ${REMOTE_USER}@${REMOTE_HOST}:/opt/littleshop/
|
||||
|
||||
echo "🔧 Deploying on server..."
|
||||
$SSH_CMD << 'REMOTE_SCRIPT'
|
||||
cd /opt/littleshop
|
||||
|
||||
# Extract deployment package
|
||||
echo "📦 Extracting deployment package..."
|
||||
tar xzf littleshop-deployment.tar.gz
|
||||
|
||||
# Load Docker image
|
||||
echo "🐳 Loading Docker image..."
|
||||
docker load < littleshop-docker.tar.gz
|
||||
|
||||
# Login to local registry
|
||||
echo "🔐 Logging in to Docker registry..."
|
||||
docker login localhost:5000 -u admin -p Thefa1r1esd1d1t
|
||||
|
||||
# Tag and push to local registry
|
||||
echo "📤 Pushing to local registry..."
|
||||
docker tag littleshop:latest localhost:5000/littleshop:latest
|
||||
docker push localhost:5000/littleshop:latest
|
||||
|
||||
# Create data directories
|
||||
echo "📁 Creating data directories..."
|
||||
mkdir -p /opt/littleshop/data
|
||||
mkdir -p /opt/littleshop/uploads
|
||||
mkdir -p /opt/littleshop/logs
|
||||
chmod 755 /opt/littleshop/data
|
||||
chmod 755 /opt/littleshop/uploads
|
||||
chmod 755 /opt/littleshop/logs
|
||||
|
||||
# Stop existing container if running
|
||||
echo "🛑 Stopping existing container..."
|
||||
docker stop littleshop-admin 2>/dev/null || true
|
||||
docker rm littleshop-admin 2>/dev/null || true
|
||||
|
||||
# Deploy with docker-compose
|
||||
echo "🚀 Starting LittleShop..."
|
||||
docker-compose -f docker-compose.hostinger.yml up -d
|
||||
|
||||
# Wait for container to be healthy
|
||||
echo "⏳ Waiting for container to be healthy..."
|
||||
for i in {1..30}; do
|
||||
if docker inspect --format='{{.State.Health.Status}}' littleshop-admin 2>/dev/null | grep -q healthy; then
|
||||
echo "✅ Container is healthy!"
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Configure BunkerWeb
|
||||
echo "🔒 Configuring BunkerWeb reverse proxy..."
|
||||
# Check if BunkerWeb configuration exists
|
||||
if [ -f /opt/bunkerweb/configs/admin.thebankofdebbie.giize.com.conf ]; then
|
||||
echo "BunkerWeb configuration already exists"
|
||||
else
|
||||
cat > /opt/bunkerweb/configs/admin.thebankofdebbie.giize.com.conf << 'EOF'
|
||||
server {
|
||||
server_name admin.thebankofdebbie.giize.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://littleshop-admin:5000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket support for SignalR
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Timeouts
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Reload BunkerWeb
|
||||
docker exec bunkerweb nginx -s reload 2>/dev/null || true
|
||||
|
||||
# Show status
|
||||
echo "📊 Deployment Status:"
|
||||
docker ps | grep littleshop-admin
|
||||
|
||||
echo "🌐 Testing connectivity..."
|
||||
curl -s -o /dev/null -w "%{http_code}" http://localhost:5100/api/catalog/products || echo "Local test failed"
|
||||
|
||||
REMOTE_SCRIPT
|
||||
|
||||
echo "🧹 Cleaning up local files..."
|
||||
rm -f littleshop-docker.tar.gz littleshop-deployment.tar.gz
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
echo "======================================"
|
||||
echo "Admin Panel: https://admin.thebankofdebbie.giize.com"
|
||||
echo "API Docs: https://admin.thebankofdebbie.giize.com/swagger"
|
||||
echo "Default login: admin / Thefa1r1esd1d1t"
|
||||
echo ""
|
||||
echo "SilverPay API: https://pay.thebankofdebbie.giize.com"
|
||||
echo "======================================"
|
||||
Reference in New Issue
Block a user