Binary Static

How to install Redmine from SVN with Apache Passenger and Postgresql

Posted in Applications, Linux, SysAdmin, Web by Chris on September 1, 2012

System: debian 6.0.5

Redmine’s standard debian packages are pretty outdated, so here’s how I installed its latest stable version. I used postgresql as database.

Get the latest stable version from the projects subversion. Do a checkout and keep the .svn directory for later updates on this branch:

# svn co /usr/share/redmine

Make sure ruby and rubygems and necessary libraries are installed:

# apt-get install ruby rubygems libpq-dev libmagickcore-dev libmagickwand-dev

Install bundler, which is ruby’s dependency manager, and rake, which is its build tool and conveniently to their executables:

# gem install bundler
# ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle
# gem install rake
# ln -s /var/lib/gems/1.8/bin/rake /usr/local/bin/rake

Change to the Redmine root directory and install all needed libraries with bundler:

# bundle install --without development test mysql sqlite

Configure /usr/share/redmine/config/database.yml:

  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: password
  encoding: utf8

Create the role and user in the postgresql database:

# su postgres
$ psql
'password' NOINHERIT VALID UNTIL 'infinity';

Logout from the database and its user and generate the session token (again as root in /usr/share/redmine):

# rake generate_secret_token

Generate the database schema and load the fixtures:

# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data

Allow the Apache user (assuming www-data) access to relevant directories:

# mkdir tmp public/plugin_assets
# sudo chown -R redmine:redmine files log tmp public/plugin_assets
# sudo chmod -R 755 files log tmp public/plugin_assets

Test your installation by starting the built-in-server webrick, stop it with Ctrl-C:

# ruby script/rails server webrick -e production

Configure the named virtual host in

<VirtualHost *:80>

     DocumentRoot /usr/share/redmine/public

     RailsEnv production
     RailsBaseURI /
     <Location "/">
         Options ExecCGI FollowSymLinks
         Order allow,deny
         Allow from all

At first, I linked to the Redmine root directory. This became unnecessary as I made it the document root of the vhost:

# ln -s /usr/share/redmine/public /srv/

I configured e-mail (using exim4 and tls) in /usr/share/redmine/config/configuration.yml:

    delivery_method: :smtp
      enable_starttls_auto: true
      port: 25
      authentication: :plain
      user_name: "redmine"
      password: password

Start Redmine by restarting Apache:

# a2ensite
# /etc/init.d/apache2 restart

Log into Redmine under Default username admin and password admin.

Tagged with:

Install Redmine on Debian Squeeze with Apache Passenger

Posted in Applications, Linux, SysAdmin, Web by Chris on August 30, 2012

This is how I installed redmine on my server, which runs debian 6.0.5. Get the packages:

# apt-get install redmine redmine-sqlite rails rake ruby \
librmagick-ruby libapache2-mod-passenger ruby-passenger

Debian should activate the passenger module during install.  Also during install you should set the defaults for the database module. This should be simple if you use sqlite3.  Strangely enough, the package does not touch a log file for the production environment.  I did this manually:

# mkdir /usr/share/redmine/log/log
# touch /usr/share/redmine/log/production.log

Try running webrick; kill with Ctrl+C:

# cd /usr/share/redmine
# ruby script/server -e production

At first I symlinked to the public directory of redmine.  Yet, this seems to have become unneccessary later:

# ln -s /usr/share/redmine/public /srv/

Create a named virtual host /etc/apache2/sites-available/

<VirtualHost *:80>

     DocumentRoot /usr/share/redmine/public

     RailsEnv production
     RailsBaseURI /
     <Location "/">
         Options ExecCGI FollowSymLinks
         Order allow,deny
         Allow from all

Configure e-mail service (exim4, tls) in /etc/redmine/default/email.yml:

  delivery_method: :smtp
    ssl: true
    enable_starttls_auto: true
    port: 25
    authentication: :plain
    user_name: "redmine"
    password: password

Activate the whole she-bang:

# a2ensite
# /etc/init.d/apache2 restart

Start redmine with Default username admin and password admin.

Tagged with:

Interleaving two PDF files…

Posted in Applications, Hacking, Linux by Chris on October 17, 2010

