Changeset - 136af52f374b
[Not reviewed]
default
0 12 0
Marcin Kuzminski - 15 years ago 2011-01-06 19:10:25
marcin@python-works.com
merged found bugs and fixed for stable release:

- added force https option into ini files for easier https usage (no need to
set server headers with this options)
- small css updates
- fixed #96 redirect loop on files view on repositories without changesets
- fixed #97 unicode string passed into server header in special cases (mod_wsgi)
and server crashed with errors
- fixed large tooltips problems on main page
- fixed #92 whoosh indexer is more error proof
12 files changed with 122 insertions and 51 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -46,6 +46,7 @@ lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
docs/changelog.rst
Show inline comments
 
@@ -3,6 +3,25 @@
 
Changelog
 
=========
 

	
 
1.1.1 (**2011-01-06**)
 
----------------------
 
 
 
news
 
++++
 

	
 
- added force https option into ini files for easier https usage (no need to
 
  set server headers with this options)
 
- small css updates
 

	
 
fixes
 
++++
 

	
 
- fixed #96 redirect loop on files view on repositories without changesets
 
- fixed #97 unicode string passed into server header in special cases (mod_wsgi)
 
  and server crashed with errors
 
- fixed large tooltips problems on main page
 
- fixed #92 whoosh indexer is more error proof
 

	
 
1.1.0 (**2010-12-18**)
 
----------------------
 

	
docs/setup.rst
Show inline comments
 
@@ -157,6 +157,16 @@ In order to make start using celery run:
 
 paster celeryd <configfile.ini>
 

	
 

	
 
HTTPS support
 
-------------
 

	
 
There are two ways to enable https, first is to set HTTP_X_URL_SCHEME in
 
Your http server headers, than rhodecode will recognise this headers and make
 
proper https redirections, another way is to set `force_https = true` 
 
in the ini cofiguration to force using https, no headers are needed than to
 
enable https
 

	
 

	
 
Nginx virtual host example
 
--------------------------
 

	
 
@@ -210,9 +220,36 @@ in production.ini file::
 

	
 
To not have the statics served by the application. And improve speed.
 

	
 
Apache reverse proxy
 
--------------------
 
Tutorial can be found here
 

	
 
Apache virtual host example
 
---------------------------
 

	
 
Sample config for apache using proxy::
 

	
 
<VirtualHost *:80>
 
        ServerName hg.myserver.com
 
        ServerAlias hg.myserver.com
 

	
 
        <Proxy *>
 
          Order allow,deny
 
          Allow from all
 
        </Proxy>
 

	
 
        #important !
 
        #Directive to properly generate url (clone url) for pylons
 
        ProxyPreserveHost On
 

	
 
        #rhodecode instance
 
        ProxyPass / http://127.0.0.1:5000/
 
        ProxyPassReverse / http://127.0.0.1:5000/
 
        
 
        #to enable https use line below
 
        #SetEnvIf X-Url-Scheme https HTTPS=1
 
        
 
</VirtualHost> 
 

	
 

	
 
Additional tutorial
 
http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
 

	
 

	
production.ini
Show inline comments
 
@@ -46,6 +46,7 @@ lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -47,6 +47,7 @@ cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = ${app_instance_uuid}
 
cut_off_limit = 256000
 
force_https = false 
 

	
 
####################################
 
###        CELERY CONFIG        ####
rhodecode/controllers/files.py
Show inline comments
 
@@ -39,7 +39,8 @@ from rhodecode.lib.base import BaseContr
 
from rhodecode.lib.utils import EmptyChangeset
 
from rhodecode.model.scm import ScmModel
 

	
 
from vcs.exceptions import RepositoryError, ChangesetError
 
from vcs.exceptions import RepositoryError, ChangesetError, \
 
    ChangesetDoesNotExistError, EmptyRepositoryError
 
from vcs.nodes import FileNode
 
from vcs.utils import diffs as differ
 

	
 
@@ -91,6 +92,10 @@ class FilesController(BaseController):
 
                h.flash(str(e), category='warning')
 
                redirect(h.url('files_home', repo_name=repo_name, revision=revision))
 

	
 
        except EmptyRepositoryError, e:
 
            h.flash(_('There are no files yet'), category='warning')
 
            redirect(h.url('summary_home', repo_name=repo_name))
 

	
 
        except RepositoryError, e:
 
            h.flash(str(e), category='warning')
 
            redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
rhodecode/lib/indexers/daemon.py
Show inline comments
 
