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