Lightbulb…with no scripting required.  You’ll need the pdftk package though.  Say you’ve got a PDF file that has a two-sided layout and you want to trim the pages.  You could do this with pdfnup — however, your file may cut off from the even pages what it adds to the odd ones.  What now?  The solution is simple:

1. Use pdftk to split the file in even and odd pages seperately:

pdftk in.pdf cat 1-endeven output out.even.pdf
pdftk in.pdf cat 1-endodd output out.odd.pdf

2. Now would be the time to apply some pdfnup trimming magic to the two new files.

3. Use pdftk to burst these two files into single pages:

pdftk out.odd.pdf burst output %04d_A.pdf
pdftk out.even.pdf burst output %04d_B.pdf

4. Use pdftk to merge the pages back into one file, e.g.:

pdftk *.pdf cat output out.pdf

The important point here lies in step 3 when appending A or B to the odd and even page file names, because this allows glob sorting the pages like 0001_A.pdf 0001_B.pdf 0002_A.pdf 0002_B.pdf and so on.  I can’t believe I started to write a script before I realized how to solve this the simple way…

Tagged with: , , ,

Make the TrackPoint play nice with Fedora 13

Posted in Linux, SysAdmin by Chris on May 28, 2010

Moving faster
Speed and sensitivity defaults leave my Thinkpad’s trackpoint excruciatingly slow. So first thing is to create /etc/udev/rules.d/10-trackpoint.rules containing one line:

SUBSYSTEM=="serio", DRIVERS=="psmouse", ATTR{speed}="220", ATTR{sensitivity}="190"

I also like to scroll with the help of the middle button. For this Fedora 13 now uses user config files for X like /etc/X11/xorg.conf.d/20-thinkpad.conf reading e.g.:

Section "InputClass"
    Identifier      "Trackpoint Wheel Emulation"
    MatchProduct    "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint"
    MatchDevicePath "/dev/input/event*"
    Option	    "EmulateWheel"       "true"
    Option	    "EmulateWheelButton" "2"
    Option	    "Emulate3Buttons"    "false"
    Option	    "XAxisMapping"       "6 7"
    Option	    "YAxisMapping"       "4 5"

Tagged with: , , , ,

Smooth Transition to Goddard

Posted in Linux, SysAdmin by Chris on May 27, 2010

Fedora LogoYesterday, I upgraded my main system to Fedora 13.  Coming from the excellent Fedora 12, this was a smooth transisition indeed.  Everything’s working fine, the whole operation took less than two hours (4 min to install the new system from a pen drive, ca. 90 min to reinstall my package collection, including 2 GB downloads).  I was expecially impressed with the new auto-installing language packages, which gave me a localized desktop from the first login.   As exepected, on my Thinkpad X200 everything worked right out of the box.  No horrible Macification surprises either.  Thank you very much, Fedora team!  Keep up the great work!

My Linux Video Toolchain

Posted in Linux, Multimedia by Chris on May 15, 2010

Ok, not perfect. But here are some notes about my way so far…

Concept You’ll want to compress the video & audio streams and wrap them in a flexible container, which should be capable of holding additional information like chapter markers and titles, audio subtitles, cover images, and archive information tags. For now, my choice is to encode the video with the H.264/AVC codec and use AAC for audio. Ideally, I would like to add subtitles as text in SubRip’s srt-Format. All this gets wrapped up in a Matroska stream container, which holds the meta information as well.

Backup So you got a DVD with some family videos from your last birthday and you want to back up the contents on your hard drive? First thing you do, is to copy everything as is — which may take a lot of disk space (up to 8 GB). I had good results with this simple tool:

dvdcpy -s skip -m -o My_Birthday /dev/sr0

After some time, you’ll find the DVD directory structure copied in your present working directory. With Fedora this handy gem comes in the ogmrip package.

Compression Next comes the crucial part: compressing the raw data into something usable.  After trying different options, I now rely on HandBrake for this, which in turn builds on the x264 library. Handbrake saves the streams directly into a Matroska container, allows editing chapter titles and adding extra subtitles from external files.  It works very fast and comes with reasonable default options.  Usually I stick with the Regular/Normal preset, just kicking out superfluous tracks and downmixing the audio to AAC 128bit Stereo.   I let Handbrake figure out the video quality by setting the target size to 700 MB, which in most cases results in slightly degraded but more than watchable video quality around 1000 kbps.  As I’m only interested in SD video quality, I usually choose a 624px-width based resolution.  You might want to consult this detailed video conversion table.

