These instructions will guide you through setting up the Signup Flask app in a development environment using the Gunicorn WSGI HTTP server and the Nginx reverse proxy server.
curl -sSL https://raw.githubusercontent.com/glenn-sorrentino/pgp-signup-form/master/install.sh | bash
Disclaimer: This project includes a PGP public key owned by Glenn Sorrentino with ultimate trust. As a result, any encrypted data sent using this key is considered secure and valid without additional verification. Please ensure that you trust the key's owner before using it to encrypt any sensitive information.
- Ubuntu 18.04 or higher
- Python 3.x
- Git
- Pip3
-
Update the system packages:
sudo apt update sudo apt upgrade
-
Install Python 3, Git, and Pip3:
sudo apt install python3 python3-pip git
-
Clone the Signup Flask app from GitHub:
git clone https://github.com/username/signup.git
-
Change into the project directory:
cd signup
-
Create and activate a Python virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install the project dependencies:
pip3 install -r requirements.txt
-
Exit the virtual environment:
deactivate
-
Install Gunicorn:
pip3 install gunicorn
-
Create a Gunicorn configuration file:
sudo nano /etc/systemd/system/gunicorn.service
-
Add the following configuration to the file:
[Unit] Description=Gunicorn instance to serve Signup Flask app After=network.target [Service] User=<your_username> Group=www-data WorkingDirectory=/home/<your_username>/signup ExecStart=/home/<your_username>/signup/venv/bin/gunicorn app:app -b localhost:8000 --workers 3 [Install] WantedBy=multi-user.target
-
Reload the system daemon:
sudo systemctl daemon-reload
-
Start and enable the Gunicorn service:
sudo systemctl start gunicorn sudo systemctl enable gunicorn
-
Install Nginx:
sudo apt install nginx
-
Create a server block configuration file:
sudo nano /etc/nginx/sites-available/signup
-
Add the following configuration to the file:
server { listen 80; server_name your_domain www.your_domain; location / { proxy_pass http://localhost:8000; include /etc/nginx/proxy_params; proxy_redirect off; } }
-
Enable the server block:
sudo ln -s /etc/nginx/sites-available/signup /etc/nginx/sites-enabled/
-
Test the Nginx configuration:
sudo nginx -t
-
Restart Nginx:
sudo systemctl restart nginx
-
Allow Nginx through the firewall:
sudo ufw allow 'Nginx Full'
You have successfully set up the Signup Flask app in a development environment using Gunicorn and Nginx.