Skip to main content

Overview

Enferno provides multiple deployment options to suit different needs. You can either use the automated Enferno CLI tool for quick Ubuntu server deployments, or follow the traditional deployment process for other environments. The Enferno CLI tool automates the entire deployment process on Ubuntu servers with a single command.

Features

  • Automated server provisioning with Python 3.13+ support
  • Nginx configuration with SSL certificates
  • PostgreSQL/SQLite database setup
  • Systemd services configuration
  • User management and security setup

Quick Start

  1. Install the CLI tool:
pip install enferno_cli
  1. Run the interactive setup:
enferno setup
The tool will guide you through the configuration process, prompting for necessary information like server hostname, credentials, and deployment options.

Traditional Deployment

If you prefer manual deployment or need to deploy to a different environment, follow these steps:

Prerequisites

  1. Python 3.11+
  2. Nginx
  3. uv (fast Python package installer)
Optional:
  • PostgreSQL (SQLite works by default)
  • Redis (for background tasks with Celery)

Server Setup

# Update system
sudo apt update && sudo apt upgrade -y

# Install core dependencies
sudo apt install -y python3-pip nginx
pip install uv

# Optional: PostgreSQL
sudo apt install -y postgresql postgresql-contrib

# Optional: Redis (for Celery background tasks)
sudo apt install -y redis-server

Application Setup

git clone https://github.com/level09/enferno.git
cd enferno
./setup.sh                # Install deps + generate secure .env
uv run flask create-db    # Setup database
uv run flask install      # Create admin user

Database Configuration

SQLite (Default)

Works out of the box - database created automatically in instance/.

PostgreSQL

# Create database
sudo -u postgres createuser -s myuser
sudo -u postgres createdb mydb

# Update .env
SQLALCHEMY_DATABASE_URI=postgresql://myuser:password@localhost/mydb

# Initialize
uv run flask create-db
uv run flask install

Nginx Configuration

Create a new Nginx configuration:
server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location /static {
        alias /path/to/enferno/static;
        expires 30d;
    }
}

SSL Configuration

  1. Install Certbot:
sudo apt install -y certbot python3-certbot-nginx
  1. Obtain SSL certificate:
sudo certbot --nginx -d yourdomain.com

Systemd Service

Create a service file /etc/systemd/system/enferno.service:
[Unit]
Description=Enferno Web Application
After=network.target

[Service]
User=your_user
WorkingDirectory=/path/to/enferno
Environment="PATH=/path/to/enferno/venv/bin"
ExecStart=/path/to/enferno/venv/bin/gunicorn -w 4 -b 127.0.0.1:5000 wsgi:app

[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable enferno
sudo systemctl start enferno

Celery Worker Service (Optional)

Only needed if using background tasks. First install: uv sync --extra full Create /etc/systemd/system/enferno-celery.service:
[Unit]
Description=Enferno Celery Worker
After=network.target

[Service]
User=your_user
WorkingDirectory=/path/to/enferno
ExecStart=/path/to/enferno/.venv/bin/celery -A enferno.tasks worker --loglevel=info

[Install]
WantedBy=multi-user.target
sudo systemctl enable enferno-celery
sudo systemctl start enferno-celery

Production Checklist

  • Set FLASK_DEBUG=0 in .env
  • Use a secure SECRET_KEY
  • Configure proper logging
  • Set up monitoring (e.g., Sentry)
  • Configure backup strategy
  • Set up firewall rules
  • Enable rate limiting
  • Configure CORS settings
  • Set secure cookie flags
  • Enable HTTPS redirection

Troubleshooting

Common Issues

  1. Static files not found (404)
    • Check Nginx static file path configuration
    • Verify file permissions
    • Run flask static to collect static files
  2. Database connection errors
    • Verify database credentials in .env
    • Check database service status
    • Ensure proper permissions
  3. Application not starting
    • Check systemd service logs: sudo journalctl -u enferno
    • Verify environment variables
    • Check application logs
  4. Redis connection issues (if using Celery)
    • Verify Redis is running: sudo systemctl status redis
    • Check REDIS_URL in .env
For more deployment options, visit the Enferno CLI documentation.