Permalink
Browse files

Merge branch 'master' into post-receive-hook

Conflicts fixed.
  • Loading branch information...
s0undt3ch committed Jul 24, 2011
2 parents 3a8df34 + 9e0f385 commit 3cf565bd843ed52674c641556e2a3544c33ea424
Showing with 283 additions and 153 deletions.
  1. +20 −3 README.mkd
  2. +7 −0 app/controllers/gitolite_hooks_controller.rb
  3. +3 −0 app/models/git_cache.rb
  4. +1 −1 app/views/projects/_git_urls.erb
  5. +1 −1 app/views/repositories/_git_urls.erb
  6. +16 −2 app/views/settings/_redmine_git_hosting.html.erb
  7. +4 −0 config/locales/bg.yml
  8. +4 −0 config/locales/bs.yml
  9. +4 −0 config/locales/ca.yml
  10. +4 −0 config/locales/cs.yml
  11. +4 −0 config/locales/da.yml
  12. +4 −0 config/locales/de.yml
  13. +4 −0 config/locales/el.yml
  14. +4 −0 config/locales/en.yml
  15. +4 −0 config/locales/es.yml
  16. +4 −0 config/locales/fi.yml
  17. +4 −0 config/locales/fr.yml
  18. +4 −0 config/locales/gl.yml
  19. +4 −0 config/locales/he.yml
  20. +4 −0 config/locales/hu.yml
  21. +4 −0 config/locales/id.yml
  22. +4 −0 config/locales/it.yml
  23. +4 −0 config/locales/ja.yml
  24. +4 −0 config/locales/ko.yml
  25. +4 −0 config/locales/lt.yml
  26. +4 −0 config/locales/nl.yml
  27. +4 −0 config/locales/no.yml
  28. +4 −0 config/locales/pl.yml
  29. +4 −0 config/locales/pt-BR.yml
  30. +4 −0 config/locales/pt.yml
  31. +4 −0 config/locales/ro.yml
  32. +4 −0 config/locales/ru.yml
  33. +4 −0 config/locales/sk.yml
  34. +4 −0 config/locales/sl.yml
  35. +4 −0 config/locales/sr.yml
  36. +4 −0 config/locales/sv.yml
  37. +4 −0 config/locales/th.yml
  38. +4 −0 config/locales/tr.yml
  39. +4 −0 config/locales/uk.yml
  40. +4 −0 config/locales/vi.yml
  41. +4 −0 config/locales/zh-TW.yml
  42. +4 −0 config/locales/zh.yml
  43. +15 −0 db/migrate/20091119162428_create_git_caches.rb
  44. +7 −4 init.rb
  45. +14 −10 lib/git_hosting.rb
  46. +55 −132 lib/git_hosting/patches/git_adapter_patch.rb
