Radicale

Installing Radicale using Gunicorn and Nginx on CentOS 7

Install nginx: Nginx is in the EPEL so install that first.

# yum install -y epel-release
# yum install -y nginx

We are going to run Radicale and Gunicorn in a virtual environment, so we need to install virtualenv

# yum install -y python-virtualenv

Create a radicale user to run the application:

# adduser radicale

Make them a member of the nginx group so that Nginx can access the files:

# usermod -aG nginx radicale

Create the application folder and set the permissions:

# mkdir /opt/radicale
# chown -R radicale:nginx /opt/radicale

Switch to the radicale user:

# su - radicale

Create the app directory and virtualenv:

$ cd /opt/radicale
$ virtualenv venv
$ source venv/bin/activate
$ pip install radicale gunicorn

/opt/radicale/wsgi.py

import radicale

radicale.log.start()
application = radicale.Application()

/etc/systemd/system/radicale.service

[Unit]
Description=Radicale
After=network.target

Service]
User=radicale
Group=nginx
WorkingDirectory=/opt/radicale
ExecStart=/opt/radicale/venv/bin/gunicorn --workers=3 --bind=unix:/opt/radicale/radicale.sock wsgi:application

[Install]
WantedBy=multi-user.target

Optional bcrypt support.

# yum install -y gcc libffi-devel
# su - radicale
$ cd /opt/radicale
$ source venv/bin/activate
(venv)$ pip install bcrypt passlib

References

How To Set Up Django with Postgres, Nginx, and Gunicorn on CentOS 7: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7

How to use selinux on your Redhat/CentOS server. http://blog.centralserv.co.uk/how-to-use-selinux-on-centos-6-5/