##// END OF EJS Templates
- First cut at some documentation corrections.
jfh -
r1089:fd4cd3c1 default
parent child Browse files
Show More
@@ -1,358 +1,366 b''
1 .. _setup:
1 .. _setup:
2
2
3 Setup
3 Setup
4 =====
4 =====
5
5
6
6
7 Setting up the application
7 Setting up RhodeCode
8 --------------------------
8 --------------------------
9
9
10 First You'll need to create RhodeCode config file. Run the following command
10 First, you will need to create a RhodeCode configuration file. Run the following
11 to do this
11 command to do this::
12
13 ::
14
12
15 paster make-config RhodeCode production.ini
13 paster make-config RhodeCode production.ini
16
14
17 - This will create `production.ini` config inside the directory
15 - This will create the file `production.ini` in the current directory. This
18 this config contains various settings for RhodeCode, e.g proxy port,
16 configuration file contains the various settings for RhodeCode, e.g proxy port,
19 email settings, usage of static files, cache, celery settings and logging.
17 email settings, usage of static files, cache, celery settings and logging.
20
18
21
19
22 Next we need to create the database. I'll recommend to use sqlite (default)
20 Next, you need to create the databases used by RhodeCode. I recommend that you
23 or postgresql. Make sure You properly adjust the db url in the .ini file to use
21 use sqlite (default) or postgresql. If you choose a database other than the
24 other than the default sqlite database
22 default ensure you properly adjust the db url in your production.ini
25
23 configuration file to use this other database. Create the databases by running
26
24 the following command::
27 ::
28
25
29 paster setup-app production.ini
26 paster setup-app production.ini
30
27
31 - This command will create all needed tables and an admin account.
28 This will prompt you for a "root" path. This "root" path is the location where
32 When asked for a path You can either use a new location of one with already
29 RhodeCode will store all of its repositories on the current machine. After
33 existing ones. RhodeCode will simply add all new found repositories to
30 entering this "root" path ``setup-app`` will also prompt you for a username and password
34 it's database. Also make sure You specify correct path to repositories.
31 for the initial admin account which ``setup-app`` sets up for you.
35 - Remember that the given path for mercurial_ repositories must be write
36 accessible for the application. It's very important since RhodeCode web
37 interface will work even without such an access but, when trying to do a
38 push it'll eventually fail with permission denied errors.
39
32
40 You are ready to use RhodeCode, to run it simply execute
33 - The ``setup-app`` command will create all of the needed tables and an admin
34 account. When choosing a root path You can either use a new empty location, or a
35 location which already contains existing repositories. If you choose a location
36 which contains existing repositories RhodeCode will simply add all of the
37 repositories at the chosen location to it's database. (Note: make sure you
38 specify the correct path to the root).
39 - Note: the given path for mercurial_ repositories **must** be write accessible
40 for the application. It's very important since the RhodeCode web interface will
41 work without write access, but when trying to do a push it will eventually fail
42 with permission denied errors unless it has write access.
41
43
42 ::
44 You are now ready to use RhodeCode, to run it simply execute::
43
45
44 paster serve production.ini
46 paster serve production.ini
45
47
46 - This command runs the RhodeCode server the app should be available at the
48 - This command runs the RhodeCode server. The web app should be available at the
47 127.0.0.1:5000. This ip and port is configurable via the production.ini
49 127.0.0.1:5000. This ip and port is configurable via the production.ini
48 file created in previous step
50 file created in previous step
49 - Use admin account you created to login.
51 - Use the admin account you created above when running ``setup-app`` to login to the web app.
50 - Default permissions on each repository is read, and owner is admin. So
52 - The default permissions on each repository is read, and the owner is admin.
51 remember to update these if needed. In the admin panel You can toggle ldap,
53 Remember to update these if needed.
52 anonymous, permissions settings. As well as edit more advanced options on
54 - In the admin panel You can toggle ldap, anonymous, permissions settings. As
53 users and repositories
55 well as edit more advanced options on users and repositories
54
56
57 Try copying your own mercurial repository into the "root" directory you are
58 using, then from within the RhodeCode web application choose Admin >
59 repositories. Then choose Add New Repository. Add the repository you copied into
60 the root. Test that you can browse your repository from within RhodCode and then
61 try cloning your repository from RhodeCode with::
62
63 hg clone http://127.0.0.1:5000/<repository name>
64
65 where *repository name* is replaced by the name of your repository.
66
55 Using RhodeCode with SSH
67 Using RhodeCode with SSH
56 ------------------------
68 ------------------------
57
69
58 RhodeCode repository structures are kept in directories with the same name
70 RhodeCode repository structures are kept in directories with the same name
59 as the project, when using repository groups, each group is a a subdirectory.
71 as the project, when using repository groups, each group is a subdirectory.
60 This will allow You to use ssh for accessing repositories quite easy. There
72 This will allow you to use ssh for accessing repositories quite easily. There
61 are some exceptions when using ssh for accessing repositories.
73 are some exceptions when using ssh for accessing repositories.
62
74
63 You have to make sure that the webserver as well as the ssh users have unix
75 You have to make sure that the web-server as well as the ssh users have unix
64 permission for directories. Secondly when using ssh rhodecode will not
76 permission for the appropriate directories. Secondly, when using ssh rhodecode
65 authenticate those requests and permissions set by the web interface will not
77 will not authenticate those requests and permissions set by the web interface
66 work on the repositories accessed via ssh. There is a solution to this to use
78 will not work on the repositories accessed via ssh. There is a solution to this
67 auth hooks, that connects to rhodecode db, and runs check functions for
79 to use auth hooks, that connects to rhodecode db, and runs check functions for
68 permissions.
80 permissions.
69
81
70
82
71 if Your main directory (the same as set in RhodeCode settings) is for example
83 If your main directory (the same as set in RhodeCode settings) is for example
72 set for to **/home/hg** and repository You are using is `rhodecode`
84 set to **/home/hg** and the repository you are using is named `rhodecode`, then
73
85 to clone via ssh you should run::
74 The command runned should look like this::
75
86
76 hg clone ssh://user@server.com/home/hg/rhodecode
87 hg clone ssh://user@server.com/home/hg/rhodecode
77
88
78 Using external tools such as mercurial server or using ssh key based auth is
89 Using external tools such as mercurial server or using ssh key based
79 fully supported.
90 authentication is fully supported.
80
91
81 Setting up Whoosh full text search
92 Setting up Whoosh full text search
82 ----------------------------------
93 ----------------------------------
83
94
84 Starting from version 1.1 whoosh index can be build using paster command.
95 Starting from version 1.1 the whoosh index can be build by using the paster
85 You have to specify the config file that stores location of index, and
96 command ``make-index``. To use ``make-index`` You must specify the configuration
86 location of repositories (`--repo-location`).
97 file that stores the location of the index, and the location of the repositories
98 (`--repo-location`).
87
99
88 There is possible also to pass `-f` to the options
100 You may optionally pass the option `-f` to enable a full index rebuild. Without
89 to enable full index rebuild. Without that indexing will run always in in
101 the `-f` option, indexing will run always in "incremental" mode.
90 incremental mode.
91
102
92 incremental mode::
103 For an incremental index build use::
93
104
94 paster make-index production.ini --repo-location=<location for repos>
105 paster make-index production.ini --repo-location=<location for repos>
95
106
96
107
97
108 For a full index rebuild use::
98 for full index rebuild You can use::
99
109
100 paster make-index production.ini -f --repo-location=<location for repos>
110 paster make-index production.ini -f --repo-location=<location for repos>
101
111
102 - For full text search You can either put crontab entry for
112 - For full text search you can either put crontab entry for
103
113
104 In order to do periodical index builds and keep Your index always up to date.
114 In order to do periodical index builds and keep your index always up to date.
105 It's recommended to do a crontab entry for incremental indexing.
115 It's recommended to do a crontab entry for incremental indexing.
106 An example entry might look like this
116 An example entry might look like this::
107
108 ::
109
117
110 /path/to/python/bin/paster /path/to/rhodecode/production.ini --repo-location=<location for repos>
118 /path/to/python/bin/paster /path/to/rhodecode/production.ini --repo-location=<location for repos>
111
119
112 When using incremental (default) mode whoosh will check last modification date
120 When using incremental mode (the default) whoosh will check the last
113 of each file and add it to reindex if newer file is available. Also indexing
121 modification date of each file and add it to be reindexed if a newer file is
114 daemon checks for removed files and removes them from index.
122 available. The indexing daemon checks for any removed files and removes them
123 from index.
115
124
116 Sometime You might want to rebuild index from scratch. You can do that using
125 If you want to rebuild index from scratch, you can use the `-f` flag as above,
117 the `-f` flag passed to paster command or, in admin panel You can check
126 or in the admin panel you can check `build from scratch` flag.
118 `build from scratch` flag.
119
127
120
128
121 Setting up LDAP support
129 Setting up LDAP support
122 -----------------------
130 -----------------------
123
131
124 RhodeCode starting from version 1.1 supports ldap authentication. In order
132 RhodeCode starting from version 1.1 supports ldap authentication. In order
125 to use LDAP, You have to install python-ldap_ package. This package is available
133 to use LDAP, you have to install python-ldap_ package. This package is available
126 via pypi, so You can install it by running
134 via pypi, so you can install it by running
127
135
128 ::
136 ::
129
137
130 easy_install python-ldap
138 easy_install python-ldap
131
139
132 ::
140 ::
133
141
134 pip install python-ldap
142 pip install python-ldap
135
143
136 .. note::
144 .. note::
137 python-ldap requires some certain libs on Your system, so before installing
145 python-ldap requires some certain libs on your system, so before installing
138 it check that You have at least `openldap`, and `sasl` libraries.
146 it check that you have at least `openldap`, and `sasl` libraries.
139
147
140 ldap settings are located in admin->ldap section,
148 ldap settings are located in admin->ldap section,
141
149
142 Here's a typical ldap setup::
150 Here's a typical ldap setup::
143
151
144 Enable ldap = checked #controls if ldap access is enabled
152 Enable ldap = checked #controls if ldap access is enabled
145 Host = host.domain.org #actual ldap server to connect
153 Host = host.domain.org #actual ldap server to connect
146 Port = 389 or 689 for ldaps #ldap server ports
154 Port = 389 or 689 for ldaps #ldap server ports
147 Enable LDAPS = unchecked #enable disable ldaps
155 Enable LDAPS = unchecked #enable disable ldaps
148 Account = <account> #access for ldap server(if required)
156 Account = <account> #access for ldap server(if required)
149 Password = <password> #password for ldap server(if required)
157 Password = <password> #password for ldap server(if required)
150 Base DN = uid=%(user)s,CN=users,DC=host,DC=domain,DC=org
158 Base DN = uid=%(user)s,CN=users,DC=host,DC=domain,DC=org
151
159
152
160
153 `Account` and `Password` are optional, and used for two-phase ldap
161 `Account` and `Password` are optional, and used for two-phase ldap
154 authentication so those are credentials to access Your ldap, if it doesn't
162 authentication so those are credentials to access your ldap, if it doesn't
155 support anonymous search/user lookups.
163 support anonymous search/user lookups.
156
164
157 Base DN must have %(user)s template inside, it's a placer where Your uid used
165 Base DN must have %(user)s template inside, it's a placer where your uid used
158 to login would go, it allows admins to specify not standard schema for uid
166 to login would go, it allows admins to specify not standard schema for uid
159 variable
167 variable
160
168
161 If all data are entered correctly, and `python-ldap` is properly installed
169 If all data are entered correctly, and `python-ldap` is properly installed
162 Users should be granted to access RhodeCode wit ldap accounts. When
170 Users should be granted to access RhodeCode wit ldap accounts. When
163 logging at the first time an special ldap account is created inside RhodeCode,
171 logging at the first time an special ldap account is created inside RhodeCode,
164 so You can control over permissions even on ldap users. If such user exists
172 so you can control over permissions even on ldap users. If such user exists
165 already in RhodeCode database ldap user with the same username would be not
173 already in RhodeCode database ldap user with the same username would be not
166 able to access RhodeCode.
174 able to access RhodeCode.
167
175
168 If You have problems with ldap access and believe You entered correct
176 If you have problems with ldap access and believe you entered correct
169 information check out the RhodeCode logs,any error messages sent from
177 information check out the RhodeCode logs,any error messages sent from
170 ldap will be saved there.
178 ldap will be saved there.
171
179
172
180
173
181
174 Setting Up Celery
182 Setting Up Celery
175 -----------------
183 -----------------
176
184
177 Since version 1.1 celery is configured by the rhodecode ini configuration files
185 Since version 1.1 celery is configured by the rhodecode ini configuration files
178 simply set use_celery=true in the ini file then add / change the configuration
186 simply set use_celery=true in the ini file then add / change the configuration
179 variables inside the ini file.
187 variables inside the ini file.
180
188
181 Remember that the ini files uses format with '.' not with '_' like celery
189 Remember that the ini files uses format with '.' not with '_' like celery
182 so for example setting `BROKER_HOST` in celery means setting `broker.host` in
190 so for example setting `BROKER_HOST` in celery means setting `broker.host` in
183 the config file.
191 the config file.
184
192
185 In order to make start using celery run::
193 In order to make start using celery run::
186
194
187 paster celeryd <configfile.ini>
195 paster celeryd <configfile.ini>
188
196
189
197
190 .. note::
198 .. note::
191 Make sure You run this command from same virtualenv, and with the same user
199 Make sure you run this command from same virtualenv, and with the same user
192 that rhodecode runs.
200 that rhodecode runs.
193
201
194 HTTPS support
202 HTTPS support
195 -------------
203 -------------
196
204
197 There are two ways to enable https, first is to set HTTP_X_URL_SCHEME in
205 There are two ways to enable https, first is to set HTTP_X_URL_SCHEME in
198 Your http server headers, than rhodecode will recognise this headers and make
206 your http server headers, than rhodecode will recognise this headers and make
199 proper https redirections, another way is to set `force_https = true`
207 proper https redirections, another way is to set `force_https = true`
200 in the ini cofiguration to force using https, no headers are needed than to
208 in the ini cofiguration to force using https, no headers are needed than to
201 enable https
209 enable https
202
210
203
211
204 Nginx virtual host example
212 Nginx virtual host example
205 --------------------------
213 --------------------------
206
214
207 Sample config for nginx using proxy::
215 Sample config for nginx using proxy::
208
216
209 server {
217 server {
210 listen 80;
218 listen 80;
211 server_name hg.myserver.com;
219 server_name hg.myserver.com;
212 access_log /var/log/nginx/rhodecode.access.log;
220 access_log /var/log/nginx/rhodecode.access.log;
213 error_log /var/log/nginx/rhodecode.error.log;
221 error_log /var/log/nginx/rhodecode.error.log;
214 location / {
222 location / {
215 root /var/www/rhodecode/rhodecode/public/;
223 root /var/www/rhodecode/rhodecode/public/;
216 if (!-f $request_filename){
224 if (!-f $request_filename){
217 proxy_pass http://127.0.0.1:5000;
225 proxy_pass http://127.0.0.1:5000;
218 }
226 }
219 #this is important if You want to use https !!!
227 #this is important if you want to use https !!!
220 proxy_set_header X-Url-Scheme $scheme;
228 proxy_set_header X-Url-Scheme $scheme;
221 include /etc/nginx/proxy.conf;
229 include /etc/nginx/proxy.conf;
222 }
230 }
223 }
231 }
224
232
225 Here's the proxy.conf. It's tuned so it'll not timeout on long
233 Here's the proxy.conf. It's tuned so it'll not timeout on long
226 pushes and also on large pushes::
234 pushes and also on large pushes::
227
235
228 proxy_redirect off;
236 proxy_redirect off;
229 proxy_set_header Host $host;
237 proxy_set_header Host $host;
230 proxy_set_header X-Host $http_host;
238 proxy_set_header X-Host $http_host;
231 proxy_set_header X-Real-IP $remote_addr;
239 proxy_set_header X-Real-IP $remote_addr;
232 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
240 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
233 proxy_set_header Proxy-host $proxy_host;
241 proxy_set_header Proxy-host $proxy_host;
234 client_max_body_size 400m;
242 client_max_body_size 400m;
235 client_body_buffer_size 128k;
243 client_body_buffer_size 128k;
236 proxy_buffering off;
244 proxy_buffering off;
237 proxy_connect_timeout 3600;
245 proxy_connect_timeout 3600;
238 proxy_send_timeout 3600;
246 proxy_send_timeout 3600;
239 proxy_read_timeout 3600;
247 proxy_read_timeout 3600;
240 proxy_buffer_size 16k;
248 proxy_buffer_size 16k;
241 proxy_buffers 4 16k;
249 proxy_buffers 4 16k;
242 proxy_busy_buffers_size 64k;
250 proxy_busy_buffers_size 64k;
243 proxy_temp_file_write_size 64k;
251 proxy_temp_file_write_size 64k;
244
252
245 Also when using root path with nginx You might set the static files to false
253 Also when using root path with nginx you might set the static files to false
246 in production.ini file::
254 in production.ini file::
247
255
248 [app:main]
256 [app:main]
249 use = egg:rhodecode
257 use = egg:rhodecode
250 full_stack = true
258 full_stack = true
251 static_files = false
259 static_files = false
252 lang=en
260 lang=en
253 cache_dir = %(here)s/data
261 cache_dir = %(here)s/data
254
262
255 To not have the statics served by the application. And improve speed.
263 To not have the statics served by the application. And improve speed.
256
264
257
265
258 Apache virtual host example
266 Apache virtual host example
259 ---------------------------
267 ---------------------------
260
268
261 Sample config for apache using proxy::
269 Sample config for apache using proxy::
262
270
263 <VirtualHost *:80>
271 <VirtualHost *:80>
264 ServerName hg.myserver.com
272 ServerName hg.myserver.com
265 ServerAlias hg.myserver.com
273 ServerAlias hg.myserver.com
266
274
267 <Proxy *>
275 <Proxy *>
268 Order allow,deny
276 Order allow,deny
269 Allow from all
277 Allow from all
270 </Proxy>
278 </Proxy>
271
279
272 #important !
280 #important !
273 #Directive to properly generate url (clone url) for pylons
281 #Directive to properly generate url (clone url) for pylons
274 ProxyPreserveHost On
282 ProxyPreserveHost On
275
283
276 #rhodecode instance
284 #rhodecode instance
277 ProxyPass / http://127.0.0.1:5000/
285 ProxyPass / http://127.0.0.1:5000/
278 ProxyPassReverse / http://127.0.0.1:5000/
286 ProxyPassReverse / http://127.0.0.1:5000/
279
287
280 #to enable https use line below
288 #to enable https use line below
281 #SetEnvIf X-Url-Scheme https HTTPS=1
289 #SetEnvIf X-Url-Scheme https HTTPS=1
282
290
283 </VirtualHost>
291 </VirtualHost>
284
292
285
293
286 Additional tutorial
294 Additional tutorial
287 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
295 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
288
296
289
297
290 Apache as subdirectory
298 Apache as subdirectory
291 ----------------------
299 ----------------------
292
300
293
301
294 Apache subdirectory part::
302 Apache subdirectory part::
295
303
296 <Location /rhodecode>
304 <Location /rhodecode>
297 ProxyPass http://127.0.0.1:59542/rhodecode
305 ProxyPass http://127.0.0.1:59542/rhodecode
298 ProxyPassReverse http://127.0.0.1:59542/rhodecode
306 ProxyPassReverse http://127.0.0.1:59542/rhodecode
299 SetEnvIf X-Url-Scheme https HTTPS=1
307 SetEnvIf X-Url-Scheme https HTTPS=1
300 </Location>
308 </Location>
301
309
302 Besides the regular apache setup You'll need to add such part to .ini file::
310 Besides the regular apache setup you will need to add such part to .ini file::
303
311
304 filter-with = proxy-prefix
312 filter-with = proxy-prefix
305
313
306 Add the following at the end of the .ini file::
314 Add the following at the end of the .ini file::
307
315
308 [filter:proxy-prefix]
316 [filter:proxy-prefix]
309 use = egg:PasteDeploy#prefix
317 use = egg:PasteDeploy#prefix
310 prefix = /<someprefix>
318 prefix = /<someprefix>
311
319
312
320
313 Apache's example FCGI config
321 Apache's example FCGI config
314 ----------------------------
322 ----------------------------
315
323
316 TODO !
324 TODO !
317
325
318 Other configuration files
326 Other configuration files
319 -------------------------
327 -------------------------
320
328
321 Some example init.d script can be found here, for debian and gentoo:
329 Some example init.d script can be found here, for debian and gentoo:
322
330
323 https://rhodeocode.org/rhodecode/files/tip/init.d
331 https://rhodeocode.org/rhodecode/files/tip/init.d
324
332
325
333
326 Troubleshooting
334 Troubleshooting
327 ---------------
335 ---------------
328
336
329 - missing static files ?
337 - missing static files ?
330
338
331 - make sure either to set the `static_files = true` in the .ini file or
339 - make sure either to set the `static_files = true` in the .ini file or
332 double check the root path for Your http setup. It should point to
340 double check the root path for your http setup. It should point to
333 for example:
341 for example:
334 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
342 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
335
343
336 - can't install celery/rabbitmq
344 - can't install celery/rabbitmq
337
345
338 - don't worry RhodeCode works without them too. No extra setup required
346 - don't worry RhodeCode works without them too. No extra setup required
339
347
340 - long lasting push timeouts ?
348 - long lasting push timeouts ?
341
349
342 - make sure You set a longer timeouts in Your proxy/fcgi settings, timeouts
350 - make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
343 are caused by https server and not RhodeCode
351 are caused by https server and not RhodeCode
344
352
345 - large pushes timeouts ?
353 - large pushes timeouts ?
346
354
347 - make sure You set a proper max_body_size for the http server
355 - make sure you set a proper max_body_size for the http server
348
356
349 - Apache doesn't pass basicAuth on pull/push ?
357 - Apache doesn't pass basicAuth on pull/push ?
350
358
351 - Make sure You added `WSGIPassAuthorization true`
359 - Make sure you added `WSGIPassAuthorization true`
352
360
353 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
361 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
354 .. _python: http://www.python.org/
362 .. _python: http://www.python.org/
355 .. _mercurial: http://mercurial.selenic.com/
363 .. _mercurial: http://mercurial.selenic.com/
356 .. _celery: http://celeryproject.org/
364 .. _celery: http://celeryproject.org/
357 .. _rabbitmq: http://www.rabbitmq.com/
365 .. _rabbitmq: http://www.rabbitmq.com/
358 .. _python-ldap: http://www.python-ldap.org/
366 .. _python-ldap: http://www.python-ldap.org/
General Comments 0
You need to be logged in to leave comments. Login now