🚀 Deployment-Konfiguration hinzugefügt
- docker-compose.yml (DB + Backend + Frontend) - Nginx Reverse Proxy Config - Deployment Script Ports: - PostgreSQL: 5434 - Backend: 8004 - Frontend: 3006
This commit is contained in:
77
deploy/deploy.sh
Normal file
77
deploy/deploy.sh
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 SeCu Deployment Script"
|
||||
echo "========================="
|
||||
|
||||
# Variables
|
||||
DEPLOY_DIR="/srv/secu"
|
||||
REPO_BASE="https://git.kronos-soulution.de/Flux_bot"
|
||||
|
||||
# Create deployment directory
|
||||
echo "📁 Creating deployment directory..."
|
||||
mkdir -p $DEPLOY_DIR
|
||||
cd $DEPLOY_DIR
|
||||
|
||||
# Clone or pull repositories
|
||||
echo "📥 Cloning/updating repositories..."
|
||||
|
||||
for repo in secu secu-backend secu-frontend; do
|
||||
if [ -d "$repo" ]; then
|
||||
echo " Updating $repo..."
|
||||
cd $repo && git pull && cd ..
|
||||
else
|
||||
echo " Cloning $repo..."
|
||||
git clone $REPO_BASE/$repo.git
|
||||
fi
|
||||
done
|
||||
|
||||
# Generate SSL certificates if not exist
|
||||
echo "🔐 Checking SSL certificates..."
|
||||
for domain in secu.kronos-soulution.de api.secu.kronos-soulution.de; do
|
||||
if [ ! -d "/etc/letsencrypt/live/$domain" ]; then
|
||||
echo " Generating certificate for $domain..."
|
||||
certbot certonly --nginx -d $domain --non-interactive --agree-tos -m admin@kronos-soulution.de
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy nginx config
|
||||
echo "🌐 Configuring Nginx..."
|
||||
cp secu/deploy/nginx/secu.conf /etc/nginx/sites-available/secu.conf
|
||||
ln -sf /etc/nginx/sites-available/secu.conf /etc/nginx/sites-enabled/
|
||||
nginx -t && systemctl reload nginx
|
||||
|
||||
# Set JWT secret if not set
|
||||
if [ -z "$JWT_SECRET" ]; then
|
||||
export JWT_SECRET=$(openssl rand -base64 32)
|
||||
echo "JWT_SECRET=$JWT_SECRET" >> /srv/secu/.env
|
||||
echo "⚠️ Generated new JWT_SECRET - saved to /srv/secu/.env"
|
||||
fi
|
||||
|
||||
# Start services
|
||||
echo "🐳 Starting Docker containers..."
|
||||
cd secu/deploy
|
||||
docker-compose down 2>/dev/null || true
|
||||
docker-compose up -d
|
||||
|
||||
# Wait for services
|
||||
echo "⏳ Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
# Health check
|
||||
echo "🏥 Health check..."
|
||||
curl -sf http://localhost:8004/health && echo " Backend OK" || echo " Backend FAILED"
|
||||
curl -sf http://localhost:3006 > /dev/null && echo " Frontend OK" || echo " Frontend FAILED"
|
||||
|
||||
echo ""
|
||||
echo "✅ Deployment complete!"
|
||||
echo ""
|
||||
echo "URLs:"
|
||||
echo " Frontend: https://secu.kronos-soulution.de"
|
||||
echo " API: https://api.secu.kronos-soulution.de"
|
||||
echo ""
|
||||
echo "Default Login (first user becomes Chef):"
|
||||
echo " 1. Go to https://secu.kronos-soulution.de"
|
||||
echo " 2. Click 'Registrieren'"
|
||||
echo " 3. Organization: demo (or create new)"
|
||||
echo " 4. Enter your details"
|
||||
Reference in New Issue
Block a user