Tag Archives: Debian

Correcting obsolete dependency requirements in DEB packages

I use the excellent XMind mind-mapping tool. Moving from Linux Mint 13 (Ubuntu 12.04 LTS) to Xubuntu 14.04 LTS revealed a problem with the way XMind was packaged for Ubuntu. It had a hard-coded dependency on specific versions of the Java runtime – either of openjdk-6-jre, oracle-java6-jre, sun-java6-jre or sun-java5-jre. That wouldn’t do. The 14.04 LTS uses openjdk-7.

Of  course, the DEB package is built to support the widest range of Java runtimes and on some systems, they can go back up to Java 5 – when Sun Microsystems was still alive. But that should not be a reason to force up-to-date systems to pull in older runtimes. We can let XMind know about the issue and wait for them to update the dependencies and rebuild the package. Or we can do it ourselves.

DEB files are compressed archives with some control information. The dpkg-deb utility makes it very easy to modify DEB files.

$ mkdir -p extract/DEBIAN
$ mkdir build
# dpkg-deb -x package.deb extract/
# dpkg-deb -e package.deb extract/DEBIAN
[...do something, e.g. edit the control file...]
# dpkg-deb -b extract build

The control file was edited as follows:

-Depends: libgtk2.0-0 (>= 2.8.0), openjdk-6-jre | oracle-java6-jre | sun-java6-jre | sun-java5-jre
+Depends: libgtk2.0-0 (>= 2.8.0), default-jre | openjdk-6-jre | oracle-java6-jre | sun-java6-jre | sun-java5-jre

Now, the package will first check for the default Java package on the system and then move on to its list of specific runtimes.

Redmine with Passenger on Nginx

Thanks to the guys at Dotdeb, we can now run Redmine using Phusion Passenger. My earlier requirements were still in force – software to be installed from a repository, upgradeable using apt-get and no compiling on the server.

To use Passenger with Nginx, the official Phusion docs recommend compiling Nginx from source. Fortunately, Nginx PPA provides this version of Nginx – nginx-passenger. I got around to checking Dotdeb; and they provided one for Debian 6 too! The installation is simple.

sudo apt-get install nginx-passenger ruby-passenger

You will need to tune it for your server, but many  guides are available on the Internet.

##
# /etc/nginx/nginx.conf
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

passenger_root           /usr/lib/phusion-passenger;
passenger_ruby           /usr/bin/ruby;
passenger_max_pool_size  2;
passenger_pool_idle_time 120;
passenger_pre_start      http://redmine.example.com/;
## site config using passenger
server {
    listen 80;
    server_name redmine.example.com;
    root /usr/share/redmine/public;
    passenger_enabled on;
}

Redmine + Thin + Nginx

Redmine, is by far, the best project management tool I have used. Earlier, I had deployed it using Apache and mod_passenger. This was on Debian 6. It was straight-forward, possible with just apt-get. Now I wanted to deploy it with Nginx, on Ubuntu 12.04.

There are two ways – use Phusion Passenger (similar to Apache’s mod_passenger) with Nginx or use an application server like Mongrel or Thin.

Phusion Passenger requires the user to recompile Nginx, since Nginx doesn’t have loadable modules.

Mongrel was the gold standard for Ruby on Rails deployment until Passenger came along. Development of Mongrel ceased in 2008. Those who still want to use application servers use Unicorn or Thin and put a reverse proxy/load balancer in front.

This is my take-away from four days (I am dumb – sue me!) of googling and reading. My requirements were clear – no compiling, no ruby gems, no installation outside of apt-get. Redmine + Thin met these criteria.

1. Get all the packages.

sudo apt-get install redmine redmine-mysql thin

2. dpkg will configure Redmine for us. We also have to configure the email delivery method. Redmine configuration is standard and well documented. We  now have to configure Thin. This will create two servers on sequential ports, beginning with 3000.

sudo thin config -C /etc/thin1.8/redmine.yml -c /usr/share/redmine/ --servers 2 -e production -a 127.0.0.1 -p 3000

3. This will create the configuration file (redmine.yml) in the correct folder. The file looks like this:

---
timeout: 30
wait: 30
max_persistent_conns: 512
log: log/thin.log
chdir: /usr/share/redmine
servers: 2
require: []

daemonize: true
pid: tmp/pids/thin.pid
address: 127.0.0.1
environment: production
max_conns: 1024
port: 3000

4. Finally, use the Redmine template for Nginx, as explained on the Nginx wiki, to act as a proxy in front of the Thin servers.

Links: