Skip to content

Commit

Permalink
Add configuration insntructions
Browse files Browse the repository at this point in the history
  • Loading branch information
almet committed Jan 15, 2016
1 parent e87f4a1 commit d2a26db
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 90 deletions.
97 changes: 89 additions & 8 deletions README.rst
Expand Up @@ -29,20 +29,15 @@ To test it::



Ubuntu dependencies
###################

You will need to install the following packages:

- zimwriterfs
- httrack
Debian dependencies
####################

Installing the dependencies
===========================

::

sudo apt-get install httrack libzim-dev libmagic-dev liblzma-dev libz-dev build-essential
sudo apt-get install httrack libzim-dev libmagic-dev liblzma-dev libz-dev build-essential libtool redis-server automake pkg-config

Installing zimwriterfs
======================
Expand All @@ -61,4 +56,90 @@ Then upgrade the path to zimwriterfs executable in zimit.ini

$ rqworker & pserve zimit.ini

How to deploy?
##############

There are multiple ways to deploy such service, so I'll describe how I do it
with my own best-practices.

First of all, get all the dependencies and the code. I like to have everything
available in /home/www, so let's consider this will be the case here::

$ mkdir /home/www/zimit.notmyidea.org
$ cd /home/www/zimit.notmyidea.org
$ git clone https://github.com/almet/zimit.git

Create a virtual environment and activate it::

$ virtualenv venv
$ activate venv/bin/activate

Then, you can change the configuration file, by creating a new one::

$ cd zimit
$ cp zimit.ini local.ini

From there, you need to update the configuration to point to the correct
binaries and locations.

Nginx configuration
===================

::

# the upstream component nginx needs to connect to
upstream zimit_upstream {
server unix:///tmp/zimit.sock;
}

# configuration of the server
server {
listen 80;
listen [::]:80;
server_name zimit.ideascube.org;
charset utf-8;

client_max_body_size 200M;

location /zims {
alias /home/ideascube/zimit.ideascube.org/zims/;
autoindex on;
}

# Finally, send all non-media requests to the Pyramid server.
location / {
uwsgi_pass zimit_upstream;
include /var/ideascube/uwsgi_params;
}
}


UWSGI configuration
===================

::

[uwsgi]
uid = ideascube
gid = ideascube
chdir = /home/ideascube/zimit.ideascube.org/zimit/
ini = /home/ideascube/zimit.ideascube.org/zimit/local.ini
# the virtualenv (full path)
home = /home/ideascube/zimit.ideascube.org/venv/

# process-related settings
# master
master = true
# maximum number of worker processes
processes = 4
# the socket (use the full path to be safe
socket = /tmp/zimit.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# stats = /tmp/ideascube.stats.sock
# clear environment on exit
vacuum = true
plugins = python


That's it!
24 changes: 24 additions & 0 deletions app.wsgi
@@ -0,0 +1,24 @@
try:
import ConfigParser as configparser
except ImportError:
import configparser
import logging.config
import os

from zimit import main

here = os.path.dirname(__file__)

ini_path = os.environ.get('ZIMIT_INI')
if ini_path is None:
ini_path = os.path.join(here, 'local.ini')

# Set up logging
logging.config.fileConfig(ini_path)

# Parse config and create WSGI app
config = configparser.ConfigParser()
config.read(ini_path)

application = main(config.items('DEFAULT'), **dict(config.items('app:main'
)))
36 changes: 0 additions & 36 deletions static/KoomBook_fichiers/css.css

This file was deleted.

22 changes: 0 additions & 22 deletions static/KoomBook_fichiers/icon.css

This file was deleted.

Binary file removed static/KoomBook_fichiers/koombook-nb.png
Binary file not shown.
8 changes: 0 additions & 8 deletions static/KoomBook_fichiers/material.css

This file was deleted.

10 changes: 0 additions & 10 deletions static/KoomBook_fichiers/material.js

This file was deleted.

12 changes: 6 additions & 6 deletions static/index.html
Expand Up @@ -5,11 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Zim It!</title>

<link rel="stylesheet" href="KoomBook_fichiers/material.css">
<script src="KoomBook_fichiers/material.js"></script>
<link rel="stylesheet" href="KoomBook_fichiers/icon.css">
<link href="KoomBook_fichiers/css.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="KoomBook_fichiers/main.html">
<link rel="stylesheet" href="assets/material.css">
<script src="assets/material.js"></script>
<link rel="stylesheet" href="assets/icon.css">
<link href="assets/css.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="assets/main.html">


</head>
Expand All @@ -20,7 +20,7 @@

<header class="mdl-layout__header is-casting-shadow">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title0"><a href="#"><img src="KoomBook_fichiers/koombook-nb.png" height="30"></a></span>
<span class="mdl-layout-title0"><a href="#"><img src="assets/koombook-nb.png" height="30"></a></span>
<div class="mdl-layout-spacer"></div>
</div>
</header>
Expand Down
12 changes: 12 additions & 0 deletions zimit.ini
Expand Up @@ -20,6 +20,18 @@ port = 6543

# Begin logging configuration

[uwsgi]
wsgi-file = app.wsgi
http-socket = :8000
enable-threads = true
master = true
processes = 1
virtualenv = .
module = zimit
lazy = true
lazy-apps = true


[loggers]
keys = root, gplayproxy

Expand Down

0 comments on commit d2a26db

Please sign in to comment.