A Flask app to generate OpenZim files from select Wikipedia pages
- Install OpenZim - For Ubuntu 14.04
sudo apt-get install libzim-dev
Package - Get zimwriterfs - build and install it
- Install lxml requirements - For Ubuntu 14.04
sudo apt-get install libxml2-dev libxslt-dev python-dev zlib1g-dev
- Install Redis - build, install & run.
-
sudo apt-get install libzim-dev libxml2-dev libxslt-dev python-dev zlib1g-dev python-pip python-virtualenv libapache2-mod-wsgi
-
git clone https://github.com/tecoholic/Zimbalaka.git
-
cd Zimbalaka
-
virtualenv env
-
. env/bin/activate
-
pip install -r requirements.txt
-
Download, build. install and run redis.
wget http://download.redis.io/releases/redis-3.0.1.tar.gz tar xzf redis-3.0.1.tar.gz cd redis-3.0.1 make && make install ./utils/install_server.sh # maintain defaults except datastore location cd ..
-
Put
zimwriterfs
somewhere or compile and install -
Edit
zimbalaka/default_settings.py
to reflect your production environment -
Edit path in
celery.conf
-
Run supervisord
supervisord -c supervisord.conf
-
mkdir /var/www/zimbalaka
-
Edit path in zimbalaka.wsgi and
cp zimbalaka.wsgi /var/www/zimbalaka/zimbalaka.wsgi
-
Configure apache2:
sudo a2enmod wsgi
and add the following to/etc/apache2/sites-available/000-default.conf
WSGIDaemonProcess zimbalaka threads=5 display-name=%{GROUP} WSGIProcessGroup zimbalaka WSGIScriptAlias /zimbalaka /var/www/zimbalaka/zimbalaka.wsgi <Directory /var/www/zimbalaka> Order allow,deny Allow from all </Directory>
-
sudo service apache2 restart
Now the site should be live at domain/zimbalaka
There are a lot of dependencies in this project which can be changed depending on the deployment situation.
- Server - Perhaps nginx + gunicorn in place of apache2+mod_wsgi
- Celery broker - RabbitMQ in place of Redis, or even Amazon Simple Queue Service
- Demonizing Celery - something in place of supervisor