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