@@ -116,10 +116,17 @@ class WhooshIndexingDaemon(object):
 
        the instance of vcs backend"""
 
        node = self.get_node(repo, path)
 

	
 
        #we just index the content of chosen files
 
        if node.extension in INDEX_EXTENSIONS:
 
        #we just index the content of chosen files, and skip binary files
 
        if node.extension in INDEX_EXTENSIONS and not node.is_binary:
 
            
 
            u_content = node.content
 
            if not isinstance(u_content, unicode):
 
                log.warning('  >> %s Could not get this content as unicode '
 
                          'replacing with empty content', path)
 
                u_content = u''
 
            else:
 
            log.debug('    >> %s [WITH CONTENT]' % path)
 
            u_content = node.content
 
                
 
        else:
 
            log.debug('    >> %s' % path)
 
            #just index file name without it's content
rhodecode/lib/middleware/https_fixup.py
Show inline comments
 
#!/usr/bin/env python
 
# encoding: utf-8
 
# middleware to handle https correctly
 
# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
 
# -*- coding: utf-8 -*-
 
"""
 
    rhodecode.lib.middleware.https_fixup
 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 
    middleware to handle https correctly
 
    
 
    :created_on: May 23, 2010
 
    :author: marcink
 
    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
 
    :license: GPLv3, see COPYING for more details.
 
"""
 
# This program is free software; you can redistribute it and/or
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
@@ -18,15 +25,12 @@
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
# MA  02110-1301, USA.
 

	
 
"""
 
Created on May 23, 2010
 

	
 
@author: marcink
 
"""
 
from rhodecode.lib import str2bool
 

	
 
class HttpsFixup(object):
 
    def __init__(self, app):
 
    def __init__(self, app, config):
 
        self.application = app
 
        self.config = config
 
    
 
    def __call__(self, environ, start_response):
 
        self.__fixup(environ)
 
@@ -40,6 +44,9 @@ class HttpsFixup(object):
 
        """
 
        proto = environ.get('HTTP_X_URL_SCHEME')
 
            
 
        if str2bool(self.config.get('force_https')):
 
            proto = 'https'
 

	
 
        if proto == 'https':
 
            environ['wsgi.url_scheme'] = proto
 
        else:
rhodecode/lib/middleware/simplehg.py
Show inline comments
 
@@ -69,6 +69,8 @@ class SimpleHg(object):
 
        proxy_key = 'HTTP_X_REAL_IP'
 
        def_key = 'REMOTE_ADDR'
 
        self.ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0'))
 
        # skip passing error to error controller
 
        environ['pylons.status_code_redirect'] = True
 

	
 
        #===================================================================
 
        # AUTHENTICATE THIS MERCURIAL REQUEST
 
@@ -76,7 +78,7 @@ class SimpleHg(object):
 
        username = REMOTE_USER(environ)
 

	
 
        if not username:
 
            self.authenticate.realm = self.config['rhodecode_realm']
 
            self.authenticate.realm = str(self.config['rhodecode_realm'])
 
            result = self.authenticate(environ)
 
            if isinstance(result, str):
 
                AUTH_TYPE.update(environ, 'basic')
rhodecode/public/css/style.css
Show inline comments
 
@@ -905,20 +905,6 @@ margin:0;
 
padding:4px 8px;
 
}
 
 
#content div.box div.form div.fields div.field div.input a.ui-input-file {
 
width:28px;
 
height:28px;
 
display:inline;
 
position:absolute;
 
overflow:hidden;
 
cursor:pointer;
 
background:#e5e3e3 url("../images/button_browse.png") no-repeat;
 
border:none;
 
text-decoration:none;
 
margin:0 0 0 6px;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea {
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
@@ -978,15 +964,6 @@ font-size:11px;
 
padding:5px 5px 5px 0;
 
}
 
 
#content div.box div.form div.fields div.field div.textarea table td table td a.mceButtonActive {
 
background:#b1b1b1;
 
}
 
 
#content div.box div.form div.fields div.field div.select a.ui-selectmenu {
 
color:#565656;
 
text-decoration:none;
 
}
 
 
#content div.box div.form div.fields div.field input[type=text]:focus,#content div.box div.form div.fields div.field input[type=password]:focus,#content div.box div.form div.fields div.field input[type=file]:focus,#content div.box div.form div.fields div.field textarea:focus,#content div.box div.form div.fields div.field select:focus {
 
background:#f6f6f6;
 
border-color:#666;
 
