Update instructions for production deployment

This commit is contained in:
Alexandre Iooss 2021-10-11 21:55:15 +02:00
parent 293bc48eae
commit 60389ae1b0
4 changed files with 11 additions and 9 deletions

View file

@ -72,9 +72,10 @@ production néccessite **une installation de Debian Bullseye**.
On tire les dépendances le plus possible à partir des dépôts de Debian. On tire les dépendances le plus possible à partir des dépôts de Debian.
``` ```
$ sudo apt install nginx git gettext uwsgi python3-venv \ $ sudo apt install nginx git gettext uwsgi uwsgi-plugin-python3 python3-venv \
python3-certbot-nginx python3-django python3-django-crispy-forms \ python3-certbot-nginx python3-django python3-django-crispy-forms \
python3-django-taggit python3-pil python3-exifread python3-django-taggit python3-pil python3-exifread python3-django-allauth \
python3-psycopg2
``` ```
2. **Clonage du dépot dans `/var/www/photos/photo21`** 2. **Clonage du dépot dans `/var/www/photos/photo21`**
@ -96,7 +97,6 @@ production néccessite **une installation de Debian Bullseye**.
(env)$ deactivate # sortir de l'environnement (env)$ deactivate # sortir de l'environnement
``` ```
4. **Configuration de UWSGI et NGINX.** 4. **Configuration de UWSGI et NGINX.**
```bash ```bash
@ -122,6 +122,7 @@ production néccessite **une installation de Debian Bullseye**.
$ sudo -u www-data ./venv/bin/python ./manage.py collectstatic $ sudo -u www-data ./venv/bin/python ./manage.py collectstatic
$ sudo -u www-data ./venv/bin/python ./manage.py check $ sudo -u www-data ./venv/bin/python ./manage.py check
$ sudo -u www-data ./venv/bin/python ./manage.py migrate $ sudo -u www-data ./venv/bin/python ./manage.py migrate
$ sudo ./venv/bin/python ./manage.py compilemessages
``` ```
7. *Enjoy \o/* 7. *Enjoy \o/*

View file

@ -43,7 +43,7 @@ server {
} }
location / { location / {
uwsgi_pass unix:///var/www/photos/photos21/photos21.sock; uwsgi_pass unix:///var/run/uwsgi/app/uwsgi_photos/socket;
include /etc/nginx/uwsgi_params; include /etc/nginx/uwsgi_params;
} }
} }

View file

@ -13,9 +13,7 @@ plugin = python3
master = true master = true
# maximum number of worker processes # maximum number of worker processes
processes = 10 processes = 10
# the socket (use the full path to be safe # socket with appropriate permissions in /var/run/uwsgi/app/uwsgi_photos/socket
socket = /var/www/photos/photos21/photos21.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664 chmod-socket = 664
# clear environment on exit # clear environment on exit
vacuum = true vacuum = true

View file

@ -23,12 +23,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i8w!-0fvlq3e0slp6612gtu^dy$awha=*9*5e0mx)ggke!#dcd' SECRET_KEY = 'CHANGE_ME'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = [
"photos.crans.org",
"photos-dev.crans.org",
]
# Application definition # Application definition