This guide provides step-by-step instructions for deploying the Flight Trajectory Visualizer application on a server where you don't have root access.
- Python 3.8 or higher installed on the server
- Access to a terminal/SSH on the server
- Ability to create directories and run Python in your user space
# Log in to your server
ssh username@your-server.com
# Create a directory for your application
mkdir -p ~/apps/flight-visualizer
cd ~/apps/flight-visualizer
# Create a virtual environment
python3 -m venv venv
source venv/bin/activateOption 1: Using SCP (from your local machine):
# Compress your project files
zip -r flight_visualizer.zip .
# Transfer to your server
scp flight_visualizer.zip username@your-server.com:~/apps/flight-visualizer/Option 2: Using Git (if your project is in a Git repository):
# On your server
git clone https://github.com/yourusername/flight-visualizer.git .Option 3: Manual file upload (using SFTP or your hosting provider's file manager)
# On your server
cd ~/apps/flight-visualizer
unzip flight_visualizer.zip# Ensure your virtual environment is activated
source venv/bin/activate
# Install all required packages
pip install -r deployment_requirements.txt# Create a .env file or export variables
touch .env
echo "SESSION_SECRET=your_secure_random_string" >> .env
echo "PORT=8080" >> .env
# Load environment variables
export SESSION_SECRET=$(grep SESSION_SECRET .env | cut -d '=' -f2)
export PORT=$(grep PORT .env | cut -d '=' -f2)# Run the application with gunicorn
gunicorn --bind 0.0.0.0:$PORT main:appVisit http://your-server.com:8080 to test if your application is running correctly.
For long-running deployment, you can use one of these methods:
# Install screen if not already available
pip install screen --user # If allowed
# Start a new screen session
screen -S flight-visualizer
# Start your application
gunicorn --bind 0.0.0.0:$PORT --workers 3 main:app
# Detach from screen by pressing Ctrl+A, then D# Start the application in the background
nohup gunicorn --bind 0.0.0.0:$PORT --workers 3 main:app > app.log 2>&1 &
# Note the process ID
echo $! > app.pidIf supervisor is installed and accessible without root:
- Create a configuration file
~/supervisor/flight-visualizer.conf:
[program:flight-visualizer]
command=/home/username/apps/flight-visualizer/venv/bin/gunicorn --bind 0.0.0.0:8080 --workers 3 main:app
directory=/home/username/apps/flight-visualizer
user=username
autostart=true
autorestart=true
stderr_logfile=/home/username/apps/flight-visualizer/logs/supervisor.err.log
stdout_logfile=/home/username/apps/flight-visualizer/logs/supervisor.out.log
- Create the logs directory:
mkdir -p ~/apps/flight-visualizer/logs- Start with supervisor:
supervisorctl -c ~/supervisor/supervisord.conf start flight-visualizer- Port already in use: Try a different port number
- Memory issues: Adjust the number of gunicorn workers
- Permission denied: Check file permissions with
chmod - Module not found errors: Ensure all dependencies are installed
- Application errors: Check logs with
tail -f app.log
- Check if your application is running:
ps aux | grep gunicorn - Kill the application:
kill $(cat app.pid)orpkill -f "gunicorn.*main:app" - View logs:
tail -f app.log - Reattach to screen:
screen -r flight-visualizer
- Never expose debugging mode in production
- Generate a strong random string for SESSION_SECRET
- Don't store sensitive credentials in your code
- Consider using HTTPS if possible (may require your hosting provider's support)