Blog

Some ramblings and write-ups about tech, music, travelling and other topics.

Redmine + Apache + Proxying Webrick on Windows 7

We’ll use Apache to proxy requests to WEBrick on higher ports, allowing us to
maintain the applications separately, and even move the applications to different servers at some
point.

First, Run Redmine on Webrick

Go to your app directory in commandline:
ruby script\server -p 4000 -e production --path=/redmine
Now the app will be running on http://localhost:4000.

Configure Apache to Proxy the Redmine

Make sure proxy is enabled.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
In <apache_root>\conf\extra\httpd-proxy.conf, put the following:
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
Create a new file in <apache root>\conf\extra\ called httpd-<appname>.conf Place the following into the file
Alias /redmine "P:/web/redmine/public"
<Directory "P:/web/redmine/public">
	Options Indexes FollowSymLinks
	AllowOverride none
	Order allow,deny
	Allow from all
</Directory>

<IfModule proxy_module>
<IfModule proxy_http_module>
	ProxyPass /redmine/images !
	ProxyPass /redmine/stylesheets !
	ProxyPass /redmine/javascripts !
	ProxyPass /redmine http://127.0.0.1:4000/redmine
	ProxyPassReverse /redmine http://localhost:4000/redmine
	ProxyPreserveHost On
	#continue with other static files that should be served by apache
	Alias /redmine/images P:/web/redmine/public/images/
	Alias /redmine/stylesheets P:/web/redmine/public/stylesheets/
	Alias /redmine/javascript P:/web/redmine/public/javascript/
	# Remove the following on public sites as this is insecure
	Alias /redmine/plugin_assets C:/Repositories/redmine/public/plugin_assets/
	Alias /redmine/help C:/Repositories/redmine/public/help/
</IfModule>
</IfModule>

Run Webrick on Startup

Place the following into a batch file and run it at startup (regedit "run" thingie or just simply place it in the Startup folder)
P:
cd \web\redmine
ruby script\server -p 4000 -e production --path=/redmine -d
Note: the -d option will make Webrick run as a daemon. Update: the "-d" option doesn't seem to work on Windows version of ruby ("daemon.rb:4:in `fork': fork() function is unimplemented on this machine"). So maybe without the -d option and set the no-window option in the batch file options. Update: you can use Task Scheduler instead http://social.technet.microsoft.com/Forums/en-ZA/w7itprogeneral/thread/0013415c-ad8c-4c58-84b7-7ef8eff46cda Command: ruby Argument: script\server -p 4000 -e production --path=/redmine Start in P:\web\redmine "Runs with highest privileges" and "At startup"

cmd.exe Command History

You can save all your hardcore commandlining into a batch file by a simple command:

doskey  /history  > hist.bat

Cloning SVN Repositories

  • Create your local repository:
    svnadmin create `readlink -f .`
  • Create an empty pre-revprop-change hook script:
    cat >> PATH/hooks/pre-revprop-change<<'EOF'
     #!/bin/bash
     EOF
  • Make the pre-revprop-change hook script executable:
    chmod +x PATH/hooks/pre-revprop-change
  • Initialize svnsync:
    svnsync init file:///PATH URL_TO_REPO_ROOT_TO_CLONE
  • Synchronize:
    svnsync sync DEST_URL

On Transmission Daemon and Frame Size

My transmission-daemon kept crashing the NAS. In messages, I saw: transmission-da: page allocation failure. order:2, mode:0x20 So I dug around and found this topic: Source Changed the frame back to 1500 and the error seems to have disappeared, although I'm probably getting a lot less thoughput now...