##// END OF EJS Templates
added detailed step-by-step installation instruction for windows
marcink -
r2358:69df04ee beta
parent child Browse files
Show More
@@ -0,0 +1,244 b''
1 .. _installation_win:
2
3
4 Step by step Installation for Windows
5 =====================================
6
7
8 RhodeCode step-by-step install Guide for Windows
9
10 Target OS: Windows XP SP3 English (Clean installation)
11 + All Windows Updates until 24-may-2012
12
13 Step1 - Install Visual Studio 2008 Express
14 ------------------------------------------
15
16
17 Optional: You can also install MingW, but VS2008 installation is easier
18
19 Download "Visual C++ 2008 Express Edition with SP1" from:
20 http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
21 (if not found or relocated, google for "visual studio 2008 express" for
22 updated link)
23
24 You can also download full ISO file for offline installation, just
25 choose "All - Offline Install ISO image file" in the previous page and
26 choose "Visual C++ 2008 Express" when installing.
27
28
29 .. note::
30
31 Silverlight Runtime and SQL Server 2008 Express Edition are not
32 required, you can uncheck them
33
34
35 Step2 - Install Python
36 ----------------------
37
38 Install Python 2.x.y (x >= 5) x86 version (32bit). DO NOT USE A 3.x version.
39 Download Python 2.x.y from:
40 http://www.python.org/download/
41
42 Choose "Windows Installer" (32bit version) not "Windows X86-64
43 Installer". While writing this guide, the latest version was v2.7.3.
44 Remember the specific major and minor version installed, because it will
45 be needed in the next step. In this case, it is "2.7".
46
47
48 Step3 - Install Win32py extensions
49 ----------------------------------
50
51 Download pywin32 from:
52 http://sourceforge.net/projects/pywin32/files/
53
54 - Click on "pywin32" folder
55 - Click on the first folder (in this case, Build 217, maybe newer when you try)
56 - Choose the file ending with ".win32-py2.x.exe" -> x being the minor
57 version of Python you installed (in this case, 7)
58 When writing this guide, the file was:
59 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
60
61
62 Step4 - Python BIN
63 ------------------
64
65 Add Python BIN folder to the path
66
67 You have to add the Python folder to the path, you can do it manually
68 (editing "PATH" environment variable) or using Windows Support Tools
69 that came preinstalled in Vista/7 and can be installed in Windows XP.
70
71 - Using support tools on WINDOWS XP:
72 If you use Windows XP you can install them using Windows XP CD and
73 navigating to \SUPPORT\TOOLS. There, execute Setup.EXE (not MSI).
74 Afterwards, open a CMD and type::
75
76 SETX PATH "%PATH%;[your-python-path]" -M
77
78 Close CMD (the path variable will be updated then)
79
80 - Using support tools on WINDOWS Vista/7:
81
82 Open a CMD and type::
83
84 SETX PATH "%PATH%;[your-python-path]" /M
85
86 Please substitute [your-python-path] with your Python installation path.
87 Typically: C:\\Python27
88
89
90 Step5 - RhodeCode folder structure
91 ----------------------------------
92
93 Create a RhodeCode folder structure
94
95 This is only a example to install RhodeCode, you can of course change
96 it. However, this guide will follow the proposed structure, so please
97 later adapt the paths if you change them. My recommendation is to use
98 folders with NO SPACES. But you can try if you are brave...
99
100 Create the following folder structure::
101
102 C:\RhodeCode
103 C:\RhodeCode\Bin
104 C:\RhodeCode\Env
105 C:\RhodeCode\Repos
106
107
108 Step6 - Install virtualenv
109 ---------------------------
110
111 Install Virtual Env for Python
112
113 Navigate to: http://www.virtualenv.org/en/latest/index.html#installation
114 Right click on "virtualenv.py" file and choose "Save link as...".
115 Download to C:\\RhodeCode (or whatever you want)
116 (the file is located at
117 https://raw.github.com/pypa/virtualenv/master/virtualenv.py)
118
119 Create a virtual Python environment in C:\\RhodeCode\\Env (or similar). To
120 do so, open a CMD (Python Path should be included in Step3), navigate
121 where you downloaded "virtualenv.py", and write::
122
123 python virtualenv.py C:\RhodeCode\Env
124
125 (--no-site-packages is now the default behaviour of virtualenv, no need
126 to include it)
127
128
129 Step7 - Install RhodeCode
130 -------------------------
131
132 Finally, install RhodeCode
133
134 Close previously opened command prompt/s, and open a Visual Studio 2008
135 Command Prompt (**IMPORTANT!!**). To do so, go to Start Menu, and then open
136 "Microsoft Visual C++ 2008 Express Edition" -> "Visual Studio Tools" ->
137 "Visual Studio 2008 Command Prompt"
138
139 In that CMD (loaded with VS2008 PATHs) type::
140
141 cd C:\RhodeCode\Env\Scripts (or similar)
142 activate
143
144 The prompt will change into "(Env) C:\\RhodeCode\\Env\\Scripts" or similar
145 (depending of your folder structure). Then type::
146
147 pip install rhodecode
148
149 (long step, please wait until fully complete)
150
151 Some warnings will appear, don't worry as they are normal.
152
153
154 Step8 - Configuring RhodeCode
155 -----------------------------
156
157
158 steps taken from http://packages.python.org/RhodeCode/setup.html
159
160 You have to use the same Visual Studio 2008 command prompt as Step7, so
161 if you closed it reopen it following the same commands (including the
162 "activate" one). When ready, just type::
163
164 cd C:\RhodeCode\Bin
165 paster make-config RhodeCode production.ini
166
167 Then, you must edit production.ini to fit your needs (ip address, ip
168 port, mail settings, database, whatever). I recommend using NotePad++
169 (free) or similar text editor, as it handles well the EndOfLine
170 character differences between Unix and Windows
171 (http://notepad-plus-plus.org/)
172
173 For the sake of simplicity lets run it with the default settings. After
174 your edits (if any), in the previous Command Prompt, type::
175
176 paster setup-rhodecode production.ini
177
178 (this time a NEW database will be installed, you must follow a different
179 step to later UPGRADE to a newer RhodeCode version)
180
181 The script will ask you for confirmation about creating a NEW database,
182 answer yes (y)
183 The script will ask you for repository path, answer C:\\RhodeCode\\Repos
184 (or similar)
185 The script will ask you for admin username and password, answer "admin"
186 + "123456" (or whatever you want)
187 The script will ask you for admin mail, answer "admin@xxxx.com" (or
188 whatever you want)
189
190 If you make some mistake and the script does not end, don't worry, start
191 it again.
192
193
194 Step9 - Running RhodeCode
195 -------------------------
196
197
198 In the previous command prompt, being in the C:\\RhodeCode\\Bin folder,
199 just type::
200
201 paster serve production.ini
202
203 Open yout web server, and go to http://127.0.0.1:5000
204
205 It works!! :-)
206
207 Remark:
208 If it does not work first time, just Ctrl-C the CMD process and start it
209 again. Don't forget the "http://" in Internet Explorer
210
211
212
213 What this Guide does not cover:
214
215 - Installing Celery
216 - Running RhodeCode as Windows Service. You can investigate here:
217
218 - http://pypi.python.org/pypi/wsgisvc
219 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
220 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
221
222 - Using Apache. You can investigate here:
223
224 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
225
226
227 Upgrading
228 =========
229
230 Stop running RhodeCode
231 Open a CommandPrompt like in Step7 (VS2008 path + activate) and type::
232
233 easy_install -U rhodecode
234 cd \RhodeCode\Bin
235
236 { backup your production.ini file now} ::
237
238 paster make-config RhodeCode production.ini
239
240 (check changes and update your production.ini accordingly) ::
241
242 paster upgrade-db production.ini (update database)
243
244 Full steps in http://packages.python.org/RhodeCode/upgrade.html No newline at end of file
@@ -1,124 +1,129 b''
1 .. _installation:
1 .. _installation:
2
2
3 ============
3 ============
4 Installation
4 Installation
5 ============
5 ============
6
6
7 ``RhodeCode`` is written entirely in Python. Before posting any issues make
7 ``RhodeCode`` is written entirely in Python. Before posting any issues make
8 sure, your not missing any system libraries and using right version of
8 sure, your not missing any system libraries and using right version of
9 libraries required by RhodeCode. There's also restriction in terms of mercurial
9 libraries required by RhodeCode. There's also restriction in terms of mercurial
10 clients. Minimal version of hg client known working fine with RhodeCode is
10 clients. Minimal version of hg client known working fine with RhodeCode is
11 **1.6**. If you're using older client, please upgrade.
11 **1.6**. If you're using older client, please upgrade.
12
12
13
13
14 Installing RhodeCode from Cheese Shop
14 Installing RhodeCode from Cheese Shop
15 -------------------------------------
15 -------------------------------------
16
16
17 Rhodecode requires python version 2.5 or higher.
17 Rhodecode requires python version 2.5 or higher.
18
18
19 The easiest way to install ``rhodecode`` is to run::
19 The easiest way to install ``rhodecode`` is to run::
20
20
21 easy_install rhodecode
21 easy_install rhodecode
22
22
23 Or::
23 Or::
24
24
25 pip install rhodecode
25 pip install rhodecode
26
26
27 If you prefer to install RhodeCode manually simply grab latest release from
27 If you prefer to install RhodeCode manually simply grab latest release from
28 http://pypi.python.org/pypi/RhodeCode, decompress the archive and run::
28 http://pypi.python.org/pypi/RhodeCode, decompress the archive and run::
29
29
30 python setup.py install
30 python setup.py install
31
31
32 Step by step installation example for Windows
33 ---------------------------------------------
32
34
33 Step by step installation example
35 :ref:`installation_win`
34 ---------------------------------
36
37
38 Step by step installation example for Linux
39 -------------------------------------------
35
40
36
41
37 For installing RhodeCode i highly recommend using separate virtualenv_. This
42 For installing RhodeCode i highly recommend using separate virtualenv_. This
38 way many required by RhodeCode libraries will remain sandboxed from your main
43 way many required by RhodeCode libraries will remain sandboxed from your main
39 python and making things less problematic when doing system python updates.
44 python and making things less problematic when doing system python updates.
40
45
41 - Assuming you have installed virtualenv_ create a new virtual environment
46 - Assuming you have installed virtualenv_ create a new virtual environment
42 using virtualenv command::
47 using virtualenv command::
43
48
44 virtualenv --no-site-packages /var/www/rhodecode-venv
49 virtualenv --no-site-packages /var/www/rhodecode-venv
45
50
46
51
47 .. note:: Using ``--no-site-packages`` when generating your
52 .. note:: Using ``--no-site-packages`` when generating your
48 virtualenv is **very important**. This flag provides the necessary
53 virtualenv is **very important**. This flag provides the necessary
49 isolation for running the set of packages required by
54 isolation for running the set of packages required by
50 RhodeCode. If you do not specify ``--no-site-packages``,
55 RhodeCode. If you do not specify ``--no-site-packages``,
51 it's possible that RhodeCode will not install properly into
56 it's possible that RhodeCode will not install properly into
52 the virtualenv, or, even if it does, may not run properly,
57 the virtualenv, or, even if it does, may not run properly,
53 depending on the packages you've already got installed into your
58 depending on the packages you've already got installed into your
54 Python's "main" site-packages dir.
59 Python's "main" site-packages dir.
55
60
56
61
57 - this will install new virtualenv_ into `/var/www/rhodecode-venv`.
62 - this will install new virtualenv_ into `/var/www/rhodecode-venv`.
58 - Activate the virtualenv_ by running::
63 - Activate the virtualenv_ by running::
59
64
60 source /var/www/rhodecode-venv/bin/activate
65 source /var/www/rhodecode-venv/bin/activate
61
66
62 .. note:: If you're using UNIX, *do not* use ``sudo`` to run the
67 .. note:: If you're using UNIX, *do not* use ``sudo`` to run the
63 ``virtualenv`` script. It's perfectly acceptable (and desirable)
68 ``virtualenv`` script. It's perfectly acceptable (and desirable)
64 to create a virtualenv as a normal user.
69 to create a virtualenv as a normal user.
65
70
66 - Make a folder for rhodecode data files, and configuration somewhere on the
71 - Make a folder for rhodecode data files, and configuration somewhere on the
67 filesystem. For example::
72 filesystem. For example::
68
73
69 mkdir /var/www/rhodecode
74 mkdir /var/www/rhodecode
70
75
71
76
72 - Go into the created directory run this command to install rhodecode::
77 - Go into the created directory run this command to install rhodecode::
73
78
74 easy_install rhodecode
79 easy_install rhodecode
75
80
76 or::
81 or::
77
82
78 pip install rhodecode
83 pip install rhodecode
79
84
80 - This will install rhodecode together with pylons and all other required
85 - This will install rhodecode together with pylons and all other required
81 python libraries into activated virtualenv
86 python libraries into activated virtualenv
82
87
83 Requirements for Celery (optional)
88 Requirements for Celery (optional)
84 ----------------------------------
89 ----------------------------------
85
90
86 In order to gain maximum performance
91 In order to gain maximum performance
87 there are some third-party you must install. When RhodeCode is used
92 there are some third-party you must install. When RhodeCode is used
88 together with celery you have to install some kind of message broker,
93 together with celery you have to install some kind of message broker,
89 recommended one is rabbitmq_ to make the async tasks work.
94 recommended one is rabbitmq_ to make the async tasks work.
90
95
91 Of course RhodeCode works in sync mode also and then you do not have to install
96 Of course RhodeCode works in sync mode also and then you do not have to install
92 any third party applications. However, using Celery_ will give you a large
97 any third party applications. However, using Celery_ will give you a large
93 speed improvement when using many big repositories. If you plan to use
98 speed improvement when using many big repositories. If you plan to use
94 RhodeCode for say 7 to 10 repositories, RhodeCode will perform perfectly well
99 RhodeCode for say 7 to 10 repositories, RhodeCode will perform perfectly well
95 without celery running.
100 without celery running.
96
101
97 If you make the decision to run RhodeCode with celery make sure you run
102 If you make the decision to run RhodeCode with celery make sure you run
98 celeryd using paster and message broker together with the application.
103 celeryd using paster and message broker together with the application.
99
104
100 .. note::
105 .. note::
101 Installing message broker and using celery is optional, RhodeCode will
106 Installing message broker and using celery is optional, RhodeCode will
102 work perfectly fine without them.
107 work perfectly fine without them.
103
108
104
109
105 **Message Broker**
110 **Message Broker**
106
111
107 - preferred is `RabbitMq <http://www.rabbitmq.com/>`_
112 - preferred is `RabbitMq <http://www.rabbitmq.com/>`_
108 - A possible alternative is `Redis <http://code.google.com/p/redis/>`_
113 - A possible alternative is `Redis <http://code.google.com/p/redis/>`_
109
114
110 For installation instructions you can visit:
115 For installation instructions you can visit:
111 http://ask.github.com/celery/getting-started/index.html.
116 http://ask.github.com/celery/getting-started/index.html.
112 This is a very nice tutorial on how to start using celery_ with rabbitmq_
117 This is a very nice tutorial on how to start using celery_ with rabbitmq_
113
118
114
119
115 You can now proceed to :ref:`setup`
120 You can now proceed to :ref:`setup`
116 -----------------------------------
121 -----------------------------------
117
122
118
123
119
124
120 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
125 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
121 .. _python: http://www.python.org/
126 .. _python: http://www.python.org/
122 .. _mercurial: http://mercurial.selenic.com/
127 .. _mercurial: http://mercurial.selenic.com/
123 .. _celery: http://celeryproject.org/
128 .. _celery: http://celeryproject.org/
124 .. _rabbitmq: http://www.rabbitmq.com/ No newline at end of file
129 .. _rabbitmq: http://www.rabbitmq.com/
@@ -1,732 +1,737 b''
1 .. _setup:
1 .. _setup:
2
2
3 =====
3 =====
4 Setup
4 Setup
5 =====
5 =====
6
6
7
7
8 Setting up RhodeCode
8 Setting up RhodeCode
9 --------------------
9 --------------------
10
10
11 First, you will need to create a RhodeCode configuration file. Run the
11 First, you will need to create a RhodeCode configuration file. Run the
12 following command to do this::
12 following command to do this::
13
13
14 paster make-config RhodeCode production.ini
14 paster make-config RhodeCode production.ini
15
15
16 - This will create the file `production.ini` in the current directory. This
16 - This will create the file `production.ini` in the current directory. This
17 configuration file contains the various settings for RhodeCode, e.g proxy
17 configuration file contains the various settings for RhodeCode, e.g proxy
18 port, email settings, usage of static files, cache, celery settings and
18 port, email settings, usage of static files, cache, celery settings and
19 logging.
19 logging.
20
20
21
21
22 Next, you need to create the databases used by RhodeCode. I recommend that you
22 Next, you need to create the databases used by RhodeCode. I recommend that you
23 use postgresql or sqlite (default). If you choose a database other than the
23 use postgresql or sqlite (default). If you choose a database other than the
24 default ensure you properly adjust the db url in your production.ini
24 default ensure you properly adjust the db url in your production.ini
25 configuration file to use this other database. RhodeCode currently supports
25 configuration file to use this other database. RhodeCode currently supports
26 postgresql, sqlite and mysql databases. Create the database by running
26 postgresql, sqlite and mysql databases. Create the database by running
27 the following command::
27 the following command::
28
28
29 paster setup-rhodecode production.ini
29 paster setup-rhodecode production.ini
30
30
31 This will prompt you for a "root" path. This "root" path is the location where
31 This will prompt you for a "root" path. This "root" path is the location where
32 RhodeCode will store all of its repositories on the current machine. After
32 RhodeCode will store all of its repositories on the current machine. After
33 entering this "root" path ``setup-rhodecode`` will also prompt you for a username
33 entering this "root" path ``setup-rhodecode`` will also prompt you for a username
34 and password for the initial admin account which ``setup-rhodecode`` sets
34 and password for the initial admin account which ``setup-rhodecode`` sets
35 up for you.
35 up for you.
36
36
37 setup process can be fully automated, example for lazy::
38
39 paster setup-rhodecode production.ini --user=marcink --password=secret --email=marcin@rhodecode.org --repos=/home/marcink/my_repos
40
41
37 - The ``setup-rhodecode`` command will create all of the needed tables and an
42 - The ``setup-rhodecode`` command will create all of the needed tables and an
38 admin account. When choosing a root path you can either use a new empty
43 admin account. When choosing a root path you can either use a new empty
39 location, or a location which already contains existing repositories. If you
44 location, or a location which already contains existing repositories. If you
40 choose a location which contains existing repositories RhodeCode will simply
45 choose a location which contains existing repositories RhodeCode will simply
41 add all of the repositories at the chosen location to it's database.
46 add all of the repositories at the chosen location to it's database.
42 (Note: make sure you specify the correct path to the root).
47 (Note: make sure you specify the correct path to the root).
43 - Note: the given path for mercurial_ repositories **must** be write accessible
48 - Note: the given path for mercurial_ repositories **must** be write accessible
44 for the application. It's very important since the RhodeCode web interface
49 for the application. It's very important since the RhodeCode web interface
45 will work without write access, but when trying to do a push it will
50 will work without write access, but when trying to do a push it will
46 eventually fail with permission denied errors unless it has write access.
51 eventually fail with permission denied errors unless it has write access.
47
52
48 You are now ready to use RhodeCode, to run it simply execute::
53 You are now ready to use RhodeCode, to run it simply execute::
49
54
50 paster serve production.ini
55 paster serve production.ini
51
56
52 - This command runs the RhodeCode server. The web app should be available at the
57 - This command runs the RhodeCode server. The web app should be available at the
53 127.0.0.1:5000. This ip and port is configurable via the production.ini
58 127.0.0.1:5000. This ip and port is configurable via the production.ini
54 file created in previous step
59 file created in previous step
55 - Use the admin account you created above when running ``setup-rhodecode``
60 - Use the admin account you created above when running ``setup-rhodecode``
56 to login to the web app.
61 to login to the web app.
57 - The default permissions on each repository is read, and the owner is admin.
62 - The default permissions on each repository is read, and the owner is admin.
58 Remember to update these if needed.
63 Remember to update these if needed.
59 - In the admin panel you can toggle ldap, anonymous, permissions settings. As
64 - In the admin panel you can toggle ldap, anonymous, permissions settings. As
60 well as edit more advanced options on users and repositories
65 well as edit more advanced options on users and repositories
61
66
62 Optionally users can create `rcextensions` package that extends RhodeCode
67 Optionally users can create `rcextensions` package that extends RhodeCode
63 functionality. To do this simply execute::
68 functionality. To do this simply execute::
64
69
65 paster make-rcext production.ini
70 paster make-rcext production.ini
66
71
67 This will create `rcextensions` package in the same place that your `ini` file
72 This will create `rcextensions` package in the same place that your `ini` file
68 lives. With `rcextensions` it's possible to add additional mapping for whoosh,
73 lives. With `rcextensions` it's possible to add additional mapping for whoosh,
69 stats and add additional code into the push/pull/create repo hooks. For example
74 stats and add additional code into the push/pull/create repo hooks. For example
70 for sending signals to build-bots such as jenkins.
75 for sending signals to build-bots such as jenkins.
71 Please see the `__init__.py` file inside `rcextensions` package
76 Please see the `__init__.py` file inside `rcextensions` package
72 for more details.
77 for more details.
73
78
74
79
75 Using RhodeCode with SSH
80 Using RhodeCode with SSH
76 ------------------------
81 ------------------------
77
82
78 RhodeCode currently only hosts repositories using http and https. (The addition
83 RhodeCode currently only hosts repositories using http and https. (The addition
79 of ssh hosting is a planned future feature.) However you can easily use ssh in
84 of ssh hosting is a planned future feature.) However you can easily use ssh in
80 parallel with RhodeCode. (Repository access via ssh is a standard "out of
85 parallel with RhodeCode. (Repository access via ssh is a standard "out of
81 the box" feature of mercurial_ and you can use this to access any of the
86 the box" feature of mercurial_ and you can use this to access any of the
82 repositories that RhodeCode is hosting. See PublishingRepositories_)
87 repositories that RhodeCode is hosting. See PublishingRepositories_)
83
88
84 RhodeCode repository structures are kept in directories with the same name
89 RhodeCode repository structures are kept in directories with the same name
85 as the project. When using repository groups, each group is a subdirectory.
90 as the project. When using repository groups, each group is a subdirectory.
86 This allows you to easily use ssh for accessing repositories.
91 This allows you to easily use ssh for accessing repositories.
87
92
88 In order to use ssh you need to make sure that your web-server and the users
93 In order to use ssh you need to make sure that your web-server and the users
89 login accounts have the correct permissions set on the appropriate directories.
94 login accounts have the correct permissions set on the appropriate directories.
90 (Note that these permissions are independent of any permissions you have set up
95 (Note that these permissions are independent of any permissions you have set up
91 using the RhodeCode web interface.)
96 using the RhodeCode web interface.)
92
97
93 If your main directory (the same as set in RhodeCode settings) is for example
98 If your main directory (the same as set in RhodeCode settings) is for example
94 set to **/home/hg** and the repository you are using is named `rhodecode`, then
99 set to **/home/hg** and the repository you are using is named `rhodecode`, then
95 to clone via ssh you should run::
100 to clone via ssh you should run::
96
101
97 hg clone ssh://user@server.com/home/hg/rhodecode
102 hg clone ssh://user@server.com/home/hg/rhodecode
98
103
99 Using other external tools such as mercurial-server_ or using ssh key based
104 Using other external tools such as mercurial-server_ or using ssh key based
100 authentication is fully supported.
105 authentication is fully supported.
101
106
102 Note: In an advanced setup, in order for your ssh access to use the same
107 Note: In an advanced setup, in order for your ssh access to use the same
103 permissions as set up via the RhodeCode web interface, you can create an
108 permissions as set up via the RhodeCode web interface, you can create an
104 authentication hook to connect to the rhodecode db and runs check functions for
109 authentication hook to connect to the rhodecode db and runs check functions for
105 permissions against that.
110 permissions against that.
106
111
107 Setting up Whoosh full text search
112 Setting up Whoosh full text search
108 ----------------------------------
113 ----------------------------------
109
114
110 Starting from version 1.1 the whoosh index can be build by using the paster
115 Starting from version 1.1 the whoosh index can be build by using the paster
111 command ``make-index``. To use ``make-index`` you must specify the configuration
116 command ``make-index``. To use ``make-index`` you must specify the configuration
112 file that stores the location of the index. You may specify the location of the
117 file that stores the location of the index. You may specify the location of the
113 repositories (`--repo-location`). If not specified, this value is retrieved
118 repositories (`--repo-location`). If not specified, this value is retrieved
114 from the RhodeCode database. This was required prior to 1.2. Starting from
119 from the RhodeCode database. This was required prior to 1.2. Starting from
115 version 1.2 it is also possible to specify a comma separated list of
120 version 1.2 it is also possible to specify a comma separated list of
116 repositories (`--index-only`) to build index only on chooses repositories
121 repositories (`--index-only`) to build index only on chooses repositories
117 skipping any other found in repos location
122 skipping any other found in repos location
118
123
119 You may optionally pass the option `-f` to enable a full index rebuild. Without
124 You may optionally pass the option `-f` to enable a full index rebuild. Without
120 the `-f` option, indexing will run always in "incremental" mode.
125 the `-f` option, indexing will run always in "incremental" mode.
121
126
122 For an incremental index build use::
127 For an incremental index build use::
123
128
124 paster make-index production.ini
129 paster make-index production.ini
125
130
126 For a full index rebuild use::
131 For a full index rebuild use::
127
132
128 paster make-index production.ini -f
133 paster make-index production.ini -f
129
134
130
135
131 building index just for chosen repositories is possible with such command::
136 building index just for chosen repositories is possible with such command::
132
137
133 paster make-index production.ini --index-only=vcs,rhodecode
138 paster make-index production.ini --index-only=vcs,rhodecode
134
139
135
140
136 In order to do periodical index builds and keep your index always up to date.
141 In order to do periodical index builds and keep your index always up to date.
137 It's recommended to do a crontab entry for incremental indexing.
142 It's recommended to do a crontab entry for incremental indexing.
138 An example entry might look like this::
143 An example entry might look like this::
139
144
140 /path/to/python/bin/paster make-index /path/to/rhodecode/production.ini
145 /path/to/python/bin/paster make-index /path/to/rhodecode/production.ini
141
146
142 When using incremental mode (the default) whoosh will check the last
147 When using incremental mode (the default) whoosh will check the last
143 modification date of each file and add it to be reindexed if a newer file is
148 modification date of each file and add it to be reindexed if a newer file is
144 available. The indexing daemon checks for any removed files and removes them
149 available. The indexing daemon checks for any removed files and removes them
145 from index.
150 from index.
146
151
147 If you want to rebuild index from scratch, you can use the `-f` flag as above,
152 If you want to rebuild index from scratch, you can use the `-f` flag as above,
148 or in the admin panel you can check `build from scratch` flag.
153 or in the admin panel you can check `build from scratch` flag.
149
154
150
155
151 Setting up LDAP support
156 Setting up LDAP support
152 -----------------------
157 -----------------------
153
158
154 RhodeCode starting from version 1.1 supports ldap authentication. In order
159 RhodeCode starting from version 1.1 supports ldap authentication. In order
155 to use LDAP, you have to install the python-ldap_ package. This package is
160 to use LDAP, you have to install the python-ldap_ package. This package is
156 available via pypi, so you can install it by running
161 available via pypi, so you can install it by running
157
162
158 using easy_install::
163 using easy_install::
159
164
160 easy_install python-ldap
165 easy_install python-ldap
161
166
162 using pip::
167 using pip::
163
168
164 pip install python-ldap
169 pip install python-ldap
165
170
166 .. note::
171 .. note::
167 python-ldap requires some certain libs on your system, so before installing
172 python-ldap requires some certain libs on your system, so before installing
168 it check that you have at least `openldap`, and `sasl` libraries.
173 it check that you have at least `openldap`, and `sasl` libraries.
169
174
170 LDAP settings are located in admin->ldap section,
175 LDAP settings are located in admin->ldap section,
171
176
172 Here's a typical ldap setup::
177 Here's a typical ldap setup::
173
178
174 Connection settings
179 Connection settings
175 Enable LDAP = checked
180 Enable LDAP = checked
176 Host = host.example.org
181 Host = host.example.org
177 Port = 389
182 Port = 389
178 Account = <account>
183 Account = <account>
179 Password = <password>
184 Password = <password>
180 Connection Security = LDAPS connection
185 Connection Security = LDAPS connection
181 Certificate Checks = DEMAND
186 Certificate Checks = DEMAND
182
187
183 Search settings
188 Search settings
184 Base DN = CN=users,DC=host,DC=example,DC=org
189 Base DN = CN=users,DC=host,DC=example,DC=org
185 LDAP Filter = (&(objectClass=user)(!(objectClass=computer)))
190 LDAP Filter = (&(objectClass=user)(!(objectClass=computer)))
186 LDAP Search Scope = SUBTREE
191 LDAP Search Scope = SUBTREE
187
192
188 Attribute mappings
193 Attribute mappings
189 Login Attribute = uid
194 Login Attribute = uid
190 First Name Attribute = firstName
195 First Name Attribute = firstName
191 Last Name Attribute = lastName
196 Last Name Attribute = lastName
192 E-mail Attribute = mail
197 E-mail Attribute = mail
193
198
194 .. _enable_ldap:
199 .. _enable_ldap:
195
200
196 Enable LDAP : required
201 Enable LDAP : required
197 Whether to use LDAP for authenticating users.
202 Whether to use LDAP for authenticating users.
198
203
199 .. _ldap_host:
204 .. _ldap_host:
200
205
201 Host : required
206 Host : required
202 LDAP server hostname or IP address.
207 LDAP server hostname or IP address.
203
208
204 .. _Port:
209 .. _Port:
205
210
206 Port : required
211 Port : required
207 389 for un-encrypted LDAP, 636 for SSL-encrypted LDAP.
212 389 for un-encrypted LDAP, 636 for SSL-encrypted LDAP.
208
213
209 .. _ldap_account:
214 .. _ldap_account:
210
215
211 Account : optional
216 Account : optional
212 Only required if the LDAP server does not allow anonymous browsing of
217 Only required if the LDAP server does not allow anonymous browsing of
213 records. This should be a special account for record browsing. This
218 records. This should be a special account for record browsing. This
214 will require `LDAP Password`_ below.
219 will require `LDAP Password`_ below.
215
220
216 .. _LDAP Password:
221 .. _LDAP Password:
217
222
218 Password : optional
223 Password : optional
219 Only required if the LDAP server does not allow anonymous browsing of
224 Only required if the LDAP server does not allow anonymous browsing of
220 records.
225 records.
221
226
222 .. _Enable LDAPS:
227 .. _Enable LDAPS:
223
228
224 Connection Security : required
229 Connection Security : required
225 Defines the connection to LDAP server
230 Defines the connection to LDAP server
226
231
227 No encryption
232 No encryption
228 Plain non encrypted connection
233 Plain non encrypted connection
229
234
230 LDAPS connection
235 LDAPS connection
231 Enable ldaps connection. It will likely require `Port`_ to be set to
236 Enable ldaps connection. It will likely require `Port`_ to be set to
232 a different value (standard LDAPS port is 636). When LDAPS is enabled
237 a different value (standard LDAPS port is 636). When LDAPS is enabled
233 then `Certificate Checks`_ is required.
238 then `Certificate Checks`_ is required.
234
239
235 START_TLS on LDAP connection
240 START_TLS on LDAP connection
236 START TLS connection
241 START TLS connection
237
242
238 .. _Certificate Checks:
243 .. _Certificate Checks:
239
244
240 Certificate Checks : optional
245 Certificate Checks : optional
241 How SSL certificates verification is handled - this is only useful when
246 How SSL certificates verification is handled - this is only useful when
242 `Enable LDAPS`_ is enabled. Only DEMAND or HARD offer full SSL security
247 `Enable LDAPS`_ is enabled. Only DEMAND or HARD offer full SSL security
243 while the other options are susceptible to man-in-the-middle attacks. SSL
248 while the other options are susceptible to man-in-the-middle attacks. SSL
244 certificates can be installed to /etc/openldap/cacerts so that the
249 certificates can be installed to /etc/openldap/cacerts so that the
245 DEMAND or HARD options can be used with self-signed certificates or
250 DEMAND or HARD options can be used with self-signed certificates or
246 certificates that do not have traceable certificates of authority.
251 certificates that do not have traceable certificates of authority.
247
252
248 NEVER
253 NEVER
249 A serve certificate will never be requested or checked.
254 A serve certificate will never be requested or checked.
250
255
251 ALLOW
256 ALLOW
252 A server certificate is requested. Failure to provide a
257 A server certificate is requested. Failure to provide a
253 certificate or providing a bad certificate will not terminate the
258 certificate or providing a bad certificate will not terminate the
254 session.
259 session.
255
260
256 TRY
261 TRY
257 A server certificate is requested. Failure to provide a
262 A server certificate is requested. Failure to provide a
258 certificate does not halt the session; providing a bad certificate
263 certificate does not halt the session; providing a bad certificate
259 halts the session.
264 halts the session.
260
265
261 DEMAND
266 DEMAND
262 A server certificate is requested and must be provided and
267 A server certificate is requested and must be provided and
263 authenticated for the session to proceed.
268 authenticated for the session to proceed.
264
269
265 HARD
270 HARD
266 The same as DEMAND.
271 The same as DEMAND.
267
272
268 .. _Base DN:
273 .. _Base DN:
269
274
270 Base DN : required
275 Base DN : required
271 The Distinguished Name (DN) where searches for users will be performed.
276 The Distinguished Name (DN) where searches for users will be performed.
272 Searches can be controlled by `LDAP Filter`_ and `LDAP Search Scope`_.
277 Searches can be controlled by `LDAP Filter`_ and `LDAP Search Scope`_.
273
278
274 .. _LDAP Filter:
279 .. _LDAP Filter:
275
280
276 LDAP Filter : optional
281 LDAP Filter : optional
277 A LDAP filter defined by RFC 2254. This is more useful when `LDAP
282 A LDAP filter defined by RFC 2254. This is more useful when `LDAP
278 Search Scope`_ is set to SUBTREE. The filter is useful for limiting
283 Search Scope`_ is set to SUBTREE. The filter is useful for limiting
279 which LDAP objects are identified as representing Users for
284 which LDAP objects are identified as representing Users for
280 authentication. The filter is augmented by `Login Attribute`_ below.
285 authentication. The filter is augmented by `Login Attribute`_ below.
281 This can commonly be left blank.
286 This can commonly be left blank.
282
287
283 .. _LDAP Search Scope:
288 .. _LDAP Search Scope:
284
289
285 LDAP Search Scope : required
290 LDAP Search Scope : required
286 This limits how far LDAP will search for a matching object.
291 This limits how far LDAP will search for a matching object.
287
292
288 BASE
293 BASE
289 Only allows searching of `Base DN`_ and is usually not what you
294 Only allows searching of `Base DN`_ and is usually not what you
290 want.
295 want.
291
296
292 ONELEVEL
297 ONELEVEL
293 Searches all entries under `Base DN`_, but not Base DN itself.
298 Searches all entries under `Base DN`_, but not Base DN itself.
294
299
295 SUBTREE
300 SUBTREE
296 Searches all entries below `Base DN`_, but not Base DN itself.
301 Searches all entries below `Base DN`_, but not Base DN itself.
297 When using SUBTREE `LDAP Filter`_ is useful to limit object
302 When using SUBTREE `LDAP Filter`_ is useful to limit object
298 location.
303 location.
299
304
300 .. _Login Attribute:
305 .. _Login Attribute:
301
306
302 Login Attribute : required
307 Login Attribute : required
303 The LDAP record attribute that will be matched as the USERNAME or
308 The LDAP record attribute that will be matched as the USERNAME or
304 ACCOUNT used to connect to RhodeCode. This will be added to `LDAP
309 ACCOUNT used to connect to RhodeCode. This will be added to `LDAP
305 Filter`_ for locating the User object. If `LDAP Filter`_ is specified as
310 Filter`_ for locating the User object. If `LDAP Filter`_ is specified as
306 "LDAPFILTER", `Login Attribute`_ is specified as "uid" and the user has
311 "LDAPFILTER", `Login Attribute`_ is specified as "uid" and the user has
307 connected as "jsmith" then the `LDAP Filter`_ will be augmented as below
312 connected as "jsmith" then the `LDAP Filter`_ will be augmented as below
308 ::
313 ::
309
314
310 (&(LDAPFILTER)(uid=jsmith))
315 (&(LDAPFILTER)(uid=jsmith))
311
316
312 .. _ldap_attr_firstname:
317 .. _ldap_attr_firstname:
313
318
314 First Name Attribute : required
319 First Name Attribute : required
315 The LDAP record attribute which represents the user's first name.
320 The LDAP record attribute which represents the user's first name.
316
321
317 .. _ldap_attr_lastname:
322 .. _ldap_attr_lastname:
318
323
319 Last Name Attribute : required
324 Last Name Attribute : required
320 The LDAP record attribute which represents the user's last name.
325 The LDAP record attribute which represents the user's last name.
321
326
322 .. _ldap_attr_email:
327 .. _ldap_attr_email:
323
328
324 Email Attribute : required
329 Email Attribute : required
325 The LDAP record attribute which represents the user's email address.
330 The LDAP record attribute which represents the user's email address.
326
331
327 If all data are entered correctly, and python-ldap_ is properly installed
332 If all data are entered correctly, and python-ldap_ is properly installed
328 users should be granted access to RhodeCode with ldap accounts. At this
333 users should be granted access to RhodeCode with ldap accounts. At this
329 time user information is copied from LDAP into the RhodeCode user database.
334 time user information is copied from LDAP into the RhodeCode user database.
330 This means that updates of an LDAP user object may not be reflected as a
335 This means that updates of an LDAP user object may not be reflected as a
331 user update in RhodeCode.
336 user update in RhodeCode.
332
337
333 If You have problems with LDAP access and believe You entered correct
338 If You have problems with LDAP access and believe You entered correct
334 information check out the RhodeCode logs, any error messages sent from LDAP
339 information check out the RhodeCode logs, any error messages sent from LDAP
335 will be saved there.
340 will be saved there.
336
341
337 Active Directory
342 Active Directory
338 ''''''''''''''''
343 ''''''''''''''''
339
344
340 RhodeCode can use Microsoft Active Directory for user authentication. This
345 RhodeCode can use Microsoft Active Directory for user authentication. This
341 is done through an LDAP or LDAPS connection to Active Directory. The
346 is done through an LDAP or LDAPS connection to Active Directory. The
342 following LDAP configuration settings are typical for using Active
347 following LDAP configuration settings are typical for using Active
343 Directory ::
348 Directory ::
344
349
345 Base DN = OU=SBSUsers,OU=Users,OU=MyBusiness,DC=v3sys,DC=local
350 Base DN = OU=SBSUsers,OU=Users,OU=MyBusiness,DC=v3sys,DC=local
346 Login Attribute = sAMAccountName
351 Login Attribute = sAMAccountName
347 First Name Attribute = givenName
352 First Name Attribute = givenName
348 Last Name Attribute = sn
353 Last Name Attribute = sn
349 E-mail Attribute = mail
354 E-mail Attribute = mail
350
355
351 All other LDAP settings will likely be site-specific and should be
356 All other LDAP settings will likely be site-specific and should be
352 appropriately configured.
357 appropriately configured.
353
358
354
359
355 Authentication by container or reverse-proxy
360 Authentication by container or reverse-proxy
356 --------------------------------------------
361 --------------------------------------------
357
362
358 Starting with version 1.3, RhodeCode supports delegating the authentication
363 Starting with version 1.3, RhodeCode supports delegating the authentication
359 of users to its WSGI container, or to a reverse-proxy server through which all
364 of users to its WSGI container, or to a reverse-proxy server through which all
360 clients access the application.
365 clients access the application.
361
366
362 When these authentication methods are enabled in RhodeCode, it uses the
367 When these authentication methods are enabled in RhodeCode, it uses the
363 username that the container/proxy (Apache/Nginx/etc) authenticated and doesn't
368 username that the container/proxy (Apache/Nginx/etc) authenticated and doesn't
364 perform the authentication itself. The authorization, however, is still done by
369 perform the authentication itself. The authorization, however, is still done by
365 RhodeCode according to its settings.
370 RhodeCode according to its settings.
366
371
367 When a user logs in for the first time using these authentication methods,
372 When a user logs in for the first time using these authentication methods,
368 a matching user account is created in RhodeCode with default permissions. An
373 a matching user account is created in RhodeCode with default permissions. An
369 administrator can then modify it using RhodeCode's admin interface.
374 administrator can then modify it using RhodeCode's admin interface.
370 It's also possible for an administrator to create accounts and configure their
375 It's also possible for an administrator to create accounts and configure their
371 permissions before the user logs in for the first time.
376 permissions before the user logs in for the first time.
372
377
373 Container-based authentication
378 Container-based authentication
374 ''''''''''''''''''''''''''''''
379 ''''''''''''''''''''''''''''''
375
380
376 In a container-based authentication setup, RhodeCode reads the user name from
381 In a container-based authentication setup, RhodeCode reads the user name from
377 the ``REMOTE_USER`` server variable provided by the WSGI container.
382 the ``REMOTE_USER`` server variable provided by the WSGI container.
378
383
379 After setting up your container (see `Apache's WSGI config`_), you'd need
384 After setting up your container (see `Apache's WSGI config`_), you'd need
380 to configure it to require authentication on the location configured for
385 to configure it to require authentication on the location configured for
381 RhodeCode.
386 RhodeCode.
382
387
383 In order for RhodeCode to start using the provided username, you should set the
388 In order for RhodeCode to start using the provided username, you should set the
384 following in the [app:main] section of your .ini file::
389 following in the [app:main] section of your .ini file::
385
390
386 container_auth_enabled = true
391 container_auth_enabled = true
387
392
388
393
389 Proxy pass-through authentication
394 Proxy pass-through authentication
390 '''''''''''''''''''''''''''''''''
395 '''''''''''''''''''''''''''''''''
391
396
392 In a proxy pass-through authentication setup, RhodeCode reads the user name
397 In a proxy pass-through authentication setup, RhodeCode reads the user name
393 from the ``X-Forwarded-User`` request header, which should be configured to be
398 from the ``X-Forwarded-User`` request header, which should be configured to be
394 sent by the reverse-proxy server.
399 sent by the reverse-proxy server.
395
400
396 After setting up your proxy solution (see `Apache virtual host reverse proxy example`_,
401 After setting up your proxy solution (see `Apache virtual host reverse proxy example`_,
397 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'd need to
402 `Apache as subdirectory`_ or `Nginx virtual host example`_), you'd need to
398 configure the authentication and add the username in a request header named
403 configure the authentication and add the username in a request header named
399 ``X-Forwarded-User``.
404 ``X-Forwarded-User``.
400
405
401 For example, the following config section for Apache sets a subdirectory in a
406 For example, the following config section for Apache sets a subdirectory in a
402 reverse-proxy setup with basic auth::
407 reverse-proxy setup with basic auth::
403
408
404 <Location /<someprefix> >
409 <Location /<someprefix> >
405 ProxyPass http://127.0.0.1:5000/<someprefix>
410 ProxyPass http://127.0.0.1:5000/<someprefix>
406 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
411 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
407 SetEnvIf X-Url-Scheme https HTTPS=1
412 SetEnvIf X-Url-Scheme https HTTPS=1
408
413
409 AuthType Basic
414 AuthType Basic
410 AuthName "RhodeCode authentication"
415 AuthName "RhodeCode authentication"
411 AuthUserFile /home/web/rhodecode/.htpasswd
416 AuthUserFile /home/web/rhodecode/.htpasswd
412 require valid-user
417 require valid-user
413
418
414 RequestHeader unset X-Forwarded-User
419 RequestHeader unset X-Forwarded-User
415
420
416 RewriteEngine On
421 RewriteEngine On
417 RewriteCond %{LA-U:REMOTE_USER} (.+)
422 RewriteCond %{LA-U:REMOTE_USER} (.+)
418 RewriteRule .* - [E=RU:%1]
423 RewriteRule .* - [E=RU:%1]
419 RequestHeader set X-Forwarded-User %{RU}e
424 RequestHeader set X-Forwarded-User %{RU}e
420 </Location>
425 </Location>
421
426
422 In order for RhodeCode to start using the forwarded username, you should set
427 In order for RhodeCode to start using the forwarded username, you should set
423 the following in the [app:main] section of your .ini file::
428 the following in the [app:main] section of your .ini file::
424
429
425 proxypass_auth_enabled = true
430 proxypass_auth_enabled = true
426
431
427 .. note::
432 .. note::
428 If you enable proxy pass-through authentication, make sure your server is
433 If you enable proxy pass-through authentication, make sure your server is
429 only accessible through the proxy. Otherwise, any client would be able to
434 only accessible through the proxy. Otherwise, any client would be able to
430 forge the authentication header and could effectively become authenticated
435 forge the authentication header and could effectively become authenticated
431 using any account of their liking.
436 using any account of their liking.
432
437
433 Integration with Issue trackers
438 Integration with Issue trackers
434 -------------------------------
439 -------------------------------
435
440
436 RhodeCode provides a simple integration with issue trackers. It's possible
441 RhodeCode provides a simple integration with issue trackers. It's possible
437 to define a regular expression that will fetch issue id stored in commit
442 to define a regular expression that will fetch issue id stored in commit
438 messages and replace that with an url to this issue. To enable this simply
443 messages and replace that with an url to this issue. To enable this simply
439 uncomment following variables in the ini file::
444 uncomment following variables in the ini file::
440
445
441 url_pat = (?:^#|\s#)(\w+)
446 url_pat = (?:^#|\s#)(\w+)
442 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
447 issue_server_link = https://myissueserver.com/{repo}/issue/{id}
443 issue_prefix = #
448 issue_prefix = #
444
449
445 `url_pat` is the regular expression that will fetch issues from commit messages.
450 `url_pat` is the regular expression that will fetch issues from commit messages.
446 Default regex will match issues in format of #<number> eg. #300.
451 Default regex will match issues in format of #<number> eg. #300.
447
452
448 Matched issues will be replace with the link specified as `issue_server_link`
453 Matched issues will be replace with the link specified as `issue_server_link`
449 {id} will be replaced with issue id, and {repo} with repository name.
454 {id} will be replaced with issue id, and {repo} with repository name.
450 Since the # is striped `issue_prefix` is added as a prefix to url.
455 Since the # is striped `issue_prefix` is added as a prefix to url.
451 `issue_prefix` can be something different than # if you pass
456 `issue_prefix` can be something different than # if you pass
452 ISSUE- as issue prefix this will generate an url in format::
457 ISSUE- as issue prefix this will generate an url in format::
453
458
454 <a href="https://myissueserver.com/example_repo/issue/300">ISSUE-300</a>
459 <a href="https://myissueserver.com/example_repo/issue/300">ISSUE-300</a>
455
460
456 Hook management
461 Hook management
457 ---------------
462 ---------------
458
463
459 Hooks can be managed in similar way to this used in .hgrc files.
464 Hooks can be managed in similar way to this used in .hgrc files.
460 To access hooks setting click `advanced setup` on Hooks section of Mercurial
465 To access hooks setting click `advanced setup` on Hooks section of Mercurial
461 Settings in Admin.
466 Settings in Admin.
462
467
463 There are 4 built in hooks that cannot be changed (only enable/disable by
468 There are 4 built in hooks that cannot be changed (only enable/disable by
464 checkboxes on previos section).
469 checkboxes on previos section).
465 To add another custom hook simply fill in first section with
470 To add another custom hook simply fill in first section with
466 <name>.<hook_type> and the second one with hook path. Example hooks
471 <name>.<hook_type> and the second one with hook path. Example hooks
467 can be found at *rhodecode.lib.hooks*.
472 can be found at *rhodecode.lib.hooks*.
468
473
469
474
470 Changing default encoding
475 Changing default encoding
471 -------------------------
476 -------------------------
472
477
473 By default RhodeCode uses utf8 encoding, starting from 1.3 series this
478 By default RhodeCode uses utf8 encoding, starting from 1.3 series this
474 can be changed, simply edit default_encoding in .ini file to desired one.
479 can be changed, simply edit default_encoding in .ini file to desired one.
475 This affects many parts in rhodecode including commiters names, filenames,
480 This affects many parts in rhodecode including commiters names, filenames,
476 encoding of commit messages. In addition RhodeCode can detect if `chardet`
481 encoding of commit messages. In addition RhodeCode can detect if `chardet`
477 library is installed. If `chardet` is detected RhodeCode will fallback to it
482 library is installed. If `chardet` is detected RhodeCode will fallback to it
478 when there are encode/decode errors.
483 when there are encode/decode errors.
479
484
480
485
481 Setting Up Celery
486 Setting Up Celery
482 -----------------
487 -----------------
483
488
484 Since version 1.1 celery is configured by the rhodecode ini configuration files.
489 Since version 1.1 celery is configured by the rhodecode ini configuration files.
485 Simply set use_celery=true in the ini file then add / change the configuration
490 Simply set use_celery=true in the ini file then add / change the configuration
486 variables inside the ini file.
491 variables inside the ini file.
487
492
488 Remember that the ini files use the format with '.' not with '_' like celery.
493 Remember that the ini files use the format with '.' not with '_' like celery.
489 So for example setting `BROKER_HOST` in celery means setting `broker.host` in
494 So for example setting `BROKER_HOST` in celery means setting `broker.host` in
490 the config file.
495 the config file.
491
496
492 In order to start using celery run::
497 In order to start using celery run::
493
498
494 paster celeryd <configfile.ini>
499 paster celeryd <configfile.ini>
495
500
496
501
497 .. note::
502 .. note::
498 Make sure you run this command from the same virtualenv, and with the same
503 Make sure you run this command from the same virtualenv, and with the same
499 user that rhodecode runs.
504 user that rhodecode runs.
500
505
501 HTTPS support
506 HTTPS support
502 -------------
507 -------------
503
508
504 There are two ways to enable https:
509 There are two ways to enable https:
505
510
506 - Set HTTP_X_URL_SCHEME in your http server headers, than rhodecode will
511 - Set HTTP_X_URL_SCHEME in your http server headers, than rhodecode will
507 recognize this headers and make proper https redirections
512 recognize this headers and make proper https redirections
508 - Alternatively, change the `force_https = true` flag in the ini configuration
513 - Alternatively, change the `force_https = true` flag in the ini configuration
509 to force using https, no headers are needed than to enable https
514 to force using https, no headers are needed than to enable https
510
515
511
516
512 Nginx virtual host example
517 Nginx virtual host example
513 --------------------------
518 --------------------------
514
519
515 Sample config for nginx using proxy::
520 Sample config for nginx using proxy::
516
521
517 upstream rc {
522 upstream rc {
518 server 127.0.0.1:5000;
523 server 127.0.0.1:5000;
519 # add more instances for load balancing
524 # add more instances for load balancing
520 #server 127.0.0.1:5001;
525 #server 127.0.0.1:5001;
521 #server 127.0.0.1:5002;
526 #server 127.0.0.1:5002;
522 }
527 }
523
528
524 server {
529 server {
525 listen 80;
530 listen 80;
526 server_name hg.myserver.com;
531 server_name hg.myserver.com;
527 access_log /var/log/nginx/rhodecode.access.log;
532 access_log /var/log/nginx/rhodecode.access.log;
528 error_log /var/log/nginx/rhodecode.error.log;
533 error_log /var/log/nginx/rhodecode.error.log;
529
534
530 location / {
535 location / {
531 try_files $uri @rhode;
536 try_files $uri @rhode;
532 }
537 }
533
538
534 location @rhode {
539 location @rhode {
535 proxy_pass http://rc;
540 proxy_pass http://rc;
536 include /etc/nginx/proxy.conf;
541 include /etc/nginx/proxy.conf;
537 }
542 }
538
543
539 }
544 }
540
545
541 Here's the proxy.conf. It's tuned so it will not timeout on long
546 Here's the proxy.conf. It's tuned so it will not timeout on long
542 pushes or large pushes::
547 pushes or large pushes::
543
548
544 proxy_redirect off;
549 proxy_redirect off;
545 proxy_set_header Host $host;
550 proxy_set_header Host $host;
546 proxy_set_header X-Url-Scheme $scheme;
551 proxy_set_header X-Url-Scheme $scheme;
547 proxy_set_header X-Host $http_host;
552 proxy_set_header X-Host $http_host;
548 proxy_set_header X-Real-IP $remote_addr;
553 proxy_set_header X-Real-IP $remote_addr;
549 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
554 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
550 proxy_set_header Proxy-host $proxy_host;
555 proxy_set_header Proxy-host $proxy_host;
551 client_max_body_size 400m;
556 client_max_body_size 400m;
552 client_body_buffer_size 128k;
557 client_body_buffer_size 128k;
553 proxy_buffering off;
558 proxy_buffering off;
554 proxy_connect_timeout 7200;
559 proxy_connect_timeout 7200;
555 proxy_send_timeout 7200;
560 proxy_send_timeout 7200;
556 proxy_read_timeout 7200;
561 proxy_read_timeout 7200;
557 proxy_buffers 8 32k;
562 proxy_buffers 8 32k;
558
563
559 Also, when using root path with nginx you might set the static files to false
564 Also, when using root path with nginx you might set the static files to false
560 in the production.ini file::
565 in the production.ini file::
561
566
562 [app:main]
567 [app:main]
563 use = egg:rhodecode
568 use = egg:rhodecode
564 full_stack = true
569 full_stack = true
565 static_files = false
570 static_files = false
566 lang=en
571 lang=en
567 cache_dir = %(here)s/data
572 cache_dir = %(here)s/data
568
573
569 In order to not have the statics served by the application. This improves speed.
574 In order to not have the statics served by the application. This improves speed.
570
575
571
576
572 Apache virtual host reverse proxy example
577 Apache virtual host reverse proxy example
573 -----------------------------------------
578 -----------------------------------------
574
579
575 Here is a sample configuration file for apache using proxy::
580 Here is a sample configuration file for apache using proxy::
576
581
577 <VirtualHost *:80>
582 <VirtualHost *:80>
578 ServerName hg.myserver.com
583 ServerName hg.myserver.com
579 ServerAlias hg.myserver.com
584 ServerAlias hg.myserver.com
580
585
581 <Proxy *>
586 <Proxy *>
582 Order allow,deny
587 Order allow,deny
583 Allow from all
588 Allow from all
584 </Proxy>
589 </Proxy>
585
590
586 #important !
591 #important !
587 #Directive to properly generate url (clone url) for pylons
592 #Directive to properly generate url (clone url) for pylons
588 ProxyPreserveHost On
593 ProxyPreserveHost On
589
594
590 #rhodecode instance
595 #rhodecode instance
591 ProxyPass / http://127.0.0.1:5000/
596 ProxyPass / http://127.0.0.1:5000/
592 ProxyPassReverse / http://127.0.0.1:5000/
597 ProxyPassReverse / http://127.0.0.1:5000/
593
598
594 #to enable https use line below
599 #to enable https use line below
595 #SetEnvIf X-Url-Scheme https HTTPS=1
600 #SetEnvIf X-Url-Scheme https HTTPS=1
596
601
597 </VirtualHost>
602 </VirtualHost>
598
603
599
604
600 Additional tutorial
605 Additional tutorial
601 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
606 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
602
607
603
608
604 Apache as subdirectory
609 Apache as subdirectory
605 ----------------------
610 ----------------------
606
611
607 Apache subdirectory part::
612 Apache subdirectory part::
608
613
609 <Location /<someprefix> >
614 <Location /<someprefix> >
610 ProxyPass http://127.0.0.1:5000/<someprefix>
615 ProxyPass http://127.0.0.1:5000/<someprefix>
611 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
616 ProxyPassReverse http://127.0.0.1:5000/<someprefix>
612 SetEnvIf X-Url-Scheme https HTTPS=1
617 SetEnvIf X-Url-Scheme https HTTPS=1
613 </Location>
618 </Location>
614
619
615 Besides the regular apache setup you will need to add the following line
620 Besides the regular apache setup you will need to add the following line
616 into [app:main] section of your .ini file::
621 into [app:main] section of your .ini file::
617
622
618 filter-with = proxy-prefix
623 filter-with = proxy-prefix
619
624
620 Add the following at the end of the .ini file::
625 Add the following at the end of the .ini file::
621
626
622 [filter:proxy-prefix]
627 [filter:proxy-prefix]
623 use = egg:PasteDeploy#prefix
628 use = egg:PasteDeploy#prefix
624 prefix = /<someprefix>
629 prefix = /<someprefix>
625
630
626
631
627 then change <someprefix> into your choosen prefix
632 then change <someprefix> into your choosen prefix
628
633
629 Apache's WSGI config
634 Apache's WSGI config
630 --------------------
635 --------------------
631
636
632 Alternatively, RhodeCode can be set up with Apache under mod_wsgi. For
637 Alternatively, RhodeCode can be set up with Apache under mod_wsgi. For
633 that, you'll need to:
638 that, you'll need to:
634
639
635 - Install mod_wsgi. If using a Debian-based distro, you can install
640 - Install mod_wsgi. If using a Debian-based distro, you can install
636 the package libapache2-mod-wsgi::
641 the package libapache2-mod-wsgi::
637
642
638 aptitude install libapache2-mod-wsgi
643 aptitude install libapache2-mod-wsgi
639
644
640 - Enable mod_wsgi::
645 - Enable mod_wsgi::
641
646
642 a2enmod wsgi
647 a2enmod wsgi
643
648
644 - Create a wsgi dispatch script, like the one below. Make sure you
649 - Create a wsgi dispatch script, like the one below. Make sure you
645 check the paths correctly point to where you installed RhodeCode
650 check the paths correctly point to where you installed RhodeCode
646 and its Python Virtual Environment.
651 and its Python Virtual Environment.
647 - Enable the WSGIScriptAlias directive for the wsgi dispatch script,
652 - Enable the WSGIScriptAlias directive for the wsgi dispatch script,
648 as in the following example. Once again, check the paths are
653 as in the following example. Once again, check the paths are
649 correctly specified.
654 correctly specified.
650
655
651 Here is a sample excerpt from an Apache Virtual Host configuration file::
656 Here is a sample excerpt from an Apache Virtual Host configuration file::
652
657
653 WSGIDaemonProcess pylons user=www-data group=www-data processes=1 \
658 WSGIDaemonProcess pylons user=www-data group=www-data processes=1 \
654 threads=4 \
659 threads=4 \
655 python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages
660 python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages
656 WSGIScriptAlias / /home/web/rhodecode/dispatch.wsgi
661 WSGIScriptAlias / /home/web/rhodecode/dispatch.wsgi
657 WSGIPassAuthorization On
662 WSGIPassAuthorization On
658
663
659 Example wsgi dispatch script::
664 Example wsgi dispatch script::
660
665
661 import os
666 import os
662 os.environ["HGENCODING"] = "UTF-8"
667 os.environ["HGENCODING"] = "UTF-8"
663 os.environ['PYTHON_EGG_CACHE'] = '/home/web/rhodecode/.egg-cache'
668 os.environ['PYTHON_EGG_CACHE'] = '/home/web/rhodecode/.egg-cache'
664
669
665 # sometimes it's needed to set the curent dir
670 # sometimes it's needed to set the curent dir
666 os.chdir('/home/web/rhodecode/')
671 os.chdir('/home/web/rhodecode/')
667
672
668 import site
673 import site
669 site.addsitedir("/home/web/rhodecode/pyenv/lib/python2.6/site-packages")
674 site.addsitedir("/home/web/rhodecode/pyenv/lib/python2.6/site-packages")
670
675
671 from paste.deploy import loadapp
676 from paste.deploy import loadapp
672 from paste.script.util.logging_config import fileConfig
677 from paste.script.util.logging_config import fileConfig
673
678
674 fileConfig('/home/web/rhodecode/production.ini')
679 fileConfig('/home/web/rhodecode/production.ini')
675 application = loadapp('config:/home/web/rhodecode/production.ini')
680 application = loadapp('config:/home/web/rhodecode/production.ini')
676
681
677 Note: when using mod_wsgi you'll need to install the same version of
682 Note: when using mod_wsgi you'll need to install the same version of
678 Mercurial that's inside RhodeCode's virtualenv also on the system's Python
683 Mercurial that's inside RhodeCode's virtualenv also on the system's Python
679 environment.
684 environment.
680
685
681
686
682 Other configuration files
687 Other configuration files
683 -------------------------
688 -------------------------
684
689
685 Some example init.d scripts can be found here, for debian and gentoo:
690 Some example init.d scripts can be found here, for debian and gentoo:
686
691
687 https://rhodecode.org/rhodecode/files/tip/init.d
692 https://rhodecode.org/rhodecode/files/tip/init.d
688
693
689
694
690 Troubleshooting
695 Troubleshooting
691 ---------------
696 ---------------
692
697
693 :Q: **Missing static files?**
698 :Q: **Missing static files?**
694 :A: Make sure either to set the `static_files = true` in the .ini file or
699 :A: Make sure either to set the `static_files = true` in the .ini file or
695 double check the root path for your http setup. It should point to
700 double check the root path for your http setup. It should point to
696 for example:
701 for example:
697 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
702 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
698
703
699 |
704 |
700
705
701 :Q: **Can't install celery/rabbitmq**
706 :Q: **Can't install celery/rabbitmq**
702 :A: Don't worry RhodeCode works without them too. No extra setup is required.
707 :A: Don't worry RhodeCode works without them too. No extra setup is required.
703
708
704 |
709 |
705
710
706 :Q: **Long lasting push timeouts?**
711 :Q: **Long lasting push timeouts?**
707 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
712 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
708 are caused by https server and not RhodeCode.
713 are caused by https server and not RhodeCode.
709
714
710 |
715 |
711
716
712 :Q: **Large pushes timeouts?**
717 :Q: **Large pushes timeouts?**
713 :A: Make sure you set a proper max_body_size for the http server.
718 :A: Make sure you set a proper max_body_size for the http server.
714
719
715 |
720 |
716
721
717 :Q: **Apache doesn't pass basicAuth on pull/push?**
722 :Q: **Apache doesn't pass basicAuth on pull/push?**
718 :A: Make sure you added `WSGIPassAuthorization true`.
723 :A: Make sure you added `WSGIPassAuthorization true`.
719
724
720 For further questions search the `Issues tracker`_, or post a message in the
725 For further questions search the `Issues tracker`_, or post a message in the
721 `google group rhodecode`_
726 `google group rhodecode`_
722
727
723 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
728 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
724 .. _python: http://www.python.org/
729 .. _python: http://www.python.org/
725 .. _mercurial: http://mercurial.selenic.com/
730 .. _mercurial: http://mercurial.selenic.com/
726 .. _celery: http://celeryproject.org/
731 .. _celery: http://celeryproject.org/
727 .. _rabbitmq: http://www.rabbitmq.com/
732 .. _rabbitmq: http://www.rabbitmq.com/
728 .. _python-ldap: http://www.python-ldap.org/
733 .. _python-ldap: http://www.python-ldap.org/
729 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
734 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
730 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
735 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
731 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
736 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
732 .. _google group rhodecode: http://groups.google.com/group/rhodecode
737 .. _google group rhodecode: http://groups.google.com/group/rhodecode
General Comments 0
You need to be logged in to leave comments. Login now