-
Notifications
You must be signed in to change notification settings - Fork 4
S. Lucterios production server
Laurent GAY edited this page Aug 16, 2017
·
1 revision
Tutorial to install a Lucterios application for production using on Linux Ubuntu 14.04 LTS server.
sudo apt-get install build-essential python3-dev python3-pip
sudo apt-get install libxml2 libxml2-dev libxslt1 libxslt1-dev
sudo apt-get install zlib1g-dev
sudo apt-get install postgresql postgresql-contrib nginx supervisor
sudo pip install virtualenv
Using PostgreSql.
sudo -u postgres psql -c "CREATE USER $USERNAME;"
sudo -u postgres psql -c "CREATE DATABASE $DBNAME OWNER $USERNAME;"
sudo -u postgres psql -c "ALTER USER $USERNAME WITH ENCRYPTED PASSWORD '$PASSWD';"
cd <working_path>
python3 $(which virtualenv) virt
source virt/bin/activate
pip install gunicorn
pip install -U lucterios-standard
lucterios_admin.py add -n <instance_name> -p lucterios.standard -m lucterios.contacts,lucterios.mailing,lucterios.documents -d "postgresql:name=$DBNAME,user=$USERNAME,password=$PASSWD,host=localhost" -e "USE_X_FORWARDED_HOST=True,FORCE_SCRIPT_NAME='/<instance_name>'"
python manage_<instance_name>.py collectstatic --noinput
Add file "/etc/supervisor/conf.d/lucterios.conf":
[program:<instance_name>]
environment=DJANGO_SETTINGS_MODULE='<instance_name>.settings'
directory=<working_path>
command=<working_path>/virt/bin/gunicorn lucterios.framework.wsgi --bind=127.0.0.1:<port>
user=<user>
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/<instance_name>.log
redirect_stderr=true
Start supervisor configuration:
sudo service supervisor restart
Your Lucterios server runs on http://127.0.0.1:<port>
nginx is a very fast and small web server.
Add file "/etc/nginx/sites-available/lucterios":
server {
listen 80;
server_name <my_domaine>;
charset utf-8;
access_log /var/log/nginx/$server_name.access.log;
error_log /var/log/nginx/$server_name.error.log;
location /<instance_name>/web {
alias <working_path>/virt/lib/python3.4/site-packages/lucterios/web/;
}
location /<instance_name>/static/ {
alias <working_path>/<working_path>/static/;
}
location ~ ^/<instance_name>(/?)(.*) {
proxy_pass http://127.0.0.1:<port>/$2$is_args$args;
proxy_redirect http://127.0.0.1:<port> http://<my_domaine>/<instance_name>;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
Add symbolic link:
ln -s /etc/nginx/sites-available/lucterios /etc/nginx/sites-enabled/
And re-start web server:
sudo service nginx restart
Your Lucterios web application is enabled on http://<my_domaine>/<instance_name>