View
@@ -1,6 +1,8 @@
-# Redmine Git Hosting Plugin
+# Redmine Git Hosting Plugin (v0.3.0)
+
+A ChiliProject/Redmine plugin which makes configuring your own git hosting easy. Allows straightforward management of gitolite and associated public keys, the git daemon, and integrates code from Scott Schacon's "grack" utility to provide Git Smart HTTP access. Git repositories are automatically created when the repository is created in redmine. There is also an option to automatically create a git repository for a project, when the project is created. This plugin also implements caching functionality to speed page-load times for viewing git repositories.
+
-A ChiliProject/Redmine plugin which makes configuring your own git hosting easy. Allows straightforward management of gitolite and associated public keys, the git daemon, and integrates code from Scott Schacon's "grack" utility to provide Git Smart HTTP access. Git repositories are automatically created when the repository is created in redmine. There is also an option to automatically create a git repository for a project, when the project is created.
## Configuration Strategy
@@ -44,14 +46,29 @@ This assumes www-data is your web server user, and git is your git user (the use
RAILS_ENV=production rake db:migrate_plugins
+## Caching Options
+
+As of the latest version (0.3) this plugin includes code for caching output of the git command, which is called to display the details of the git repository. Redmine/ChiliProject by default calls git directly every time this information is needed. This can result in relatively long page load times.
+
+This plugin caches the output of git commands to dramatically improve page load times, roughly a 10x speed increase. On a 1GB VM running Ubuntu 11.04 median repository page load times dropped from 2300ms to 180ms. Testing was done with ab utility in the apache2-utils package.
+
+There are three configurable caching parameters in the plugins settings page: Max Cache Elements, Max Cache Element Size and Max Cache Time.
+
+*Max Cache Elements* is the maximum number of git commands for which to cache the output.
+
+*Max Cache Element Size* is the maximum size of the git output to cache. Anything above this size won't be cached, and git will be called directly every time this command is run.
+
+*Max Cache Time* is the maximum amount of time the git command will be cached. No matter what, the output of git commands for a given repository are cleared when new commits are pushed to the server and the post-receive hook is called.
+
+This caching functionality only works in Redmine 1.2.x+ and ChiliProject v2.x+ -- while this plugin is compatible with ChiliProject 1.x the caching functionality is not.
## Fast Deployment with YourChili Bash Library
Instead of installing/configuring by hand, one option for quickly deploying a fully-functional system for hosting git repositories on an Ubuntu VPS is the YourChili bash library. (http://github.com/ericpaulbishop/yourchili) This library allows you to quickly deploy ChiliProject, with this plugin to an un-initialized VPS node with Ubuntu 10.10 (from e.g. Linode) using nginx and Passenger. Just run the init\_nginx\_stack.sh script followed by the chili\_test.sh script, modifying the variables in those scripts as desired. This library is still under development, so these instructions may need to be updated in the near future.
## Tested Configurations
-This plugin has been primarily tested on Ubuntu Server 10.10 (32 and 64 bit) with ChiliProject v1.2.0, with PostgreSQL as the database (April, 2011). It is possible that some debugging will be necessary for other configurations.
+This plugin has been primarily tested on Ubuntu Server 10.10 and 11.04 (32 and 64 bit) with ChiliProject v1.x, ChiliProject 2.0.0 and Redmine 1.2.1 with PostgreSQL as the database (July, 2011). It is possible that some debugging will be necessary for other configurations.
## Required gems
@@ -19,6 +19,13 @@ def post_receive
# GitHosting.logger.info "Ref: OLD=>#{old} NEW=>#{new} REFNAME=>#{refname}"
#} if not params[:refs].nil?
+ #clear cache
+ old_cached=GitCache.find_all_by_proj_identifier(proj_identifier)
+ if old_cached != nil
+ old_ids = old_cached.collect(&:id)
+ GitCache.destroy(old_ids)
+ end
+
Repository.fetch_changesets_for_project(params[:project_id])
render(:text => 'OK')
end
View
@@ -0,0 +1,3 @@
+class GitCache < ActiveRecord::Base
+ attr_accessible :command, :command_output, :proj_identifier
+end
@@ -146,7 +146,7 @@
<% end %>
var gitUser = "<%= Setting.plugin_redmine_git_hosting['gitUser'] %>"
var gitServer = "<%= Setting.plugin_redmine_git_hosting['gitServer'] %>"
- var httpBase = "<%= Setting.plugin_redmine_git_hosting['httpServer'] %>" + "/" + ("<%= request.url %>").replace(/^[^\/]+[\/]+[^\/]+\//, "").replace(/projects\/[^\/]+.?$/, "")
+ var httpBase = "<%= Setting.plugin_redmine_git_hosting['httpServer'] %>"
var httpProto = "<%= project.repository[:git_http].to_s == "2" ? "http" : "https" %>"
httpBase = httpBase.replace(/\/$/, "")
@@ -146,7 +146,7 @@
<% end %>
var gitUser = "<%= Setting.plugin_redmine_git_hosting['gitUser'] %>"
var gitServer = "<%= Setting.plugin_redmine_git_hosting['gitServer'] %>"
- var httpBase = "<%= Setting.plugin_redmine_git_hosting['httpServer'] %>" + "/" + ("<%= request.url %>").replace(/^[^\/]+[\/]+[^\/]+\//, "").replace(/projects\/[^\/]+\/repository.?$/, "")
+ var httpBase = "<%= Setting.plugin_redmine_git_hosting['httpServer'] %>"
var httpProto = "<%= project.repository[:git_http].to_s == "2" ? "http" : "https" %>"
httpBase = httpBase.replace(/\/$/, "")
@@ -39,12 +39,26 @@
<%= select_tag("settings[gitRepositoriesShowUrl]", options_for_select([[l(:label_enabled), 'true'], [l(:label_disabled), 'false']], @settings['gitRepositoriesShowUrl'])) %>
<br />
</p>
- <br/>
-
<p>
<label><%= l(:label_logging)%></label>
<%= select_tag("settings[loggingEnabled]", options_for_select([[l(:label_enabled), 'true'], [l(:label_disabled), 'false']], @settings['loggingEnabled'])) %>
<em><%= l(:label_logging_warning)%></em>
+ </p>
+
+ <h3><%= l(:label_git_cache_parameters)%></h3>
+ <p>
+ <label><%= l(:label_git_cache_max_elements)%></label>
+ <%= text_field_tag("settings[gitCacheMaxElements]", @settings['gitCacheMaxElements'], :size => 20) %>
+ <br />
+ </p>
+ <p>
+ <label><%= l(:label_git_cache_max_size)%></label>
+ <%= text_field_tag("settings[gitCacheMaxSize]", @settings['gitCacheMaxSize'], :size => 20) %><em> MB</em>
+ <br />
+ </p>
+ <p>
+ <label><%= l(:label_git_cache_max_time)%></label>
+ <%= select_tag("settings[gitCacheMaxTime]", options_for_select([["until next commit", "-1"], ["1 minute or until next commit", "60"], ["15 minutes or until next commit", "900"], ["1 hour or until next commit", "3600"], ["1 day or until next commit", "86400"]], @settings['gitCacheMaxTime'] )) %>
<br />
</p>
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@ pt-BR:
messages:
'não pode ser mudada': 'não pode ser mudada'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@ pt:
messages:
'não pode ser mudada': 'não pode ser mudada'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
View
@@ -38,3 +38,7 @@
messages:
'may not be changed': 'may not be changed'
+ label_git_cache_max_time: Max Cache Time
+ label_git_cache_max_elements: Max Cache Elements
+ label_git_cache_max_size: Max Cache Element Size
+ label_git_cache_parameters: Git Cache Parameters
Oops, something went wrong.

0 comments on commit 3cf565b

Please sign in to comment.