Changeset - 0a48c1ec04fc
[Not reviewed]
default
0 10 0
Marcin Kuzminski - 15 years ago 2010-10-12 22:25:25
marcin@python-works.com
#37 fixed json imports for python2.5
removed cache manager settings out of meta to ini files
docs update.
10 files changed with 74 insertions and 58 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -46,20 +46,31 @@ cache_dir = %(here)s/data
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=/%(here)s/data/cache/data
 
beaker.cache.lock_dir=/%(here)s/data/cache/lock
 
beaker.cache.regions=super_short_term,short_term,long_term
 
 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 

	
 
 beaker.cache.sql_cache_short.type=memory
 
 beaker.cache.sql_cache_short.expire=5
 
 
 
 beaker.cache.sql_cache_med.type=memory
 
 beaker.cache.sql_cache_med.expire=360
 
 
 
 beaker.cache.sql_cache_long.type=file
 
 beaker.cache.sql_cache_long.expire=3600
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## "dbm", "file", "memcached", "database", and "memory". 
 
## The storage uses the Container API 
docs/changelog.rst
Show inline comments
 
.. _changelog:
 

	
 
Changelog
 
=========
 

	
 
1.0.0rc4  (**2010-10-12**)
 

	
 
1.0.0rc3 (**tip**)
 
- fixed python2.5 missing simplejson imports (thanks to Jens Bäckman)
 
- removed cache_manager settings from sqlalchemy meta
 
- added sqlalchemy cache settings to ini files
 

	
 
1.0.0rc3 (**2010-10-11**)
 

	
 
- fixed i18n during installation.
 

	
 
1.0.0rc2 (**tip**)
 
1.0.0rc2 (**2010-10-11**)
 

	
 
- Disabled dirsize in file browser, it's causing nasty bug when dir renames 
 
  occure. After vcs is fixed it'll be put back again.
 
- templating/css rewrites, optimized css.
docs/setup.rst
Show inline comments
 
@@ -23,38 +23,35 @@ Setting up the application
 
  When asked for a path You can either use a new location of one with already 
 
  existing ones. RhodeCode will simply add all new found repositories to 
 
  it's database. Also make sure You specify correct path to repositories.
 
- Remember that the given path for mercurial_ repositories must be write 
 
  accessible for the application. It's very important since RhodeCode web interface
 
  will work even without such an access but, when trying to do a push it'll 
 
  eventually faile with permission denied errors. 
 
  eventually fail with permission denied errors. 
 
- Run 
 

	
 
::
 
 
 
 paster serve production.ini
 
 
 
- This command runs the rhodecode server the app should be available at the 
 
  127.0.0.1:5000. This ip and port is configurable via the production.ini 
 
  file  created in previos step
 
  file  created in previous step
 
- Use admin account you created to login.
 
- Default permissions on each repository is read, and owner is admin. So 
 
  remember to update these.
 
  remember to update these if needed.
 

	
 
- All needed configs are inside rhodecode sources ie. celeryconfig.py, 
 
  development.ini, production.ini You can configure the email, ports, loggers, 
 
  workers from there.
 
  
 
Setting up Whoosh
 
-----------------
 

	
 
- For full text search You can either put crontab entry for
 

	
 
::
 
 
 
 python /var/www/rhodecode/rhodecode/lib/indexers/daemon.py incremental <put_here_path_to_repos>
 
 python /var/www/rhodecode/<rhodecode_installation_path>/lib/indexers/daemon.py incremental <put_here_path_to_repos>
 
  
 
When using incremental mode whoosh will check last modification date of each file
 
and add it to reindex if newer file is available. Also indexing daemon checks
 
for removed files and removes them from index. Sometime You might want to rebuild
 
index from scrach, in admin pannel You can check `build from scratch` flag
 
and in standalone daemon You can pass `full` instead on incremental to build
 
@@ -78,13 +75,13 @@ Sample config for nginx::
 
            #this is important for https !!!
 
            proxy_set_header X-Url-Scheme $scheme;
 
            include         /etc/nginx/proxy.conf;  
 
    }
 
 }  
 
  
 
Here's the proxy.conf. It's tunned so it'll not timeout on long
 
Here's the proxy.conf. It's tuned so it'll not timeout on long
 
