Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 20ad1b42 authored by Samuël Weber's avatar Samuël Weber
Browse files

update installation

parent 72761f0a
# Installation
The app works with python 3.5. Here is detailled how to proceed with a debian
stretch. If you are on windows, please use anaconda (see for instance the
article article on
The app works with python 3.7. Here is detailled how to proceed with a debian
stretch. If you are on windows, please use anaconda.
apt-get install python3-dev python3-venv
Clone the git depot:
cd /your/favorite/path
git clone https://github.com/weber-s/apli_dash.git
git clone https://gricad-gitlab.univ-grenoble-alpes.fr/pmall/apli_pmall
Create a virtual environment, activate it and install the dependancies:
python3 -m venv ~/myPMallapp
source ~/myPMallapp/bin/activate
cd apli_dash
cd apli_pmall
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Configuration
To configure the application, don't edit `pmall/settings.py` directly,
instead create a file `pmall/local_settings.py` with your local modifications.
......@@ -35,7 +34,7 @@ Some Django things you should really configure:
There are also pmall-specific settings:
- `BDDPM`: path to the PM database for the dash app.
- `INSTALLED_DASHAPP`: list of string, with the name of the app located in
- `INSTALLED_DASHAPP`: list of string, with the name of the apps located in
Here is a example of a `local_settings.py`:
......@@ -87,9 +86,11 @@ Lastly, you should collect static files to serve them:
python3 manage.py collectstatic
# Deployment
## Locally
To launch the app, launch it as every django app:
......@@ -97,65 +98,112 @@ To launch the app, launch it as every django app:
then open a brower at `http://localhost:8000` and *tada*.
If you don't a working DB for PM -`BDDPM`, it should not work.
If you don't have a working database of PM -`BDDPM`, it will not work.
Ask Samuël Weber (samuel.weber [ at ] univ-grenoble-alpes.fr).
## Production deployment with apache2
Production deployment with apache2
### Install the app
To make the application widely accesible, we use the `www-data` user and the
root dir `/var/www/apli_dash`.
root dir `/var/www/apli_pmall`.
sudo su - www-data -s /bin/bash
git clone https://github.com/weber-s/apli_dash.git
cd apli_dash
git clone https://gricad-gitlab.univ-grenoble-alpes.fr/pmall/apli_pmall
cd apli_pmall
Then install the virtual environment and dependencies:
python3 -m venv /var/www/apli_dash/venvapp
source /var/www/apli_dash/venvapp/bin/activate
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
### Apache configuration
### Nginx configuration
We need apache and lib mod wsgi for python3, so install it:
We need nginx and proxy for python3, so install it:
sudo apt-get install apache2 libapache3-mod-wsgi-py3
sudo apt-get install nginx
Now, we need to configure apache (add virtual host/etc).
Now, we need to configure nginx (add virtual host/etc).
export SERVERNAME=${your server name}
# Configuration du server
server {
listen 80;
server_name pmall.univ-grenoble-alpes.fr;
return 301 https://pmall.univ-grenoble-alpes.fr$request_uri;
server {
listen 443 ssl;
server_name pmall.univ-grenoble-alpes.fr;
charset utf-8;
ssl on;
ssl_protocols TLSv1.2;
ssl_certificate /etc/nginx/ssl/pmall_univ-grenoble-alpes_fr_all.cer;
ssl_certificate_key /etc/nginx/ssl/pmall_univ-grenoble-alpes_fr.key;
access_log /var/log/nginx/pmall.access.log;
error_log /var/log/nginx/pmall.error.log;
# Fichiers media et statiques, délivrés par nginx directement
location /media {
alias /var/www/apli_dash/media;
location /static {
alias /var/www/apli_dash/static;
# Le reste va vers notre proxy uwsgi
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
sudo tee -a > /etc/apache2/sites-available/apli_aerosols.conf <<
<VirtualHost *:80>
WSGIDaemonProcess apli_dash python-path=/var/www/apli_dash/pmall python-home=/var/www/apli_dash/venvapp/ user=www-data group=www-data threads=5
WSGIScriptAlias / /var/www/apli_dash/pmall/wsgi.py
WSGIProcessGroup apli_dash
Alias /static/ /var/www/apli_dash/pmall/static/
<Directory /var/www/apli_dash/pmall/static>
Require all granted
<Directory /var/www/apli_dash/pmall>
<Files wsgi.py>
Require all granted
Add the virtualhost to apache:
sudo a2ensite apli_aerosols
Then reload apache
sudo systemctl restart apache2.service
And finally configure gunicorn proxy and socket.
The systemd daemon in `/etc/systemd/system/gunicorn.service` :
Description=gunicorn daemon
# the specific user that our service will run as
# another option for an even more restricted service is
# DynamicUser=yes
# see http://0pointer.net/blog/dynamic-users-with-systemd.html
ExecStart=/var/www/apli_pmall/venv/bin/gunicorn wsgi
ExecReload=/bin/kill -s HUP $MAINPID
The socket in `/etc/systemd/system/gunicorn.socket` :
Description=gunicorn socket
# Our service won't need permissions for the socket, since it
# inherits the file descriptor by socket activation
# only the nginx daemon will need access to the socket
# Optionally restrict the socket permissions even more.
# SocketMode=600
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment