1 Deployment instructions for mygpo
2 =================================
8 When no version number is indicated, it is advisable to install the current
9 development version from the repository.
12 * [CouchDB](https://couchdb.apache.org/) (>= 1.2)
13 * [python-feedparser](https://github.com/kurtmckee/feedparser/)
14 * [python-dateutil](http://niemeyer.net/python-dateutil)
15 * [python-flup](http://trac.saddi.com/flup)
16 * [python-imaging](http://www.pythonware.com/products/pil/)
17 * [python-pybabel](http://babel.edgewall.org/)
18 * [python-gevent](http://www.gevent.org/)
19 * [couchdbkit](https://github.com/benoitc/couchdbkit)
20 * [Django](http://www.djangoproject.com/)
21 * [django-couchdb-utils](http://github.com/stefankoegl/django-couchdb-utils/)
27 Here's how you start from scratch with a new mygpo install (assuming a
28 Ubuntu 12.04 x86 install, 'should work' with other versions/archs as well).
30 If you are on a Debian/Ubuntu system, do:
32 sudo apt-get install erlang python-feedparser python-dateutil python-flup \
33 python-imaging python-pybabel python-restkit \
36 sudo apt-get build-dep couchdb
38 [ install couchdb 1.2.0 from source ]
40 Select a cozy place for the mygpo sources and clone it:
42 git clone git://github.com/gpodder/mygpo.git
45 Now install additional dependencies locally (you could also use virtualenv or
46 some other fancy stuff, but for now, let's keeps things simple):
51 git clone https://github.com/benoitc/couchdbkit.git
52 mv couchdbkit couchdbkit-git
53 ln -s couchdbkit-git/couchdbkit
55 wget https://www.djangoproject.com/download/1.4/tarball/ -O Django-1.4.tar.gz
56 tar xvf Django-1.4.tar.gz
58 ln -s Django-1.4/django
60 git clone https://github.com/stefankoegl/django-couchdb-utils.git
61 ln -s django-couchdb-utils/django_couchdb_utils
63 That's it for the setup. Now to initialize the DB:
65 python manage.py sync_couchdb
66 python manage.py sync-design-docs
70 python manage.py runserver
72 Ok, so you need a user. This requires e-mails to be sent. If your machine is
73 configured to send e-mail, that should work out well. If not, you can use the
74 Django E-Mail File Backend to "send" mails to a local folder:
78 Now, edit mygpo/settings_prod.py (or create it) and add the following lines:
82 EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
83 EMAIL_FILE_PATH = os.path.join(os.path.dirname(__file__), '..', 'inbox')
86 Accessing the dev server from other devices
87 -------------------------------------------
89 Sometimes you might want to access the server from another machine than
90 localhost. In that case, you have to pass an additional argument to the
91 runserver command of manage.py, like this:
93 python manage.py runserver 0.0.0.0:8000
95 Beware, though, that this will expose the web service to your all networks
96 that your machine is connected to. Apply common sense and ideally use only
100 Installing database dumps (if you have any, that is)
101 ----------------------------------------------------
106 hg clone https://code.google.com/p/couchdb-python/
108 zcat /path/to/your.dump.gz | python couchdb/tools/load.py \
109 http://localhost:5984/mygpo
111 ..when you have created a dump like this:
113 python manage.py dump-sample --user=[username] | gzip > my.dump.gz
115 (where [username] is a specific user for which the data will be dumped)
117 Updating derived data
118 ---------------------
120 Certain data in the database is only calculated when you
121 run special commands. This is usually done regularly on
122 a production server using cron. You can also run these
123 commands regularly on your development machine:
126 python manage.py update-categories
127 python manage.py update-toplist
128 python manage.py update-episode-toplist
130 python manage.py feed-downloader
131 python manage.py feed-downloader <feed-url> [...]
132 python manage.py feed-downloader --max <max-updates>
133 python manage.py feed-downloader --random --max <max-updates>
134 python manage.py feed-downloader --toplist --max <max-updates>
135 python manage.py feed-downloader --update-new --max <max-updates>
137 or to only do a dry run (this won't do any web requests for feeds):
139 python manage.py feed-downloader --list-only [other parameters]
142 Maintaining publisher relationships with user accounts
143 ------------------------------------------------------
145 To set a user as publisher for a given feed URL, use:
148 python manage.py make-publisher <username> <feed-url> [...]
151 Resetting the database ("start from scratch")
152 ---------------------------------------------
156 curl -X DELETE http://127.0.0.1:5984/mygpo
157 curl -X DELETE http://127.0.0.1:5984/mygpo_sessions
159 Recreate the design documents:
162 python manage.py sync_couchdb
163 python manage.py sync-design-docs
166 Additional details on couchDB
167 -----------------------------
169 A source distribution of CouchDB can be obtained from
171 http://couchdb.apache.org/downloads.html
173 Build and installation instructions can be found at
175 http://wiki.apache.org/couchdb/Installation
177 Here are some rough instructions on how to build CouchDB 1.2.0 from source
178 and setting it up with a local user account:
180 (assuming you have downloaded and extracted the CouchDB 1.2.0 source)
181 sudo apt-get build-dep couchdb
182 export COUCHDB_HOME=~/pkg/apache-couchdb-1.2.0/
183 ./configure --prefix=$COUCHDB_HOME
184 make -j4 && make install
185 sudo useradd -d $COUCHDB_HOME/var/lib/couchdb couchdb
186 sudo chown -R couchdb: $COUCHDB_HOME
187 sudo chown -R root:couchdb $COUCHDB_HOME/etc/couchdb
188 sudo chmod 664 $COUCHDB_HOME/etc/couchdb/*.ini
189 sudo chmod 775 $COUCHDB_HOME/etc/couchdb/*.d
192 If you want to avoid installing a CouchDB server yourself, you can use a free
193 CouchDB hosting service, for example from
195 http://www.iriscouch.com/service
197 Please note, however, that hosted CouchDB services generally do not provide
198 security or authentication mechanisms, so this might only be useful for
201 If you don't use a local database, you need to update the COUCHDB_DATABASES
202 setting (see the "Settings" section below).
206 1. Initializing an empty Database
208 To create the database, execute the following on the commandline
210 curl -X PUT http://127.0.0.1:5984/mygpo
212 To initialize the views, execute from the mygpo directory
214 python manage.py sync_couchdb
219 To import a CouchDB dump, execute the following from the commandline
221 gunzip -c <dumpfile.couch.gz> | couchdb-load http://127.0.0.1:5984/mygpo
229 Check the settings in mygpo/settings.py. If you want to change any settings,
230 add them to mygpo/settings_prod.py with the correct value. If you want to
231 avoid warning messages on startup, simply:
233 touch mygpo/settings_prod.py
240 Django comes with a development webservice which you can run from the mygpo
243 python manage.py runserver
245 If you want to run a production server, check out
247 https://docs.djangoproject.com/en/dev/howto/deployment/