Subtitles I would prefer to store subtitle data efficiently as text, i.e. using SubRip‘s srt format (while more advanced xml-based formats seem to lack acceptance). HandBrake does not mess with OCR (which is excusable), it extracts subtitles as bitmaps in VobSub format.  The following command from the handy MKVToolnix package extracts from the mkv container the bitmaps and sync information in two files (*.vob and *.idx):

mkvextract tracks My_Birthday.mkv 3:subtitles.vob

These subtitles need to be scanned and ocr’ed: the best way to do this is Avidemux. Simpy hit “Tools > OCR(VobSub -> SRT)” and follow the instructions – be prepared though to invest some time helping with character recognition.  Don’t forget to check the spelling in the resulting SRT file.

Re-Muxing Handbrake leaves us with a usable Matroska container, however we’d like to replace subtitles and add some additional data for archiving purposes: at least a cover image and descriptive tags. The MKVToolnix package mentioned above provides the excellent mkvmerge utility featuring a graphical interface. With mkvmerge we remove the VobSub tracks and add our new SRT file as a subtitle track. You might also want to attach a file cover.jpg to the container. It will show up as the container’s thumbnail preview in a recent file browser. Moreover, we’d like to add some descriptive tags as suggested by the Matroska specification. However, I haven’t yet been able to find any player support for this feature. Anyway, for the tag file, you may use this template. Then merge the xml file into the container with mkvmerge (under the “global” tab for global tags).

How to Convert Git Log to ChangeLog

Posted in Coding, Linux by Chris on February 18, 2010

Git Logo

This is quite a useless endeavor, of course.  Since every fork from Git contains the whole change history, GNU-style ChangeLogs are pretty obsolete.  However, if you want to distribute your source files in a traditional tarball, you might want to add a ChangeLog file – and you might want it to look like the ones in the GNU coding standard.  This is where my shell script comes in, which I wrote yesterday while doing some serious procrastination:

# Convert git log to GNU-style ChangeLog file.
# (C) Chris
if test -d ".git"; then
    git log --date-order --date=short | \
    sed -e '/^commit.*$/d' | \
    awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \
    sed -e 's/^Author: //g' | \
    sed -e 's/>Date:   \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \
    sed -e 's/^\(.*\) \(\)\t\(.*\)/\3    \1    \2/g' > ChangeLog
    exit 0
    echo "No git repository present."
    exit 1

This code goes conveniently in a Makefile template for Autotools, so you can create the ChangeLog on the fly, include it in the distribution tarball and have it unlinked afterwards. Again, there’s no need to have a ChangeLog lie around with Git.

Tagged with: , , , ,

Apple’s iPad: finally turning the Internet into TV?

Posted in Politics by Chris on February 1, 2010

What’s the impact of Apple’s new Uber-product, the iPad? There’s tons of discussion on the web, mostly focusing on the limited geek-appeal of the new device. It’s true, all these complaints tell us nothing about the still likely success of the iPad. But they show how fundamentally Apple has changed in the last decade. While Steve Jobs was still boasting his company’s reputation among creative customers on  last week’s keynote, it seems now more obvious than ever that Apple has become an appliance company targeting Joe Sixpack (and his Mom).  While Apple’s products were once bought because they seemed technically superior, they are now bought by the middle classes around the world because they are universally recognized status symbols.

Steve Jobs has essentially turned Apple into a global luxury electronics brand, much like Sony was in the 1980s.  This strategy may seem risky on first glance, since for creative elitists Apple products are more and more loosing their distinguishing appeal.  Using an Apple product is not so much saying “I’m better, I’m in” anymore, but rather “I can spend more money than you”. For Apple’s shareholders of course, this turn from underdog to market leader has very well paid out.