pushes and also on large pushes::
 

	
 
    proxy_redirect              off;
 
    proxy_set_header            Host $host;
 
    proxy_set_header            X-Host $http_host;
 
    proxy_set_header            X-Real-IP $remote_addr;
 
@@ -108,13 +105,13 @@ in production.ini file::
 
    use = egg:rhodecode
 
    full_stack = true
 
    static_files = false
 
    lang=en
 
    cache_dir = %(here)s/data
 

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

	
 

	
 
Other configuration files
 
-------------------------
 

	
 
Some extra configuration files and examples can be found here:
production.ini
Show inline comments
 
@@ -46,25 +46,36 @@ cache_dir = %(here)s/data
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=/%(here)s/data/cache/data
 
beaker.cache.lock_dir=/%(here)s/data/cache/lock
 
beaker.cache.regions=super_short_term,short_term,long_term
 
 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 

	
 
 beaker.cache.sql_cache_short.type=memory
 
 beaker.cache.sql_cache_short.expire=5
 
 
 
 beaker.cache.sql_cache_med.type=memory
 
 beaker.cache.sql_cache_med.expire=360
 
 
 
 beaker.cache.sql_cache_long.type=file
 
 beaker.cache.sql_cache_long.expire=3600
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## "dbm", "file", "memcached", "database", and "memory".
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = g654dcno0-9873jhgfreyu
rhodecode/__init__.py
Show inline comments
 
@@ -21,13 +21,13 @@
 
Created on April 9, 2010
 
RhodeCode, a web based repository management based on pylons
 
versioning implementation: http://semver.org/
 
@author: marcink
 
"""
 

	
 
VERSION = (1, 0, 0, 'rc3')
 
VERSION = (1, 0, 0, 'rc4')
 

	
 
__version__ = '.'.join((str(each) for each in VERSION[:4]))
 

	
 
def get_version():
 
    """
 
    Returns shorter version (digit parts only) as string.
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -47,25 +47,36 @@ app_instance_uuid = ${app_instance_uuid}
 

	
 
####################################
 
###         BEAKER CACHE        ####
 
####################################
 
beaker.cache.data_dir=/%(here)s/data/cache/data
 
beaker.cache.lock_dir=/%(here)s/data/cache/lock
 
beaker.cache.regions=super_short_term,short_term,long_term
 
 beaker.cache.regions=super_short_term,short_term,long_term,sql_cache_short,sql_cache_med,sql_cache_long
 
beaker.cache.long_term.type=memory
 
beaker.cache.long_term.expire=36000
 

	
 
beaker.cache.short_term.type=memory
 
beaker.cache.short_term.expire=60
 

	
 
beaker.cache.super_short_term.type=memory
 
beaker.cache.super_short_term.expire=10
 

	
 
 beaker.cache.sql_cache_short.type=memory
 
 beaker.cache.sql_cache_short.expire=5
 
 
 
 beaker.cache.sql_cache_med.type=memory
 
 beaker.cache.sql_cache_med.expire=360
 
 
 
 beaker.cache.sql_cache_long.type=file
 
 beaker.cache.sql_cache_long.expire=3600
 

	
 
####################################
 
###       BEAKER SESSION        ####
 
####################################
 
## Type of storage used for the session, current types are 
 
## dbm, file, memcached, database, and memory. 
 
## "dbm", "file", "memcached", "database", and "memory".
 
## The storage uses the Container API 
 
##that is also used by the cache system.
 
beaker.session.type = file
 

	
 
beaker.session.key = rhodecode
 
beaker.session.secret = ${app_instance_secret}
rhodecode/controllers/changelog.py
Show inline comments
 
@@ -19,22 +19,28 @@
 
# MA  02110-1301, USA.
 
"""
 
Created on April 21, 2010
 
changelog controller for pylons
 
@author: marcink
 
"""
 
from json import dumps
 

	
 
from mercurial.graphmod import colored, CHANGESET, revisions as graph_rev
 
from pylons import request, session, tmpl_context as c
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseController, render
 
from rhodecode.model.hg_model import HgModel
 
from webhelpers.paginate import Page
 
import logging
 
log = logging.getLogger(__name__)
 

	
 
try:
 
    import json
 
except ImportError:
 
    #python 2.5 compatibility
 
    import simplejson as json
 

	
 
class ChangelogController(BaseController):
 
    
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')    
 
    def __before__(self):
 
