add "coverage" target to makefile
[mygpo.git] / INSTALL
blob27002f69268bd8cdc0e20856ff67be179828e421
1 Deployment instructions for mygpo
2 =================================
5 Dependencies
6 ------------
8 When no version number is indicated, it is advisable to install the current
9 development version from the repository.
11   * Python (>= 2.6)
12   * [CouchDB](https://couchdb.apache.org/) (>= 1.2)
15 Basic setup
16 -----------
18 Here's how you start from scratch with a new mygpo install (assuming a
19 Ubuntu 12.04 x86 install, 'should work' with other versions/archs as well).
21 If you are on a Debian/Ubuntu system, do:
23   sudo apt-get install erlang git python-pip python-dev libevent-dev
24   sudo apt-get build-dep couchdb
26   [ install couchdb 1.2.0 from source ]
28 Select a cozy place for the mygpo sources and clone it:
30   git clone git://github.com/gpodder/mygpo.git
31   cd mygpo
33 Now install additional dependencies locally (you could also use virtualenv or
34 some other fancy stuff):
36   pip install -r requirements.txt
38 That's it for the setup. Now to initialize the DB:
40   cd mygpo
41   python manage.py sync_couchdb
42   python manage.py sync-design-docs
44 ..and here we go:
46   python manage.py runserver
48 Ok, so you need a user. This requires e-mails to be sent. If your machine is
49 configured to send e-mail, that should work out well. If not, you can use the
50 Django E-Mail File Backend to "send" mails to a local folder:
52   mkdir inbox
54 Now, edit mygpo/settings_prod.py (or create it) and add the following lines:
56   import os.path
58   EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
59   EMAIL_FILE_PATH = os.path.join(os.path.dirname(__file__), '..', 'inbox')
62 Accessing the dev server from other devices
63 -------------------------------------------
65 Sometimes you might want to access the server from another machine than
66 localhost. In that case, you have to pass an additional argument to the
67 runserver command of manage.py, like this:
69   python manage.py runserver 0.0.0.0:8000
71 Beware, though, that this will expose the web service to your all networks
72 that your machine is connected to. Apply common sense and ideally use only
73 on trusted networks.
76 Installing database dumps (if you have any, that is)
77 ----------------------------------------------------
79 As easy as..
81   cd lib
82   hg clone https://code.google.com/p/couchdb-python/
83   cd couchdb-python
84   zcat /path/to/your.dump.gz | python couchdb/tools/load.py \
85                                       http://localhost:5984/mygpo
87 ..when you have created a dump like this:
89   python manage.py dump-sample --user=[username] | gzip > my.dump.gz
91 (where [username] is a specific user for which the data will be dumped)
93 Updating derived data
94 ---------------------
96 Certain data in the database is only calculated when you
97 run special commands. This is usually done regularly on
98 a production server using cron. You can also run these
99 commands regularly on your development machine:
101   cd mygpo
102   python manage.py update-categories
103   python manage.py update-toplist
104   python manage.py update-episode-toplist
106   python manage.py feed-downloader
107   python manage.py feed-downloader <feed-url> [...]
108   python manage.py feed-downloader --max <max-updates>
109   python manage.py feed-downloader --random --max <max-updates>
110   python manage.py feed-downloader --toplist --max <max-updates>
111   python manage.py feed-downloader --update-new --max <max-updates>
113 or to only do a dry run (this won't do any web requests for feeds):
115   python manage.py feed-downloader --list-only [other parameters]
118 Maintaining publisher relationships with user accounts
119 ------------------------------------------------------
121 To set a user as publisher for a given feed URL, use:
123   cd mygpo
124   python manage.py make-publisher <username> <feed-url> [...]
127 Resetting the database ("start from scratch")
128 ---------------------------------------------
130 Delete the database:
132   curl -X DELETE http://127.0.0.1:5984/mygpo
133   curl -X DELETE http://127.0.0.1:5984/mygpo_sessions
135 Recreate the design documents:
137   cd mygpo
138   python manage.py sync_couchdb
139   python manage.py sync-design-docs
142 Additional details on couchDB
143 -----------------------------
145 A source distribution of CouchDB can be obtained from
147  http://couchdb.apache.org/downloads.html
149 Build and installation instructions can be found at
151  http://wiki.apache.org/couchdb/Installation
153 Here are some rough instructions on how to build CouchDB 1.2.0 from source
154 and setting it up with a local user account:
156   (assuming you have downloaded and extracted the CouchDB 1.2.0 source)
157   sudo apt-get build-dep couchdb
158   export COUCHDB_HOME=~/pkg/apache-couchdb-1.2.0/
159   ./configure --prefix=$COUCHDB_HOME
160   make -j4 && make install
161   sudo useradd -d $COUCHDB_HOME/var/lib/couchdb couchdb
162   sudo chown -R couchdb: $COUCHDB_HOME
163   sudo chown -R root:couchdb $COUCHDB_HOME/etc/couchdb
164   sudo chmod 664 $COUCHDB_HOME/etc/couchdb/*.ini
165   sudo chmod 775 $COUCHDB_HOME/etc/couchdb/*.d
168 If you want to avoid installing a CouchDB server yourself, you can use a free
169 CouchDB hosting service, for example from
171  http://www.iriscouch.com/service
173 Please note, however, that hosted CouchDB services generally do not provide
174 security or authentication mechanisms, so this might only be useful for
175 development servers.
177 If you don't use a local database, you need to update the COUCHDB_DATABASES
178 setting (see the "Settings" section below).
182 1. Initializing an empty Database
184 To create the database, execute the following on the commandline
186   curl -X PUT http://127.0.0.1:5984/mygpo
188 To initialize the views, execute from the mygpo directory
190   python manage.py sync_couchdb
193 2. Importing a Dump
195 To import a CouchDB dump, execute the following from the commandline
197   gunzip -c <dumpfile.couch.gz> | couchdb-load http://127.0.0.1:5984/mygpo
202 Settings
203 --------
205 Check the settings in mygpo/settings.py. If you want to change any settings,
206 add them to mygpo/settings_prod.py with the correct value. If you want to
207 avoid warning messages on startup, simply:
209   touch mygpo/settings_prod.py
213 Web-Server
214 ----------
216 Django comes with a development webservice which you can run from the mygpo
217 directory with
219   python manage.py runserver
221 If you want to run a production server, check out
223  https://docs.djangoproject.com/en/dev/howto/deployment/