Show More
@@ -0,0 +1,15 b'' | |||||
|
1 | |RCE| 4.3.1 |RNS| | |||
|
2 | ----------------- | |||
|
3 | ||||
|
4 | Release Date | |||
|
5 | ^^^^^^^^^^^^ | |||
|
6 | ||||
|
7 | - 2016-08-23 | |||
|
8 | ||||
|
9 | Fixes | |||
|
10 | ^^^^^ | |||
|
11 | ||||
|
12 | - Core: fixed database session cleanups. This will make sure RhodeCode can | |||
|
13 | function correctly after database server problems. Fixes #4173, refs #4166 | |||
|
14 | - Diffs: limit the file context to ~1mln lines. Fixes #4184, also make sure | |||
|
15 | this doesn't trigger Integer overflow for msgpack. No newline at end of file |
@@ -6,3 +6,4 b' 41c87da28a179953df86061d817bc35533c66dd2' | |||||
6 | baaf9f5bcea3bae0ef12ae20c8b270482e62abb6 v4.2.0 |
|
6 | baaf9f5bcea3bae0ef12ae20c8b270482e62abb6 v4.2.0 | |
7 | 32a70c7e56844a825f61df496ee5eaf8c3c4e189 v4.2.1 |
|
7 | 32a70c7e56844a825f61df496ee5eaf8c3c4e189 v4.2.1 | |
8 | fa695cdb411d294679ac081d595ac654e5613b03 v4.3.0 |
|
8 | fa695cdb411d294679ac081d595ac654e5613b03 v4.3.0 | |
|
9 | 0e4dc11b58cad833c513fe17bac39e6850edf959 v4.3.1 |
@@ -3,16 +3,21 b'' | |||||
3 | |svn| With Write Over HTTP |
|
3 | |svn| With Write Over HTTP | |
4 | -------------------------- |
|
4 | -------------------------- | |
5 |
|
5 | |||
6 | To use |svn| with write access, the currently supported method is over HTTP. |
|
6 | To use |svn| with read/write support over the |svn| protocol, you have to | |
7 | This requires you to configure your local machine so that it can access your |
|
7 | configure HTTP |svn| backend. | |
8 | |RCE| instance. |
|
|||
9 |
|
8 | |||
10 | Prerequisites |
|
9 | Prerequisites | |
11 | ^^^^^^^^^^^^^ |
|
10 | ^^^^^^^^^^^^^ | |
12 |
|
11 | |||
13 |
- Enable lab setting on your |RCE| instance, |
|
12 | - Enable HTTP support inside labs setting on your |RCE| instance, | |
14 | - You need to install the following tools on your local machine: ``Apache`` and |
|
13 | see :ref:`lab-settings`. | |
15 | ``mod_dav_svn``. Use the following Ubuntu as an example. |
|
14 | - You need to install the following tools on the machine that is running an | |
|
15 | instance of |RCE|: | |||
|
16 | ``Apache HTTP Server`` and | |||
|
17 | ``mod_dav_svn``. | |||
|
18 | ||||
|
19 | ||||
|
20 | Using Ubuntu Distribution as an example you can run: | |||
16 |
|
21 | |||
17 | .. code-block:: bash |
|
22 | .. code-block:: bash | |
18 |
|
23 | |||
@@ -32,41 +37,80 b' Configuring Apache Setup' | |||||
32 | It is recommended to run Apache on a port other than 80, due to possible |
|
37 | It is recommended to run Apache on a port other than 80, due to possible | |
33 | conflicts with other HTTP servers like nginx. To do this, set the |
|
38 | conflicts with other HTTP servers like nginx. To do this, set the | |
34 | ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example |
|
39 | ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example | |
35 | ``Listen 8090`` |
|
40 | ``Listen 8090``. | |
|
41 | ||||
|
42 | ||||
|
43 | .. warning:: | |||
36 |
|
44 | |||
37 | It is also recommended to run apache as the same user as |RCE|, otherwise |
|
45 | Make sure your Apache instance which runs the mod_dav_svn module is | |
38 | permission issues could occur. To do this edit the ``/etc/apache2/envvars`` |
|
46 | only accessible by RhodeCode. Otherwise everyone is able to browse | |
|
47 | the repositories or run subversion operations (checkout/commit/etc.). | |||
|
48 | ||||
|
49 | It is also recommended to run apache as the same user as |RCE|, otherwise | |||
|
50 | permission issues could occur. To do this edit the ``/etc/apache2/envvars`` | |||
39 |
|
51 | |||
40 | .. code-block:: apache |
|
52 | .. code-block:: apache | |
41 |
|
53 | |||
42 |
export APACHE_RUN_USER= |
|
54 | export APACHE_RUN_USER=rhodecode | |
43 |
export APACHE_RUN_GROUP= |
|
55 | export APACHE_RUN_GROUP=rhodecode | |
44 |
|
56 | |||
45 | 1. To configure Apache, create and edit a virtual hosts file, for example |
|
57 | 1. To configure Apache, create and edit a virtual hosts file, for example | |
46 |
:file:`/etc/apache2/sites-available/default.conf` |
|
58 | :file:`/etc/apache2/sites-available/default.conf`. Below is an example | |
47 | virtual hosts file and add a location section inside the |
|
59 | how to use one with auto-generated config ```mod_dav_svn.conf``` | |
48 | ``<VirtualHost>`` section. |
|
60 | from configured |RCE| instance. | |
49 |
|
61 | |||
50 | .. code-block:: apache |
|
62 | .. code-block:: apache | |
51 |
|
63 | |||
52 | <Location /> |
|
64 | <VirtualHost *:8080> | |
53 | DAV svn |
|
65 | ServerAdmin rhodecode-admin@localhost | |
54 | # Must be explicit path, relative not supported |
|
66 | DocumentRoot /var/www/html | |
55 | SVNParentPath /PATH/TO/REPOSITORIES |
|
67 | ErrorLog ${'${APACHE_LOG_DIR}'}/error.log | |
56 | SVNListParentPath On |
|
68 | CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined | |
57 | Allow from all |
|
69 | Include /home/user/.rccontrol/enterprise-1/mod_dav_svn.conf | |
58 | Order allow,deny |
|
70 | </VirtualHost> | |
59 | </Location> |
|
|||
60 |
|
71 | |||
61 | .. note:: |
|
|||
62 |
|
||||
63 | Once configured, check that you can see the list of repositories on your |
|
|||
64 | |RCE| instance. |
|
|||
65 |
|
|
72 | ||
66 | 2. Go to the :menuselection:`Admin --> Settings --> Labs` page, and |
|
73 | 2. Go to the :menuselection:`Admin --> Settings --> Labs` page, and | |
67 | enable :guilabel:`Proxy Subversion HTTP requests`, and specify the |
|
74 | enable :guilabel:`Proxy Subversion HTTP requests`, and specify the | |
68 | :guilabel:`Subversion HTTP Server URL`. |
|
75 | :guilabel:`Subversion HTTP Server URL`. | |
69 |
|
76 | |||
|
77 | 3. Open the |RCE| configuration file, | |||
|
78 | :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini` | |||
|
79 | ||||
|
80 | 4. Add the following configuration option in the ``[app:main]`` | |||
|
81 | section if you don't have it yet. | |||
|
82 | ||||
|
83 | This enable mapping of created |RCE| repo groups into special |svn| paths. | |||
|
84 | Each time a new repository group will be created the system will update | |||
|
85 | the template file, and create new mapping. Apache web server needs to be | |||
|
86 | reloaded to pick up the changes on this file. | |||
|
87 | It's recommended to add reload into a crontab so the changes can be picked | |||
|
88 | automatically once someone creates an repository group inside RhodeCode. | |||
|
89 | ||||
|
90 | ||||
|
91 | .. code-block:: ini | |||
|
92 | ||||
|
93 | ############################################## | |||
|
94 | ### Subversion proxy support (mod_dav_svn) ### | |||
|
95 | ############################################## | |||
|
96 | ## Enable or disable the config file generation. | |||
|
97 | svn.proxy.generate_config = true | |||
|
98 | ## Generate config file with `SVNListParentPath` set to `On`. | |||
|
99 | svn.proxy.list_parent_path = true | |||
|
100 | ## Set location and file name of generated config file. | |||
|
101 | svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf | |||
|
102 | ## File system path to the directory containing the repositories served by | |||
|
103 | ## RhodeCode. | |||
|
104 | svn.proxy.parent_path_root = /path/to/repo_store | |||
|
105 | ## Used as a prefix to the <Location> block in the generated config file. In | |||
|
106 | ## most cases it should be set to `/`. | |||
|
107 | svn.proxy.location_root = / | |||
|
108 | ||||
|
109 | ||||
|
110 | This would create a special template file called ```mod_dav_svn.conf```. We | |||
|
111 | used that file path in the apache config above inside the Include statement. | |||
|
112 | ||||
|
113 | ||||
70 | Using |svn| |
|
114 | Using |svn| | |
71 | ^^^^^^^^^^^ |
|
115 | ^^^^^^^^^^^ | |
72 |
|
116 |
@@ -9,6 +9,7 b' Release Notes' | |||||
9 | .. toctree:: |
|
9 | .. toctree:: | |
10 | :maxdepth: 1 |
|
10 | :maxdepth: 1 | |
11 |
|
11 | |||
|
12 | release-notes-4.3.1.rst | |||
12 | release-notes-4.3.0.rst |
|
13 | release-notes-4.3.0.rst | |
13 | release-notes-4.2.1.rst |
|
14 | release-notes-4.2.1.rst | |
14 | release-notes-4.2.0.rst |
|
15 | release-notes-4.2.0.rst |
@@ -39,6 +39,7 b' from routes.middleware import RoutesMidd' | |||||
39 | import routes.util |
|
39 | import routes.util | |
40 |
|
40 | |||
41 | import rhodecode |
|
41 | import rhodecode | |
|
42 | from rhodecode.model import meta | |||
42 | from rhodecode.config import patches |
|
43 | from rhodecode.config import patches | |
43 | from rhodecode.config.routing import STATIC_FILE_PREFIX |
|
44 | from rhodecode.config.routing import STATIC_FILE_PREFIX | |
44 | from rhodecode.config.environment import ( |
|
45 | from rhodecode.config.environment import ( | |
@@ -159,6 +160,10 b' def make_pyramid_app(global_config, **se' | |||||
159 | pyramid_app = config.make_wsgi_app() |
|
160 | pyramid_app = config.make_wsgi_app() | |
160 | pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config) |
|
161 | pyramid_app = wrap_app_in_wsgi_middlewares(pyramid_app, config) | |
161 | pyramid_app.config = config |
|
162 | pyramid_app.config = config | |
|
163 | ||||
|
164 | # creating the app uses a connection - return it after we are done | |||
|
165 | meta.Session.remove() | |||
|
166 | ||||
162 | return pyramid_app |
|
167 | return pyramid_app | |
163 |
|
168 | |||
164 |
|
169 | |||
@@ -381,7 +386,25 b' def wrap_app_in_wsgi_middlewares(pyramid' | |||||
381 | pyramid_app = make_gzip_middleware( |
|
386 | pyramid_app = make_gzip_middleware( | |
382 | pyramid_app, settings, compress_level=1) |
|
387 | pyramid_app, settings, compress_level=1) | |
383 |
|
388 | |||
384 | return pyramid_app |
|
389 | ||
|
390 | # this should be the outer most middleware in the wsgi stack since | |||
|
391 | # middleware like Routes make database calls | |||
|
392 | def pyramid_app_with_cleanup(environ, start_response): | |||
|
393 | try: | |||
|
394 | return pyramid_app(environ, start_response) | |||
|
395 | finally: | |||
|
396 | # Dispose current database session and rollback uncommitted | |||
|
397 | # transactions. | |||
|
398 | meta.Session.remove() | |||
|
399 | ||||
|
400 | # In a single threaded mode server, on non sqlite db we should have | |||
|
401 | # '0 Current Checked out connections' at the end of a request, | |||
|
402 | # if not, then something, somewhere is leaving a connection open | |||
|
403 | pool = meta.Base.metadata.bind.engine.pool | |||
|
404 | log.debug('sa pool status: %s', pool.status()) | |||
|
405 | ||||
|
406 | ||||
|
407 | return pyramid_app_with_cleanup | |||
385 |
|
408 | |||
386 |
|
409 | |||
387 | def sanitize_settings_and_apply_defaults(settings): |
|
410 | def sanitize_settings_and_apply_defaults(settings): |
@@ -40,12 +40,17 b' from rhodecode.lib.utils2 import safe_un' | |||||
40 |
|
40 | |||
41 | log = logging.getLogger(__name__) |
|
41 | log = logging.getLogger(__name__) | |
42 |
|
42 | |||
|
43 | # define max context, a file with more than this numbers of lines is unusable | |||
|
44 | # in browser anyway | |||
|
45 | MAX_CONTEXT = 1024 * 1014 | |||
|
46 | ||||
43 |
|
47 | |||
44 | class OPS(object): |
|
48 | class OPS(object): | |
45 | ADD = 'A' |
|
49 | ADD = 'A' | |
46 | MOD = 'M' |
|
50 | MOD = 'M' | |
47 | DEL = 'D' |
|
51 | DEL = 'D' | |
48 |
|
52 | |||
|
53 | ||||
49 | def wrap_to_table(str_): |
|
54 | def wrap_to_table(str_): | |
50 | return '''<table class="code-difftable"> |
|
55 | return '''<table class="code-difftable"> | |
51 | <tr class="line no-comment"> |
|
56 | <tr class="line no-comment"> | |
@@ -57,8 +62,8 b' def wrap_to_table(str_):' | |||||
57 |
|
62 | |||
58 |
|
63 | |||
59 | def wrapped_diff(filenode_old, filenode_new, diff_limit=None, file_limit=None, |
|
64 | def wrapped_diff(filenode_old, filenode_new, diff_limit=None, file_limit=None, | |
60 | show_full_diff=False, ignore_whitespace=True, line_context=3, |
|
65 | show_full_diff=False, ignore_whitespace=True, line_context=3, | |
61 | enable_comments=False): |
|
66 | enable_comments=False): | |
62 | """ |
|
67 | """ | |
63 | returns a wrapped diff into a table, checks for cut_off_limit for file and |
|
68 | returns a wrapped diff into a table, checks for cut_off_limit for file and | |
64 | whole diff and presents proper message |
|
69 | whole diff and presents proper message | |
@@ -79,8 +84,9 b' def wrapped_diff(filenode_old, filenode_' | |||||
79 | f_gitdiff = get_gitdiff(filenode_old, filenode_new, |
|
84 | f_gitdiff = get_gitdiff(filenode_old, filenode_new, | |
80 | ignore_whitespace=ignore_whitespace, |
|
85 | ignore_whitespace=ignore_whitespace, | |
81 | context=line_context) |
|
86 | context=line_context) | |
82 |
diff_processor = DiffProcessor( |
|
87 | diff_processor = DiffProcessor( | |
83 | file_limit=file_limit, show_full_diff=show_full_diff) |
|
88 | f_gitdiff, format='gitdiff', diff_limit=diff_limit, | |
|
89 | file_limit=file_limit, show_full_diff=show_full_diff) | |||
84 | _parsed = diff_processor.prepare() |
|
90 | _parsed = diff_processor.prepare() | |
85 |
|
91 | |||
86 | diff = diff_processor.as_html(enable_comments=enable_comments) |
|
92 | diff = diff_processor.as_html(enable_comments=enable_comments) | |
@@ -115,6 +121,10 b' def get_gitdiff(filenode_old, filenode_n' | |||||
115 | """ |
|
121 | """ | |
116 | # make sure we pass in default context |
|
122 | # make sure we pass in default context | |
117 | context = context or 3 |
|
123 | context = context or 3 | |
|
124 | # protect against IntOverflow when passing HUGE context | |||
|
125 | if context > MAX_CONTEXT: | |||
|
126 | context = MAX_CONTEXT | |||
|
127 | ||||
118 | submodules = filter(lambda o: isinstance(o, SubModuleNode), |
|
128 | submodules = filter(lambda o: isinstance(o, SubModuleNode), | |
119 | [filenode_new, filenode_old]) |
|
129 | [filenode_new, filenode_old]) | |
120 | if submodules: |
|
130 | if submodules: | |
@@ -190,7 +200,8 b' class DiffProcessor(object):' | |||||
190 | # used for inline highlighter word split |
|
200 | # used for inline highlighter word split | |
191 | _token_re = re.compile(r'()(>|<|&|\W+?)') |
|
201 | _token_re = re.compile(r'()(>|<|&|\W+?)') | |
192 |
|
202 | |||
193 |
def __init__(self, diff, format='gitdiff', diff_limit=None, |
|
203 | def __init__(self, diff, format='gitdiff', diff_limit=None, | |
|
204 | file_limit=None, show_full_diff=True): | |||
194 | """ |
|
205 | """ | |
195 | :param diff: A `Diff` object representing a diff from a vcs backend |
|
206 | :param diff: A `Diff` object representing a diff from a vcs backend | |
196 | :param format: format of diff passed, `udiff` or `gitdiff` |
|
207 | :param format: format of diff passed, `udiff` or `gitdiff` |
@@ -30,6 +30,7 b' import Pyro4' | |||||
30 | import pylons |
|
30 | import pylons | |
31 | import rhodecode |
|
31 | import rhodecode | |
32 |
|
32 | |||
|
33 | from rhodecode.model import meta | |||
33 | from rhodecode.lib import hooks_base |
|
34 | from rhodecode.lib import hooks_base | |
34 | from rhodecode.lib.utils2 import ( |
|
35 | from rhodecode.lib.utils2 import ( | |
35 | AttributeDict, safe_str, get_routes_generator_for_server_url) |
|
36 | AttributeDict, safe_str, get_routes_generator_for_server_url) | |
@@ -64,7 +65,10 b' class HooksHttpHandler(BaseHTTPRequestHa' | |||||
64 |
|
65 | |||
65 | def _call_hook(self, method, extras): |
|
66 | def _call_hook(self, method, extras): | |
66 | hooks = Hooks() |
|
67 | hooks = Hooks() | |
67 | result = getattr(hooks, method)(extras) |
|
68 | try: | |
|
69 | result = getattr(hooks, method)(extras) | |||
|
70 | finally: | |||
|
71 | meta.Session.remove() | |||
68 | return result |
|
72 | return result | |
69 |
|
73 | |||
70 | def log_message(self, format, *args): |
|
74 | def log_message(self, format, *args): | |
@@ -261,6 +265,7 b' class Hooks(object):' | |||||
261 | } |
|
265 | } | |
262 | finally: |
|
266 | finally: | |
263 | pylons.url._pop_object() |
|
267 | pylons.url._pop_object() | |
|
268 | meta.Session.remove() | |||
264 |
|
269 | |||
265 | return { |
|
270 | return { | |
266 | 'status': result.status, |
|
271 | 'status': result.status, |
@@ -406,8 +406,11 b' class SimpleVCS(object):' | |||||
406 | yield chunk |
|
406 | yield chunk | |
407 | finally: |
|
407 | finally: | |
408 | # invalidate cache on push |
|
408 | # invalidate cache on push | |
409 | if action == 'push': |
|
409 | try: | |
410 | self._invalidate_cache(repo_name) |
|
410 | if action == 'push': | |
|
411 | self._invalidate_cache(repo_name) | |||
|
412 | finally: | |||
|
413 | meta.Session.remove() | |||
411 |
|
414 | |||
412 | def _get_repository_name(self, environ): |
|
415 | def _get_repository_name(self, environ): | |
413 | """Get repository name out of the environmnent |
|
416 | """Get repository name out of the environmnent |
@@ -40,40 +40,35 b' def pylons_compatibility_tween_factory(h' | |||||
40 | from pyramid. For example while rendering an old template that uses the |
|
40 | from pyramid. For example while rendering an old template that uses the | |
41 | 'c' or 'h' objects. This tween sets up the needed pylons globals. |
|
41 | 'c' or 'h' objects. This tween sets up the needed pylons globals. | |
42 | """ |
|
42 | """ | |
43 | try: |
|
43 | config = rhodecode.CONFIG | |
44 | config = rhodecode.CONFIG |
|
44 | environ = request.environ | |
45 |
|
|
45 | session = request.session | |
46 | session = request.session |
|
46 | session_key = (config['pylons.environ_config'] | |
47 | session_key = (config['pylons.environ_config'] |
|
47 | .get('session', 'beaker.session')) | |
48 | .get('session', 'beaker.session')) |
|
|||
49 |
|
48 | |||
50 |
|
|
49 | # Setup pylons globals. | |
51 |
|
|
50 | pylons.config._push_object(config) | |
52 |
|
|
51 | pylons.request._push_object(request) | |
53 |
|
|
52 | pylons.session._push_object(session) | |
54 |
|
|
53 | environ[session_key] = session | |
55 |
|
|
54 | pylons.url._push_object(URLGenerator(config['routes.map'], | |
56 |
|
|
55 | environ)) | |
57 |
|
56 | |||
58 |
|
|
57 | # TODO: Maybe we should use the language from pyramid. | |
59 |
|
|
58 | translator = _get_translator(config.get('lang')) | |
60 |
|
|
59 | pylons.translator._push_object(translator) | |
61 |
|
||||
62 | # Get the rhodecode auth user object and make it available. |
|
|||
63 | auth_user = get_auth_user(environ) |
|
|||
64 | request.user = auth_user |
|
|||
65 | environ['rc_auth_user'] = auth_user |
|
|||
66 |
|
60 | |||
67 | # Setup the pylons context object ('c') |
|
61 | # Get the rhodecode auth user object and make it available. | |
68 | context = ContextObj() |
|
62 | auth_user = get_auth_user(environ) | |
69 |
|
|
63 | request.user = auth_user | |
70 | attach_context_attributes(context, request) |
|
64 | environ['rc_auth_user'] = auth_user | |
71 | pylons.tmpl_context._push_object(context) |
|
65 | ||
72 | return handler(request) |
|
66 | # Setup the pylons context object ('c') | |
73 | finally: |
|
67 | context = ContextObj() | |
74 | # Dispose current database session and rollback uncommitted |
|
68 | context.rhodecode_user = auth_user | |
75 | # transactions. |
|
69 | attach_context_attributes(context, request) | |
76 | meta.Session.remove() |
|
70 | pylons.tmpl_context._push_object(context) | |
|
71 | return handler(request) | |||
77 |
|
72 | |||
78 | return pylons_compatibility_tween |
|
73 | return pylons_compatibility_tween | |
79 |
|
74 |
General Comments 0
You need to be logged in to leave comments.
Login now