-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_setup_py_environment.sh
More file actions
executable file
·25 lines (20 loc) · 1.24 KB
/
script_setup_py_environment.sh
File metadata and controls
executable file
·25 lines (20 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
python3 --version
python3 -m venv "$SCRIPT_DIR/.venv" --copies # This will copy the Python binary so cap_net_bind_service will work
$SCRIPT_DIR/.venv/bin/pip install -r $SCRIPT_DIR/requirements.txt
echo "Need Sudo for allowing local .venv python to bind to port < 1024 (SMTP uses port 25)"
# Allow binding to port < 1024 (SMTP uses port 25) without use of sudo
for f in $SCRIPT_DIR/.venv/bin/python*; do if sudo setcap 'cap_net_bind_service=+ep' "$f"; then echo "Set CapNetBindService for $(basename "$f")"; fi; done
echo "*******************************************************************"
echo "To starth the app for testing just run in the virtual environment:"
echo "python app.py"
echo "*******************************************************************"
echo "For testing run SMTP server as:"
echo "python app.py --smtp-only --debug"
echo "For testing with web interface run:"
echo "python app.py --web-only --debug"
echo "*******************************************************************"
echo "Gunicorn must run web interface separately, from the SMTP server"
echo "Production Services will run the app as:"
echo "python app.py --smtp-only & gunicorn -w 4 -b 0.0.0.0:5000 app:flask_app"