More remarkable are the side effects of this development.  As Jobs pointed out, Apple sees itself no longer as a cutting edge computer design house but as selling portable devices which function as internet outlets for all kinds of media stores. This means that, thanks to Apple, people don’t need to bother with a computer anymore when they want to enjoy the internet. To be sure, Apple always tried to build devices where the user could feel as without actually being a geek. Now that they are selling the iPad to the masses, we are looking at users whose everyday internet experience will mean consumption, not production.  Of course, the old powers, publishers, networks, labels will eventually embrace this concept, since it preserves a central role for the media, for the middle-man of communication.  Imagine a world where 90% of the people use their iPads to consume internet delivered media like they now use their TV sets to consume old media.  Since they are glued to their new sexy internet handsets, they won’t care about DRM or standards or whatever, they only want to read that article or watch that movie or see that picture, right now “that simple”.  What about learning the nuts and bolts of the internet, what about actually participating in a global, many-sided communication?  Forget it. The new iPad-style internet will belong to Rupert Murdoch and his media buddies. With the iPad Apple may reach the holy grail of internet monetization – with the web as collateral damage.

Tagged with: , ,

Launching OpenOffice faster

Posted in Applications by Chris on January 19, 2010

I’m not a big fan of office suite software packages and try to avoid using them where I can.  Today I learned something that eased my pain with OpenOffice: you can launch it way faster.  How?  By turning off an option which triggers  a Java Runtime Environment (!) in the background: Extras > Options > > Java.  In my opinion this option should be turned off by default, given that a majority of users won’t script Java macros on a regular basis anyway.

Tagged with:

How evil is Google really?

Posted in Google, Politics, Web by Chris on December 9, 2009

Google Logoerman journalist Christian Ströker comments on an interview with Eric Schmidt and comes to the conclusion that Google wants it all. The big program, all of it, “world domination”. He sees an evil strategy behind Google’s innovations and acquisitions to abolish our “civil concept of privacy”. This is not quite the same as the “world domination” mentioned in the headline, but whatever. Ströker’s proof: Schmidt advises us to refrain from activities we fear to become public. Google chronicles all our web journeys plus social data and links them to semi-anonymized IPs. Worse, Google tries to link these web characters to geographical locations (Google Latitude etc). Wow, that’s bad shit, Mr. Ströker.

However Google is your least problem when surfing the web. Your ISP and your mail provider know everything about you by default. Any sys admin at any ISP can read every bit, and I mean bit, of your web traffic 24/7. In Germany, the ISPs are even required by law to record your connections and log them with your full IP address for months. And of course, they are to be given out to the authorities on request – that’s why they are to be collected in the first place. Mail providers could easily read all your mails, including the ones with the user logins and passwords. No matter what mail provider you use.

And what about Schmidt’s privacy statement?  Although people don’t seem to get it: everything you do online you do in a public place. And you always did, even before 1996.  So, as far as public places go: if you don’t want other people to see something, where you don’t have much chances to hide it, than you best don’t do it, at least not in a public place.  Which brings us to Ströker’s very misconception: the internet is not and never was a private place.  The moment you log on, you’re leaving your home and go out on (a very crowded) street. There are of course tools which allow you to hide at least some things (everyone should use PGP in their private correspondence for that matter) – however, as long as some bits crawl some line it’s not that much different from walking on a public street.

Our real problem is not some alleged corporate conspiracy against privacy but political attempts to censor and govern the raw traffic at the heart of the consumer internet: the ISPs’ servers. If people want to give up their privacy to Google, that’s fine, or at least it’s their right to do so. But this agreement has only two parties: them and Google. There’s no place for governments in this. Of course, Google might decide to cooperate with law enforcement agencies against their customers. But again, this is nothing new, but something ISPs all over the world (have to) do on a daily basis. The real problem is not Google, but third party access to your web traffic on behalf of the public good. Consider the following analogy: if I decide to open all my private letters to some private corporation who promises me, say, lightning fast mailing service, then you need not like my decision, but it’s legitimate nevertheless. In fact, this is what happened when people started to use private telegraphy services in the 19th century.  It happened again when people bought internet access from private ISPs. It is a complete different matter, though, when a third party requires a copy of every letter sent over the wire. Yet, this is not a problem of the contract in itself. It’s a problem of wrong government priorities.

Tagged with: , , ,

Get every new post delivered to your Inbox.