Updated PT translation
[mygpo.git] / INSTALL.md
blob134f2c9697dd0cb2db11b27c18c9f5da2c77d9a0
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) or PyPy (tested with 2.0 beta1)
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 For creating logo thumbnails, install libraries for the various image formats.
29 They are used by the pillow library.
31     sudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev
33 Select a cozy place for the mygpo sources and clone it:
35     git clone git://github.com/gpodder/mygpo.git
36     cd mygpo
38 Now install additional dependencies locally (you could also use virtualenv or
39 some other fancy stuff):
41     pip install -r requirements.txt
43 That's it for the setup. Now to initialize the DB:
45     cd mygpo
46     python manage.py sync_couchdb
47     python manage.py sync-design-docs
49 ..and here we go:
51     python manage.py runserver
53 Ok, so you need a user. This requires e-mails to be sent. If your machine is
54 configured to send e-mail, that should work out well. If not, you can use the
55 Django E-Mail File Backend to "send" mails to a local folder:
57     mkdir inbox
59 Now, edit mygpo/settings_prod.py (or create it) and add the following lines:
61     import os.path
63     EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
64     EMAIL_FILE_PATH = os.path.join(os.path.dirname(__file__), '..', 'inbox')
67 Accessing the dev server from other devices
68 -------------------------------------------
70 Sometimes you might want to access the server from another machine than
71 localhost. In that case, you have to pass an additional argument to the
72 runserver command of manage.py, like this:
74     python manage.py runserver 0.0.0.0:8000
76 Beware, though, that this will expose the web service to your all networks
77 that your machine is connected to. Apply common sense and ideally use only
78 on trusted networks.
81 Installing database dumps (if you have any, that is)
82 ----------------------------------------------------
84 As easy as..
86     cd lib
87     hg clone https://code.google.com/p/couchdb-python/
88     cd couchdb-python
89     zcat /path/to/your.dump.gz | python couchdb/tools/load.py \
90                                         http://localhost:5984/mygpo
92 ..when you have created a dump like this:
94     python manage.py dump-sample --user=[username] | gzip > my.dump.gz
96 (where [username] is a specific user for which the data will be dumped)
98 Updating derived data
99 ---------------------
101 Certain data in the database is only calculated when you
102 run special commands. This is usually done regularly on
103 a production server using cron. You can also run these
104 commands regularly on your development machine:
106     cd mygpo
107     python manage.py update-categories
108     python manage.py update-toplist
109     python manage.py update-episode-toplist
111     python manage.py feed-downloader
112     python manage.py feed-downloader <feed-url> [...]
113     python manage.py feed-downloader --max <max-updates>
114     python manage.py feed-downloader --random --max <max-updates>
115     python manage.py feed-downloader --toplist --max <max-updates>
116     python manage.py feed-downloader --update-new --max <max-updates>
118 or to only do a dry run (this won't do any web requests for feeds):
120     python manage.py feed-downloader --list-only [other parameters]
123 Maintaining publisher relationships with user accounts
124 ------------------------------------------------------
126 To set a user as publisher for a given feed URL, use:
128     cd mygpo
129     python manage.py make-publisher <username> <feed-url> [...]
132 Resetting the database ("start from scratch")
133 ---------------------------------------------
135 Delete the database:
137     curl -X DELETE http://127.0.0.1:5984/mygpo
138     curl -X DELETE http://127.0.0.1:5984/mygpo_sessions
140 Recreate the design documents:
142     cd mygpo
143     python manage.py sync_couchdb
144     python manage.py sync-design-docs
147 Additional details on couchDB
148 -----------------------------
150 A source distribution of CouchDB can be obtained from
152    http://couchdb.apache.org/downloads.html
154 Build and installation instructions can be found at
156    http://wiki.apache.org/couchdb/Installation
158 Here are some rough instructions on how to build CouchDB 1.2.0 from source
159 and setting it up with a local user account:
161     (assuming you have downloaded and extracted the CouchDB 1.2.0 source)
162     sudo apt-get build-dep couchdb
163     export COUCHDB_HOME=~/pkg/apache-couchdb-1.2.0/
164     ./configure --prefix=$COUCHDB_HOME
165     make -j4 && make install
166     sudo useradd -d $COUCHDB_HOME/var/lib/couchdb couchdb
167     sudo chown -R couchdb: $COUCHDB_HOME
168     sudo chown -R root:couchdb $COUCHDB_HOME/etc/couchdb
169     sudo chmod 664 $COUCHDB_HOME/etc/couchdb/*.ini
170     sudo chmod 775 $COUCHDB_HOME/etc/couchdb/*.d
173 If you want to avoid installing a CouchDB server yourself, you can use a free
174 CouchDB hosting service, for example from
176    http://www.iriscouch.com/service
178 Please note, however, that hosted CouchDB services generally do not provide
179 security or authentication mechanisms, so this might only be useful for
180 development servers.
182 If you don't use a local database, you need to update the COUCHDB_DATABASES
183 setting (see the "Settings" section below).
187 Initializing an empty Database
188 ------------------------------
190 To create the database, execute the following on the commandline
192     curl -X PUT http://127.0.0.1:5984/mygpo
194 To initialize the views, execute from the mygpo directory
196     python manage.py sync_couchdb
199 Importing a Dump
200 ----------------
202 To import a CouchDB dump, execute the following from the commandline
204     gunzip -c <dumpfile.couch.gz> | couchdb-load http://127.0.0.1:5984/mygpo
209 Settings
210 --------
212 Check the settings in mygpo/settings.py. If you want to change any settings,
213 add them to mygpo/settings_prod.py with the correct value. If you want to
214 avoid warning messages on startup, simply:
216     touch mygpo/settings_prod.py
220 Web-Server
221 ----------
223 Django comes with a development webservice which you can run from the mygpo
224 directory with
226     python manage.py runserver
228 If you want to run a production server, check out
230    https://docs.djangoproject.com/en/dev/howto/deployment/