@@ -997,7 +974,7 @@ margin:0;
 
padding:0 0 0 8px;
 
}
 
 
div.form div.fields div.field div.highlight .ui-state-default {
 
div.form div.fields div.field div.highlight .ui-button {
 
background:#4e85bb url("../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
@@ -1019,7 +996,7 @@ margin:0;
 
padding:6px 12px;
 
}
 
 
#content div.box div.form div.fields div.buttons div.highlight input.ui-state-default {
 
#content div.box div.form div.fields div.buttons div.highlight input.ui-button {
 
background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
@@ -1408,7 +1385,7 @@ margin:0;
 
padding:10px 0 0 150px;
 
}
 
 
#register div.form div.fields div.buttons div.highlight input.ui-state-default {
 
#register div.form div.fields div.buttons div.highlight input.ui-button {
 
background:url("../images/button_highlight.png") repeat-x scroll 0 0 #4E85BB;
 
color:#FFF;
 
border-color:#5C91A4 #2B7089 #1A6480 #2A6F89;
 
@@ -1614,10 +1591,18 @@ padding:0;
 
}
 
 
div.browserblock .browser-header {
 
border-bottom:1px solid #CCC;
 
background:#FFF;
 
color:blue;
 
padding:10px 0;
 
float:left;
 
}
 
 
div.browserblock .browser-branch {
 
background:#FFF;
 
padding:20px 0 0 0;
 
float:left;
 
}
 
div.browserblock .browser-branch label {
 
color:#4A4A4A;	
 
}
 
 
div.browserblock .browser-header span {
 
@@ -1627,6 +1612,7 @@ font-weight:700;
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
border-top:1px solid #CCC;
 
}
 
 
table.code-browser {
 
@@ -1754,6 +1740,10 @@ width:auto;
 
opacity:1px;
 
padding:8px;
 
white-space: pre;
 
-webkit-border-radius: 8px 8px 8px 8px;
 
-khtml-border-radius: 8px 8px 8px 8px; 
 
-moz-border-radius: 8px 8px 8px 8px;
 
border-radius: 8px 8px 8px 8px;
 
}
 
 
.ac {
 
@@ -2052,7 +2042,7 @@ border-left:1px solid #316293;
 
border:1px solid #316293;
 
}
 
 
#content div.box div.title div.search div.button input.ui-state-default {
 
#content div.box div.title div.search div.button input.ui-button {
 
background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 
border:1px solid #316293;
 
border-left:none;
 
@@ -2066,7 +2056,7 @@ border-left:none;
 
color:#FFF;
 
}
 
 
#content div.box div.form div.fields div.field div.highlight .ui-state-default {
 
#content div.box div.form div.fields div.field div.highlight .ui-button {
 
background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
@@ -2211,7 +2201,7 @@ font-weight:700;
 
margin:0;
 
}
 
 
div.form div.fields div.field div.button .ui-state-default,#content div.box div.form div.fields div.buttons input.ui-state-default {
 
div.form div.fields div.field div.button .ui-button,#content div.box div.form div.fields div.buttons input.ui-button {
 
background:#e5e3e3 url("../images/button.png") repeat-x;
 
border-top:1px solid #DDD;
 
border-left:1px solid #c6c6c6;
 
@@ -2259,7 +2249,7 @@ margin:6px 0 0;
 
padding:0;
 
}
 
 
#content div.box div.action div.button input.ui-state-default,#login div.form div.fields div.buttons input.ui-state-default,#register div.form div.fields div.buttons input.ui-state-default {
 
#content div.box div.action div.button input.ui-button,#login div.form div.fields div.buttons input.ui-button,#register div.form div.fields div.buttons input.ui-button {
 
background:#e5e3e3 url("../images/button.png") repeat-x;
 
border-top:1px solid #DDD;
 
border-left:1px solid #c6c6c6;
rhodecode/templates/index.html
Show inline comments
 
@@ -87,7 +87,7 @@
 
		            </div>
 
		            </td>
 
		            ##DESCRIPTION
 
		            <td><span class="tooltip" tooltip_title="${repo['description']}">
 
		            <td><span class="tooltip" tooltip_title="${h.tooltip(repo['description'])}">
 
		               ${h.truncate(repo['description'],60)}</span>
 
		            </td>
 
		            ##LAST CHANGE
test.ini
Show inline comments
 
@@ -45,6 +45,7 @@ lang=en
 
cache_dir = %(here)s/data
 
index_dir = /tmp/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
0 comments (0 inline, 0 general)