@@ -66,13 +72,13 @@ class ChangelogController(BaseController
 
        
 
        return render('changelog/changelog.html')
 

	
 

	
 
    def _graph(self, repo, size, p):
 
        revcount = size
 
        if not repo.revisions:return dumps([]), 0
 
        if not repo.revisions:return json.dumps([]), 0
 
        
 
        max_rev = repo.revisions[-1]
 
        offset = 1 if p == 1 else  ((p - 1) * revcount + 1)
 
        rev_start = repo.revisions[(-1 * offset)]
 
        
 
        revcount = min(max_rev, revcount)
 
@@ -83,8 +89,8 @@ class ChangelogController(BaseController
 
        data = []
 
        for (id, type, ctx, vtx, edges) in tree:
 
            if type != CHANGESET:
 
                continue
 
            data.append(('', vtx, edges))
 
    
 
        c.jsdata = dumps(data) 
 
        c.jsdata = json.dumps(data) 
 

	
rhodecode/controllers/summary.py
Show inline comments
 
@@ -32,13 +32,17 @@ from webhelpers.paginate import Page
 
from rhodecode.lib.celerylib import run_task
 
from rhodecode.lib.celerylib.tasks import get_commits_stats
 
from datetime import datetime, timedelta
 
from time import mktime
 
import calendar
 
import logging
 
try:
 
import json
 
except ImportError:
 
    #python 2.5 compatibility
 
    import simplejson as json
 
log = logging.getLogger(__name__)
 

	
 
class SummaryController(BaseController):
 
    
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
rhodecode/model/meta.py
Show inline comments
 
"""SQLAlchemy Metadata and Session object"""
 
from sqlalchemy.ext.declarative import declarative_base
 
from sqlalchemy.orm import scoped_session, sessionmaker
 
from rhodecode.model import caching_query
 
from beaker import cache
 
import os
 
from os.path import join as jn, dirname as dn, abspath
 
import time
 

	
 
# Beaker CacheManager.  A home base for cache configurations.
 
cache_manager = cache.CacheManager()
 

	
 
__all__ = ['Base', 'Session']
 
#
 
@@ -22,42 +19,8 @@ Session = scoped_session(
 

	
 
# The declarative Base
 
Base = declarative_base()
 
#For another db...
 
#Base2 = declarative_base()
 

	
 
#===============================================================================
 
# CACHE OPTIONS
 
#===============================================================================
 
cache_base = jn(dn(dn(dn(abspath(__file__)))), 'data')
 
cache_dir = jn(cache_base, 'cache')
 

	
 
if not os.path.isdir(cache_base):
 
    os.mkdir(cache_base)
 

	
 
if not os.path.isdir(cache_dir):
 
    os.mkdir(cache_dir)
 
# set start_time to current time
 
# to re-cache everything
 
# upon application startup
 
start_time = time.time()
 
# configure the "sqlalchemy" cache region.
 
cache_manager.regions['sql_cache_short'] = {
 
        'type':'memory',
 
        'data_dir':cache_dir,
 
        'expire':10,
 
        'start_time':start_time
 
    }
 
cache_manager.regions['sql_cache_med'] = {
 
        'type':'memory',
 
        'data_dir':cache_dir,
 
        'expire':360,
 
        'start_time':start_time
 
    }
 
cache_manager.regions['sql_cache_long'] = {
 
        'type':'file',
 
        'data_dir':cache_dir,
 
        'expire':3600,
 
        'start_time':start_time
 
    }
 
#to use cache use this in query
 
#.options(FromCache("sqlalchemy_cache_type", "cachekey"))
setup.cfg
Show inline comments
 
[egg_info]
 
tag_build = rc3
 
tag_build = rc4
 
tag_svn_revision = true
 

	
 
[easy_install]
 
find_links = http://www.pylonshq.com/download/
 

	
 
[nosetests]
 
@@ -29,6 +29,14 @@ output_dir = rhodecode/i18n
 

	
 
[update_catalog]
 
domain = rhodecode
 
input_file = rhodecode/i18n/rhodecode.pot
 
output_dir = rhodecode/i18n
 
previous = true
 

	
 
[build_sphinx]
 
source-dir = docs/
 
build-dir  = docs/_build
 
all_files  = 1
 

	
 
[upload_sphinx]
 
upload-dir = docs/_build/html
 
\ No newline at end of file
0 comments (0 inline, 0 general)