Show More
@@ -1,262 +1,268 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 | ||
|
161 | .. note:: | |
|
162 | Make sure You run this command from same virtualenv, and with the same user | |
|
163 | that rhodecode runs. | |
|
164 | ||
|
165 | ||
|
160 | 166 | Nginx virtual host example |
|
161 | 167 | -------------------------- |
|
162 | 168 | |
|
163 | 169 | Sample config for nginx using proxy:: |
|
164 | 170 | |
|
165 | 171 | server { |
|
166 | 172 | listen 80; |
|
167 | 173 | server_name hg.myserver.com; |
|
168 | 174 | access_log /var/log/nginx/rhodecode.access.log; |
|
169 | 175 | error_log /var/log/nginx/rhodecode.error.log; |
|
170 | 176 | location / { |
|
171 | 177 | root /var/www/rhodecode/rhodecode/public/; |
|
172 | 178 | if (!-f $request_filename){ |
|
173 | 179 | proxy_pass http://127.0.0.1:5000; |
|
174 | 180 | } |
|
175 | 181 | #this is important for https !!! |
|
176 | 182 | proxy_set_header X-Url-Scheme $scheme; |
|
177 | 183 | include /etc/nginx/proxy.conf; |
|
178 | 184 | } |
|
179 | 185 | } |
|
180 | 186 | |
|
181 | 187 | Here's the proxy.conf. It's tuned so it'll not timeout on long |
|
182 | 188 | pushes and also on large pushes:: |
|
183 | 189 | |
|
184 | 190 | proxy_redirect off; |
|
185 | 191 | proxy_set_header Host $host; |
|
186 | 192 | proxy_set_header X-Host $http_host; |
|
187 | 193 | proxy_set_header X-Real-IP $remote_addr; |
|
188 | 194 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
189 | 195 | proxy_set_header Proxy-host $proxy_host; |
|
190 | 196 | client_max_body_size 400m; |
|
191 | 197 | client_body_buffer_size 128k; |
|
192 | 198 | proxy_buffering off; |
|
193 | 199 | proxy_connect_timeout 3600; |
|
194 | 200 | proxy_send_timeout 3600; |
|
195 | 201 | proxy_read_timeout 3600; |
|
196 | 202 | proxy_buffer_size 8k; |
|
197 | 203 | proxy_buffers 8 32k; |
|
198 | 204 | proxy_busy_buffers_size 64k; |
|
199 | 205 | proxy_temp_file_write_size 64k; |
|
200 | 206 | |
|
201 | 207 | Also when using root path with nginx You might set the static files to false |
|
202 | 208 | in production.ini file:: |
|
203 | 209 | |
|
204 | 210 | [app:main] |
|
205 | 211 | use = egg:rhodecode |
|
206 | 212 | full_stack = true |
|
207 | 213 | static_files = false |
|
208 | 214 | lang=en |
|
209 | 215 | cache_dir = %(here)s/data |
|
210 | 216 | |
|
211 | 217 | To not have the statics served by the application. And improve speed. |
|
212 | 218 | |
|
213 | 219 | Apache reverse proxy |
|
214 | 220 | -------------------- |
|
215 | 221 | Tutorial can be found here |
|
216 | 222 | http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons |
|
217 | 223 | |
|
218 | 224 | |
|
219 | 225 | Apache's example FCGI config |
|
220 | 226 | ---------------------------- |
|
221 | 227 | |
|
222 | 228 | TODO ! |
|
223 | 229 | |
|
224 | 230 | Other configuration files |
|
225 | 231 | ------------------------- |
|
226 | 232 | |
|
227 | 233 | Some extra configuration files and examples can be found here: |
|
228 | 234 | http://hg.python-works.com/rhodecode/files/tip/init.d |
|
229 | 235 | |
|
230 | 236 | and also an celeryconfig file can be use from here: |
|
231 | 237 | http://hg.python-works.com/rhodecode/files/tip/celeryconfig.py |
|
232 | 238 | |
|
233 | 239 | Troubleshooting |
|
234 | 240 | --------------- |
|
235 | 241 | |
|
236 | 242 | - missing static files ? |
|
237 | 243 | |
|
238 | 244 | - make sure either to set the `static_files = true` in the .ini file or |
|
239 | 245 | double check the root path for Your http setup. It should point to |
|
240 | 246 | for example: |
|
241 | 247 | /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public |
|
242 | 248 | |
|
243 | 249 | - can't install celery/rabbitmq |
|
244 | 250 | |
|
245 | 251 | - don't worry RhodeCode works without them too. No extra setup required |
|
246 | 252 | |
|
247 | 253 | - long lasting push timeouts ? |
|
248 | 254 | |
|
249 | 255 | - make sure You set a longer timeouts in Your proxy/fcgi settings, timeouts |
|
250 | 256 | are caused by https server and not RhodeCode |
|
251 | 257 | |
|
252 | 258 | - large pushes timeouts ? |
|
253 | 259 | |
|
254 | 260 | - make sure You set a proper max_body_size for the http server |
|
255 | 261 | |
|
256 | 262 | |
|
257 | 263 | |
|
258 | 264 | .. _virtualenv: http://pypi.python.org/pypi/virtualenv |
|
259 | 265 | .. _python: http://www.python.org/ |
|
260 | 266 | .. _mercurial: http://mercurial.selenic.com/ |
|
261 | 267 | .. _celery: http://celeryproject.org/ |
|
262 | 268 | .. _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