[DRE-commits] r4739 - in trunk/redmine/debian: . doc/examples patches
Jérémy Lal
kapouer-guest at alioth.debian.org
Thu Feb 18 03:12:30 UTC 2010
Author: kapouer-guest
Date: 2010-02-18 03:12:29 +0000 (Thu, 18 Feb 2010)
New Revision: 4739
Added:
trunk/redmine/debian/patches/0017-plugin_assets_in_var_dir.patch
trunk/redmine/debian/patches/0018-dump_schema_to_cache_dir.patch
Modified:
trunk/redmine/debian/README.Debian
trunk/redmine/debian/TODO
trunk/redmine/debian/changelog
trunk/redmine/debian/dirs
trunk/redmine/debian/doc/examples/apache2-alias.conf
trunk/redmine/debian/doc/examples/apache2-host.conf
trunk/redmine/debian/doc/examples/apache2-passenger.conf
trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf
trunk/redmine/debian/doc/examples/lighttpd-host.conf
trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf
trunk/redmine/debian/doc/examples/lighttpd-socket.conf
trunk/redmine/debian/patches/series
trunk/redmine/debian/postinst
trunk/redmine/debian/postrm
Log:
We don't want redmine to depend on a writable /usr at runtime.
* Move /usr/share/redmine/public/plugin_assets to
RAILS_CACHE/plugin_assets so that it depends on the running instance only,
and is placed in a writable directory.
Provide server config (Alias) examples.
* Remove /usr/share/redmine/tmp which should really not be needed.
* set SCHEMA so that schema.db, created by db:migrate task (db:schema:dump),
is written to RAILS_CACHE instead of RAILS_ROOT/db. Also copy the old one from db/schema.db to the new instances-dependant directories.
* Stop creating directories in postinst especially when they are already in the package.
* Don't force remove /usr/share/redmine at purge time, plugins might be there.
Modified: trunk/redmine/debian/README.Debian
===================================================================
--- trunk/redmine/debian/README.Debian 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/README.Debian 2010-02-18 03:12:29 UTC (rev 4739)
@@ -96,8 +96,7 @@
located in the same dir.
- link /usr/share/redmine/db to $mydir/db :
ln -s /usr/share/redmine/db $mydir/db
- - then "install" redmine, note that db:migrate can't dump to /usr/share/redmine/db/schema.rb,
- but that won't stop redmine from working :
+ - then "install" redmine :
rake -f /usr/share/redmine/Rakefile generate_session_store
rake -f /usr/share/redmine/Rakefile db:migrate
rake -f /usr/share/redmine/Rakefile redmine:load_default_data
Modified: trunk/redmine/debian/TODO
===================================================================
--- trunk/redmine/debian/TODO 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/TODO 2010-02-18 03:12:29 UTC (rev 4739)
@@ -4,5 +4,4 @@
- login then logout does not clear session (this is rails 2.2 failure)
- REST web service partially working, e.g.
get /news.json with a valid HTTP authentication does not login as the user.
-- rake db:migrate actually calls db:dump, which tries to write to RAILS_ROOT/db/schema.rb
-This is a problem when run as unprivileged user (see README.Debian to reproduce).
+- plugin_assets should really be put in RAILS_CACHE/plugin_assets, i.e. depend on instance name.
Modified: trunk/redmine/debian/changelog
===================================================================
--- trunk/redmine/debian/changelog 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/changelog 2010-02-18 03:12:29 UTC (rev 4739)
@@ -2,7 +2,10 @@
* NOT RELEASED YET
* Recommends libapache2-mod-passenger and provide some example for
- its configuration (Closes: #570184).
+ its configuration. (Closes: #570184)
+ * Move public/plugin_assets to /var/cache/redmine/plugin_assets.
+ The server config must be fixed, examples are provided in the docs.
+ (Closes: #570308)
-- Jérémy Lal <kapouer at melix.org> Thu, 18 Feb 2010 01:19:07 +0100
Modified: trunk/redmine/debian/dirs
===================================================================
--- trunk/redmine/debian/dirs 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/dirs 2010-02-18 03:12:29 UTC (rev 4739)
@@ -1,7 +1,5 @@
var/log/redmine
var/cache/redmine
var/lib/redmine
-usr/share/redmine/tmp
-usr/share/redmine/public/plugin_assets
etc/redmine
usr/share/redmine/config/initializers/z-plugins
Modified: trunk/redmine/debian/doc/examples/apache2-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/apache2-alias.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/apache2-alias.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -8,7 +8,8 @@
# the mod_fcgid socket path
SocketPath "/var/run/redmine/sockets/default"
-
+
+ Alias "/redmine/plugin_assets/" /var/cache/redmine/default/plugin_assets/
Alias "/redmine" /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Options +FollowSymLinks +ExecCGI
Modified: trunk/redmine/debian/doc/examples/apache2-host.conf
===================================================================
--- trunk/redmine/debian/doc/examples/apache2-host.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/apache2-host.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -8,7 +8,7 @@
# the mod_fcgid socket path
SocketPath "/var/run/redmine/sockets/default"
-
+ Alias "/plugin_assets/" /var/cache/redmine/default/plugin_assets/
DocumentRoot /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Options +FollowSymLinks +ExecCGI
Modified: trunk/redmine/debian/doc/examples/apache2-passenger.conf
===================================================================
--- trunk/redmine/debian/doc/examples/apache2-passenger.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/apache2-passenger.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -5,6 +5,7 @@
RailsEnv production
RailsBaseURI /redmine
SetEnv X_DEBIAN_SITEID "default"
+ Alias "/redmine/plugin_assets/" /var/cache/redmine/default/plugin_assets/
DocumentRoot /usr/share/redmine/public
<Directory "/usr/share/redmine/public">
Order allow,deny
Modified: trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/lighttpd-host-alias.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -4,7 +4,10 @@
server.document-root = "/usr/share/redmine/public/"
server.indexfiles = ( "dispatch.fcgi" )
server.error-handler-404 = "/redmine/dispatch.fcgi"
- alias.url = ("/redmine" => "/usr/share/redmine/public")
+ alias.url = (
+ "/redmine/plugin_assets/" => "/var/cache/redmine/" + var.X_DEBIAN_SITEID + "/plugin_assets/",
+ "/redmine" => "/usr/share/redmine/public"
+ )
fastcgi.server += (
".fcgi" => (
"localhost" => (
Modified: trunk/redmine/debian/doc/examples/lighttpd-host.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-host.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/lighttpd-host.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -3,6 +3,9 @@
server.document-root = "/usr/share/redmine/public/"
server.indexfiles = ( "dispatch.fcgi" )
server.error-handler-404 = "/dispatch.fcgi"
+ alias.url = (
+ "/plugin_assets/" => "/var/cache/redmine/" + var.X_DEBIAN_SITEID + "/plugin_assets/"
+ )
#url.rewrite = ( "^\/$" => "index.html", "^([^.]+)$" => "$1.html" )
fastcgi.server += (
".fcgi" => (
Modified: trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/lighttpd-socket-alias.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -4,7 +4,10 @@
server.document-root = "/usr/share/redmine/public/"
server.indexfiles = ( "dispatch.fcgi" )
server.error-handler-404 = "/redmine/dispatch.fcgi"
- alias.url = ("/redmine" => "/usr/share/redmine/public")
+ alias.url = (
+ "/redmine/plugin_assets/" => "/var/cache/redmine/" + var.X_DEBIAN_SITEID + "/plugin_assets/",
+ "/redmine" => "/usr/share/redmine/public"
+ )
fastcgi.server += (
".fcgi" => (
"localhost" => (
Modified: trunk/redmine/debian/doc/examples/lighttpd-socket.conf
===================================================================
--- trunk/redmine/debian/doc/examples/lighttpd-socket.conf 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/doc/examples/lighttpd-socket.conf 2010-02-18 03:12:29 UTC (rev 4739)
@@ -1,5 +1,8 @@
$SERVER["socket"] == "localhost:8080" {
var.X_DEBIAN_SITEID = "default"
+ alias.url = (
+ "/plugin_assets/" => "/var/cache/redmine/" + var.X_DEBIAN_SITEID + "/plugin_assets/"
+ )
server.document-root = "/usr/share/redmine/public/"
server.indexfiles = ( "dispatch.fcgi" )
server.error-handler-404 = "/dispatch.fcgi"
Added: trunk/redmine/debian/patches/0017-plugin_assets_in_var_dir.patch
===================================================================
--- trunk/redmine/debian/patches/0017-plugin_assets_in_var_dir.patch (rev 0)
+++ trunk/redmine/debian/patches/0017-plugin_assets_in_var_dir.patch 2010-02-18 03:12:29 UTC (rev 4739)
@@ -0,0 +1,17 @@
+Author: Jérémy Lal <kapouer at melix.org>
+Bug-Debian: http://bugs.debian.org/570308
+
+---
+Engines plugin writes to /usr/share/redmine/public/plugin_assets
+at runtime. This patch makes it write to a proper directory.
+
+--- redmine-0.9.2.orig/config/environment.rb
++++ redmine-0.9.2/config/environment.rb
+@@ -21,6 +21,7 @@ require File.join(File.dirname(__FILE__)
+ # Load Engine plugin if available
+ begin
+ require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
++ Engines::public_directory = "#{ENV['RAILS_CACHE']}/plugin_assets"
+ rescue LoadError
+ # Not available
+ end
Added: trunk/redmine/debian/patches/0018-dump_schema_to_cache_dir.patch
===================================================================
--- trunk/redmine/debian/patches/0018-dump_schema_to_cache_dir.patch (rev 0)
+++ trunk/redmine/debian/patches/0018-dump_schema_to_cache_dir.patch 2010-02-18 03:12:29 UTC (rev 4739)
@@ -0,0 +1,19 @@
+Author: Jérémy Lal <kapouer at melix.org>
+
+---
+rake task db:migrate calls db:schema:dump, which writes to
+/usr/share/redmine/db, independently of the X_DEBIAN_SITEID instance.
+This patch makes it write to (by default)
+/var/cache/redmine/${X_DEBIAN_SITEID}/schema.db
+so that each instance has its own migration dump.
+
+--- redmine-0.9.2.orig/config/environment.rb
++++ redmine-0.9.2/config/environment.rb
+@@ -11,6 +11,7 @@ ENV['RAILS_ETC'] ||= "/etc/redmine/#{ENV
+ ENV['RAILS_LOG'] ||= "/var/log/redmine/#{ENV['X_DEBIAN_SITEID']}"
+ ENV['RAILS_VAR'] ||= "/var/lib/redmine/#{ENV['X_DEBIAN_SITEID']}"
+ ENV['RAILS_CACHE'] ||= "/var/cache/redmine/#{ENV['X_DEBIAN_SITEID']}"
++ENV['SCHEMA'] ||= "#{ENV['RAILS_CACHE']}/schema.db"
+
+ # Specifies gem version of Rails to use when vendor/rails is not present
+ RAILS_GEM_VERSION = '2.2.3' unless defined? RAILS_GEM_VERSION
Modified: trunk/redmine/debian/patches/series
===================================================================
--- trunk/redmine/debian/patches/series 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/patches/series 2010-02-18 03:12:29 UTC (rev 4739)
@@ -14,3 +14,5 @@
0014-Monkey-patches-for-group-support-taken-from-rails-2..patch
0015-Move-session-configuration-to-YML-file-next-to-datab.patch
0016-Request-forgery-protection-allow-XHR.patch
+0017-plugin_assets_in_var_dir.patch
+0018-dump_schema_to_cache_dir.patch
Modified: trunk/redmine/debian/postinst
===================================================================
--- trunk/redmine/debian/postinst 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/postinst 2010-02-18 03:12:29 UTC (rev 4739)
@@ -48,18 +48,9 @@
mkdir -p $fRailsRun/sockets
chown -f www-data:www-data $fRailsRun
chown -f www-data:www-data $fRailsRun/sockets
- if [ ! -e $fRailsLog ]; then
- mkdir -p $fRailsLog
- chown -f www-data:www-data $fRailsLog
- fi
- if [ ! -e $fRailsVar ]; then
- mkdir -p $fRailsVar
- chown -f www-data:www-data $fRailsVar
- fi
- if [ ! -e $fRailsCache ]; then
- mkdir -p $fRailsCache
- chown -f www-data:www-data $fRailsCache
- fi
+ chown -f www-data:www-data $fRailsLog
+ chown -f www-data:www-data $fRailsVar
+ chown -f www-data:www-data $fRailsCache
savedir="`pwd`"
cd /usr/share/redmine
if [ ! -e vendor/rails ]; then
@@ -74,15 +65,10 @@
if [ ! -e lib/plugins ]; then
mkdir lib/plugins
fi
- if [ ! -e public/plugin_assets ]; then
- mkdir public/plugin_assets
+ # this directory should never be used: /usr not writable policy
+ if [ -e tmp ]; then
+ rm -rf tmp
fi
- chown -f www-data:www-data public/plugin_assets
- if [ ! -e tmp ]; then
- mkdir tmp
- fi
- chown -fR www-data:www-data tmp
-
cd $savedir
;;
@@ -188,18 +174,24 @@
mkdir -p $fRailsVar
mkdir -p $fRailsVar/files
mkdir -p $fRailsCache
+ mkdir -p $fRailsCache/plugin_assets
chmod 750 $fRailsLog
chmod 750 $fRailsVar
chmod 750 $fRailsCache
+ chmod 750 $fRailsCache/plugin_assets
chown -f www-data:www-data $fRailsLog
chown -f www-data:www-data $fRailsVar
chown -f www-data:www-data $fRailsVar/files
chown -f www-data:www-data $fRailsCache
+ chown -f www-data:www-data $fRailsCache/plugin_assets
mkdir -p /var/run/redmine/sockets/${lInstance}
chown -f www-data:www-data /var/run/redmine/sockets/${lInstance}
savedir="`pwd`"
cd /usr/share/redmine
-
+ # copy schema.db to its instance directory
+ if [ -f db/schema.db ]; then
+ cp db/schema.db $fRailsCache/schema.db
+ fi
# add secret key, set permissions, manage file with ucf
if [ ! -f "${fRailsEtc}/session.yml" ]; then
rake -s generate_session_store YML_SESSION_FILENAME="session.yml.new" RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" || true
Modified: trunk/redmine/debian/postrm
===================================================================
--- trunk/redmine/debian/postrm 2010-02-18 03:11:56 UTC (rev 4738)
+++ trunk/redmine/debian/postrm 2010-02-18 03:12:29 UTC (rev 4739)
@@ -70,15 +70,17 @@
ucf --purge /etc/redmine/$lInstance/session.yml
done
fi
-
+ # package-generated or runtime files are removed
+ rm -f /usr/share/redmine/db/schema.db
rm -rf /var/run/redmine
rm -rf /var/log/redmine
- rm -rf /usr/share/redmine
- rmdir /var/lib/redmine/*/files || true
+ rm -rf /usr/share/redmine/tmp
rm -rf /var/lib/redmine/*/sessions
- rmdir /var/lib/redmine/* || true
rm -rf /var/cache/redmine
rm -rf /etc/redmine
+ # user files are not
+ rmdir /var/lib/redmine/*/files || true
+ rmdir /var/lib/redmine/* || true
db_purge
;;
*)
More information about the Pkg-ruby-extras-commits
mailing list