fix
This commit is contained in:
39
deploy.sh
39
deploy.sh
@@ -7,8 +7,8 @@ set -e
|
||||
|
||||
echo "🚀 Starting TestArena Deployment..."
|
||||
|
||||
# 1. Install Dependencies
|
||||
echo "📦 Installing dependencies..."
|
||||
# 1. Install System Dependencies
|
||||
echo "📦 Installing system dependencies..."
|
||||
apt-get update
|
||||
apt-get install -y nginx python3-pip python3-venv
|
||||
|
||||
@@ -16,13 +16,18 @@ apt-get install -y nginx python3-pip python3-venv
|
||||
echo "🐍 Setting up Python environment..."
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install fastapi uvicorn sqlalchemy
|
||||
pip install --upgrade pip
|
||||
pip install fastapi uvicorn sqlalchemy pydantic
|
||||
|
||||
# 3. Configure Nginx
|
||||
echo "🌐 Configuring Nginx..."
|
||||
cp nginx/testarena.conf /etc/nginx/sites-available/testarena
|
||||
ln -sf /etc/nginx/sites-available/testarena /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
if [ -d "nginx" ] && [ -f "nginx/testarena.conf" ]; then
|
||||
cp nginx/testarena.conf /etc/nginx/sites-available/testarena
|
||||
ln -sf /etc/nginx/sites-available/testarena /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
else
|
||||
echo "⚠️ Nginx configuration not found, skipping..."
|
||||
fi
|
||||
|
||||
# 4. Create Data Directory
|
||||
echo "📁 Creating data directory..."
|
||||
@@ -30,15 +35,25 @@ mkdir -p /home/asf/testarena
|
||||
chown -R asf:asf /home/asf/testarena
|
||||
chmod -R 755 /home/asf/testarena
|
||||
|
||||
# 5. Restart Nginx
|
||||
echo "🔄 Restarting Nginx..."
|
||||
nginx -t
|
||||
systemctl restart nginx
|
||||
# 5. Set up Systemd Services
|
||||
echo "⚙️ Setting up Systemd services..."
|
||||
cp testarena-app.service /etc/systemd/system/
|
||||
cp testarena-worker.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable testarena-app
|
||||
systemctl enable testarena-worker
|
||||
|
||||
# 6. Restart Services
|
||||
echo "🔄 Restarting services..."
|
||||
nginx -t && systemctl restart nginx
|
||||
systemctl restart testarena-app
|
||||
systemctl restart testarena-worker
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
echo "--------------------------------------------------"
|
||||
echo "Dashboard: http://asf-server.duckdns.org:8080/"
|
||||
echo "Results: http://asf-server.duckdns.org:8080/results/"
|
||||
echo "--------------------------------------------------"
|
||||
echo "To start the app: source venv/bin/activate && uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000"
|
||||
echo "To start the worker: source venv/bin/activate && python3 -m testarena_app.worker"
|
||||
echo "Services status:"
|
||||
systemctl status testarena-app --no-pager || true
|
||||
systemctl status testarena-worker --no-pager || true
|
||||
|
||||
Reference in New Issue
Block a user