-
Notifications
You must be signed in to change notification settings - Fork 13
Deploy D‐Genies in webserver mode with apache
For this recipe, we will use CentOS 7 as Linux distribution.
Note: All this recipe commands will be done as root
user, or prefixed with sudo
.
We will install D-Genies as root
user, but D-Genies will be run by the user dgenies
.
We create then the user dgenies
:
# We add the user
useradd -m dgenies
# We can also set the user password
passwd dgenies
By default, CentOS is installed with SELinux activated and in Enforcing state. We disable it in order to avoid interference with D-Genies installation and configuration.
# We deactivate SELinux (need to reboot to be taken in account)
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
# Set SELinux in permissive state now! This way, we don't need to reboot.
setenforce 0
We also deactivate the firewall for the same reason
systemctl stop firewalld
systemctl disable firewalld
D-Genies is written for Python 3.5+, which can be installed with the following command:
yum install -y python3 python3-devel python3-pip
D-Genies also needs the following system dependencies.
yum install -y "@Development tools" time zlib-devel libjpeg-turbo-devel libsq3-devel sqlite-devel
We can install D-Genies from source.
cd /tmp
git clone https://github.com/genotoul-bioinfo/dgenies.git dgenies.git
cd gdenies.git
python3 setup.py install
We can also use pip
, but pip
behaviour has changed over time. Recent pip
versions do not copy some D-Genies files in the right place anymore. If you want to try, you can use the following command:
python3 -m pip install dgenies
From this step, you can configure D-Genies by editing the /etc/dgenies/application.properties
file and run it directly with the dgenies run -m webserver
command, but it is not the way to serve wsgi application in production mode.
We also recommend to use a MySQL/MariaDB database instead of the SQLite one use by default by D-Genies
TO DEVELOP
yum install -y httpd epel-release
yum install -y python3-mod_wsgi
We create the /etc/httpd/conf.d/dgenies.conf
file with following content:
<VirtualHost *>
ServerName <url>
WSGIDaemonProcess dgenies user=dgenies group=dgenies threads=8
WSGIScriptAlias / /var/www/dgenies/dgenies.wsgi
<Directory /var/www/dgenies>
WSGIProcessGroup dgenies
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
where <url>
is your server address
Now we can start D-Genies:
systemctl start httpd
systemctl enable httpd
D-Genies can be stopped this way:
# We stop the flask application
systemctl stop httpd
# We can also stop the local scheduler launched by the flask app.
sudo -u dgenies dgenies clear -c