43 lines
975 B
Bash
Executable File
43 lines
975 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Django Proxmox Mikrotik Deploy Script
|
|
set -e
|
|
|
|
PROJECT_PATH="/usr/share/django-proxmox-mikrotik"
|
|
VENV_PATH="$PROJECT_PATH/venv"
|
|
|
|
echo "Starting Django Proxmox Mikrotik deployment..."
|
|
|
|
# Activate virtual environment
|
|
source $VENV_PATH/bin/activate
|
|
|
|
# Change to project directory
|
|
cd $PROJECT_PATH
|
|
|
|
# Install/update dependencies
|
|
echo "Installing dependencies..."
|
|
pip install -r requirements.txt
|
|
|
|
# Run database migrations
|
|
echo "Running database migrations..."
|
|
python manage.py migrate
|
|
|
|
# Collect static files
|
|
echo "Collecting static files..."
|
|
python manage.py collectstatic --noinput
|
|
|
|
# Create static directory if it doesn't exist
|
|
mkdir -p /usr/share/django-proxmox-mikrotik/static
|
|
|
|
# Set proper permissions
|
|
echo "Setting permissions..."
|
|
chown -R www-data:www-data $PROJECT_PATH
|
|
chmod -R 755 $PROJECT_PATH
|
|
|
|
# Restart services
|
|
echo "Restarting services..."
|
|
systemctl restart django-proxmox-mikrotik
|
|
systemctl restart nginx
|
|
|
|
|
|
echo "Deployment completed successfully!" |