<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Phusion Corporate Blog</title>
	<atom:link href="http://blog.phusion.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.phusion.nl</link>
	<description></description>
	<lastBuildDate>Wed, 09 May 2012 18:38:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to fix the Ruby 1.9 HTTPS/Bundler segmentation fault on OS X Lion</title>
		<link>http://blog.phusion.nl/2012/05/09/how-to-fix-the-ruby-1-9-httpsbundler-segmentation-fault-on-os-x-lion/</link>
		<comments>http://blog.phusion.nl/2012/05/09/how-to-fix-the-ruby-1-9-httpsbundler-segmentation-fault-on-os-x-lion/#comments</comments>
		<pubDate>Wed, 09 May 2012 18:38:29 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1577</guid>
		<description><![CDATA[If you&#8217;ve installed a gem bundle on OS X Lion the past few weeks then you may have seen the dreaded &#8220;[BUG] Segmentation fault&#8221; error, where Ruby sees to crash in the connect C function in http.rb. Upgrading to the latest Ruby 1.9.3 version (p194) doesn&#8217;t seem to help. Luckily someone has found a solution [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve installed a gem bundle on OS X Lion the past few weeks then you may have seen the dreaded &#8220;[BUG] Segmentation fault&#8221; error, where Ruby sees to crash in the <code>connect</code> C function in <code>http.rb</code>. Upgrading to the latest Ruby 1.9.3 version (p194) doesn&#8217;t seem to help. Luckily someone has <a href="http://www.seqmedia.com/2012/05/08/frustrations-abound-rvm-vs-macports-and-the-bug-segmentation-fault/">found a solution</a> for this problem.</p>

<p>It turns out the segmentation fault is caused by an incompatibility between MacPort&#8217;s OpenSSL and RVM. MacPorts installs everything to /opt/local but RVM does not look for OpenSSL in /opt/local. We solved the problem by reinstalling Ruby 1.9.3 with the MacPorts OpenSSL, as follows:</p>

<pre><code>sudo port install libyaml
rvm reinstall ruby-1.9.3 --with-openssl-dir=/opt/local --with-opt-dir=/opt/local
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/05/09/how-to-fix-the-ruby-1-9-httpsbundler-segmentation-fault-on-os-x-lion/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A sneak preview of Phusion Passenger 3.2, part 2</title>
		<link>http://blog.phusion.nl/2012/04/25/a-sneak-preview-of-phusion-passenger-3-2-part-2/</link>
		<comments>http://blog.phusion.nl/2012/04/25/a-sneak-preview-of-phusion-passenger-3-2-part-2/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 21:23:03 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Phusion Passenger]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1558</guid>
		<description><![CDATA[Phusion Passenger is an Apache and Nginx module for deploying Ruby web applications. It has a strong focus on ease of use, stability and performance. Phusion Passenger is built on top of tried-and-true, battle-hardened Unix technologies, yet at the same time introduces innovations not found in most traditional Unix servers. In our last Phusion Passenger [...]]]></description>
			<content:encoded><![CDATA[<p><em><a href="http://www.modrails.com/">Phusion Passenger</a> is an Apache and Nginx module for deploying Ruby web applications. It has a strong focus on ease of use, stability and performance. Phusion Passenger is built on top of tried-and-true, battle-hardened Unix technologies, yet at the same time introduces innovations not found in most traditional Unix servers.</em></p>
<p>In our last Phusion Passenger <a href="http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/">sneak preview</a> article we described a number of large but exciting changes in the upcoming 3.2 series. Since then, much development progress has been made thanks to much-appreciated user feedback. A ton of bugs have been fixed and we&#8217;re almost ready to dogfood it (running it in production on our own servers). We&#8217;re already using the 3.2 pre-release code on our development workstations while developing web apps.</p>
<p>In this article I shall explain more changes that the 3.2 series brings.</p>
<h2>More zero-copy I/O</h2>
<p>In the Phusion Passenger 3.0 technology preview articles we first described the introduction of a zero-copy I/O architecture. In 3.2, this architecture has evolved a lot further. In most performance-critical places we now avoid copying data whenever we can, and we use scatter-gather I/O calls all over the place instead of traditional I/O calls.</p>
<p>What is scatter-gather I/O? Normally when you have strings from multiple memory addresses, and you want to write them over a file descriptor, you have two choices:</p>
<ol>
<li>Concatenate all strings into one big string, and send the big string to the kernel. This requires more memory and involves copying data, but only involves one call to the kernel. A kernel call tends to be much more expensive than a concatenation operation unless you&#8217;re working with a lot of data.</li>
<li>Send each string individually to the kernel. You don&#8217;t need as much memory but you need a lot of expensive kernel calls.</li>
</ol>
<p><img src="http://blog.phusion.nl/wp-content/uploads/2012/04/normalio.png" alt="Normal I/O" /></p>
<p>In a similar fashion, if you want to read some data from a file descriptor but you want different parts of the data to end up in different memory buffers, then you either have to <code>read()</code> the data into a big buffer and copy each parts to the individual buffers, or you have to <code>read()</code> each part individually into its own buffer.</p>
<p>With scatter-gather I/O you can pass <em>an array of memory buffers</em> to the kernel. This way you can tell the kernel to write multiple buffers to a file descriptor, as if they form a single contiguous buffer, but with only one kernel call. Similarly you can tell the kernel to put different parts of the read data into different buffers. On Unix systems this is done through the readv and <a href="http://pubs.opengroup.org/onlinepubs/009604499/functions/writev.html">writev()</a> system calls. In Phusion Passenger 3.2 we use the latter system call extensively.</p>
<p>Unfortunately <code>writev()</code> has many quirks. Typical implementations cannot handle more than <code>IOVEC_MAX</code> buffers per call where <code>IOVEC_MAX</code> is a constant with an arbitrary number. On some implementations the call will fail if the limit is surpassed, but on Linux/glibc it will quietly concatenate everything into a big buffer for you! Neither are desirable properties in Phusion Passenger, but we at Phusion care about stability so we <a href="https://github.com/FooBarWidget/passenger/blob/feaecc354d3d7b7e233fc1cf85e56c6237fa224d/ext/common/Utils/IOUtils.h#L421-449">have written extensive code to take care of this issue</a>.</p>
<h2>Environment variable passing</h2>
<p>Properly <a href="http://blog.phusion.nl/2008/12/16/passing-environment-variables-to-ruby-from-phusion-passenger/">passing environment variables in Phusion Passenger 3</a> for Apache is quite a pain. People expect SetEnv to just work, but in practice it doesn&#8217;t because of various implementation details in Phusion Passenger. To pass things like LD_LIBRARY_PATH you had to write a wrapper script. Passing PATH works but only if you&#8217;re not expecting it to affect the search path for the Ruby interpreter itself.</p>
<p>In 3.2 we fully support passing environment variables with SetEnv, and it works as expected. This is actually a side effect of supporting multiple Ruby versions, but it works out rather nicely.</p>
<h2>Less memory usage</h2>
<p>Phusion Passenger has always been lightweight when it comes to memory usage, but in 3.2 we&#8217;ve reduced it even further. More parts have been moved from Ruby into C++. The Ruby component now only load code that&#8217;s absolutely necessary. The result is massive memory savings:</p>
<ul>
<li>When using the <strong>smart</strong> spawn method, the Preloader process (formerly called the ApplicationSpawner process) now uses <strong>300 KB less memory</strong>.</li>
<li>When using the <strong>direct</strong> spawn method (the new name for the <strong>conservative</strong> spawn method), the request handler now uses <strong>500 KB less memory</strong> per application worker process.</li>
<li>The Ruby stack, as is reachable at the Rack application object&#8217;s starting point, has been reduced from about 10 levels to only 2 levels. This results in at least 8 KB of reduced stack size. If your application is multithreaded and you&#8217;re still on Ruby 1.8 then you should see faster thread context switching performance.</li>
</ul>
<p>Memory measurements are done on OS X Lion. Your mileage may vary.</p>
<h2>Release date</h2>
<p>So people have been asking us when 3.2 will be released. We want to make sure that the 3.2 release is a rock-solid one, as we always do with our products. But we need your help. Please <a href="https://github.com/FooBarWidget/passenger/tree/experimental">download the 3.2 pre-release code from Github</a> and play with it and report any bugs you find. Or better yet: send us a patch. <img src='http://blog.phusion.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s getting more and more stable by the day but you can make the process even faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/25/a-sneak-preview-of-phusion-passenger-3-2-part-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tutorial: setting up Gitlab on Debian 6</title>
		<link>http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/</link>
		<comments>http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 14:24:29 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1521</guid>
		<description><![CDATA[We host many git repositories on our servers using SSH and file system ACLs for access control. However, having been spoiled by Github for so long, this method feels archaic and cumbersome. While Github provides private repositories, sometimes it&#8217;s just not an option because there are some things that may never leave the organization. If [...]]]></description>
			<content:encoded><![CDATA[<p>We host many git repositories on our servers using SSH and file system ACLs for access control. However, having been spoiled by Github for so long, this method feels archaic and cumbersome. While Github provides private repositories, sometimes it&#8217;s just not an option because there are some things that may never leave the organization. If you still want to have a fancy web interface for your Git repositories, then there are several alternatives:</p>
<ul>
<li>Use <a href="https://enterprise.github.com/">Github Enterprise</a>.</li>
<li>Use <a href="http://gitorious.org/">Gitorious</a>.</li>
<li>Use <a href="http://gitlabhq.com/">Gitlab</a>.</li>
</ul>
<p>Gitlab is an excellent option. It&#8217;s not as fully featured as Github, but like Gitorious it is open source. We&#8217;ve found that it&#8217;s not only more user friendly than Gitorious but also easier to install.</p>
<p><img class="exhibit" src="http://gitlabhq.com/ns_small.png" /></p>
<p>This tutorial teaches you how to setup Gitlab on Debian 6, Ruby 1.9.3, Phusion Passenger and Nginx. It assumes that Gitlab and the git repositories are hosted on the same machine. Your Gitlab installation will be protected by SSL. Your users will be able to pull from and push to your repositories using the <code>ssh://</code> protocol, but they won&#8217;t have actual shell access and you don&#8217;t need to have separate system accounts for each user to control access. Gitlab (or to be more correct, gitolite, which Gitlab uses) manages access without system accounts.</p>
<h2>Step 1: Setup sudo</h2>
<p>In this tutorial we&#8217;re going to use sudo to switch between user accounts. Sudo is not installed by default on Debian so install it if you don&#8217;t already have it:</p>
<pre><code>$ su
# apt-get update
# apt-get install sudo
</code></pre>
<p>Now add your own account to /etc/sudoers:</p>
<pre><code># visudo
</code></pre>
<p>Add something like this to the end of the file:</p>
<pre><code>your_username_here   ALL=(ALL) ALL
</code></pre>
<h2>Step 2: Install the base software</h2>
<p>Install basic dependencies:</p>
<pre><code>$ sudo apt-get update
$ sudo apt-get install build-essential git-core wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server python-dev python-pip libyaml-dev
</code></pre>
<p>Install Pygments, which Gitlab needs for syntax highlighting:</p>
<pre><code>$ sudo pip install pygments
</code></pre>
<p>Gitlab needs the <code>sendmail</code> command in order to send emails (for things like lost password recovery). This command is provided by the <code>exim4</code>, <code>postfix</code> and <code>sendmail</code> packages but you can only have one of them installed. If you don&#8217;t already have one of them installed, then we recommend postfix.</p>
<p>First, check whether you already have the <code>sendmail</code> command:</p>
<pre><code>$ ls /usr/sbin/sendmail
</code></pre>
<p>If you get a &#8216;file not found&#8217; then install Postfix:</p>
<pre><code>$ sudo apt-get install postfix
</code></pre>
<h2>Step 3: Install gitolite</h2>
<p>We need gitolite. Gitolite is a tool used by Gitlab for managing access control to git repositories. It works by providing a bunch of config files in which you can register users and their public keys. Gitolite modifies <code>~/.ssh/authorized_keys</code> appropriately based on the config files&#8217; contents. Gitolite is not supposed to run as root; instead, it runs as a single user.</p>
<p>Install gitolite:</p>
<pre><code>$ sudo apt-get install gitolite
</code></pre>
<p>The Debian package will automatically create an account called <code>gitolite</code>. Gitlab controls gitolite by logging into gitolite&#8217;s user account through SSH, so we want to create a passwordless SSH keypair for this. This SSH keypair is what we call the <em>gitolite admin key</em>.</p>
<pre><code>$ sudo -u gitolite ssh-keygen
...
Enter file in which to save the key (/var/lib/gitolite/.ssh/id_rsa):    &lt;--- enter nothing here and press enter
...
Enter passphrase (empty for no passphrase):    &lt;--- enter nothing here and press enter
Enter same passphrase again:                   &lt;--  enter nothing here and press enter
...
Your public key has been saved in /var/lib/gitolite/.ssh/id_rsa.pub.
...
</code></pre>
<p>Now you need to tell gitolite that you want to use this key as the admin key. First, let&#8217;s print the content of the public key and copy it to the clipboard:</p>
<pre><code>$ sudo -u gitolite cat /var/lib/gitolite/.ssh/id_rsa.pub
(now select the output in your terminal and copy it to the clipboard)
</code></pre>
<p>Now let&#8217;s configure gitolite:</p>
<pre><code>$ sudo dpkg-reconfigure gitolite
</code></pre>
<p>When asked for a username, keep it at the default:<br />
<img src="http://blog.phusion.nl/wp-content/uploads/2012/04/gitolite1.png" /></p>
<p>When asked for a repository path, keep it at the default:<br />
<img src="http://blog.phusion.nl/wp-content/uploads/2012/04/gitolite2.png" /></p>
<p>When asked for the admin key, paste the contents of the key you copied to clipboard:<br />
<img src="http://blog.phusion.nl/wp-content/uploads/2012/04/gitolite3.png" /></p>
<p>Finally, we need to set the REPO_MASK option to 0007.</p>
<pre><code>$ sudo -u gitolite vi /var/lib/gitolite/.gitolite.rc
</code></pre>
<p>Look for:</p>
<pre><code>$REPO_UMASK = 0077;         # gets you 'rwx------'
</code></pre>
<p>Change it to:</p>
<pre><code>$REPO_UMASK = 0007;  # rwxrwx---
</code></pre>
<h3>Tighten security</h3>
<p>We think the default gitolite home directory security is a bit weak: everybody on the system can access the config files and the repository files.</p>
<pre><code>$ ls -ld /var/lib/gitolite
drwxr-xr-x 5 gitolite gitolite 4096 Apr 21 08:40 /var/lib/gitolite
</code></pre>
<p>Let&#8217;s tighten it up a little bit so that only gitolite can access the files:</p>
<pre><code>$ sudo -u gitolite chmod o-rx /var/lib/gitolite
</code></pre>
<h2>Step 4: Install Ruby 1.9</h2>
<p>Gitlab requires Ruby 1.9 and their developers recommend Ruby 1.9.2, but we don&#8217;t recommend 1.9.2 because it has a lot of critical bugs compared to 1.9.3. We&#8217;ve been running Gitlab in production on Ruby 1.9.3 for a while now and so far everything works great, so in this tutorial we&#8217;ll teach you how to install Ruby 1.9.3. But feel free to install a different version if you disagree with us.</p>
<p>Debian does not provide a recent enough version of Ruby through apt, so we need to install it manually.</p>
<pre><code>$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
$ tar xzvf ruby-1.9.3-p194.tar.gz
$ cd ruby-1.9.3-p194
$ ./configure
$ make
$ sudo make install
</code></pre>
<p>Install Bundler:</p>
<pre><code>$ sudo gem install bundler
</code></pre>
<h2>Step 5: Install Gitlab</h2>
<h3>Download the source</h3>
<pre><code>$ cd /opt
$ sudo git clone git://github.com/gitlabhq/gitlabhq.git
$ sudo chown -R gitolite:gitolite gitlabhq
$ cd gitlabhq
$ sudo -u gitolite git checkout 9af14e4bda35
</code></pre>
<p>(You can also checkout the <code>stable</code> branch for the latest stable version, but this tutorial is written specifically for commit 9af14e4bda35.)</p>
<h3>Configure</h3>
<p>Setup the database configuration. Make sure you fill in the database details under the <code>production</code> section.</p>
<pre><code>$ sudo -u gitolite cp config/database.yml.example config/database.yml
$ sudo -u gitolite vi config/database.yml
</code></pre>
<p>Setup other Gitlab configuration.</p>
<pre><code>$ sudo -u gitolite cp config/gitlab.yml.example config/gitlab.yml
$ sudo -u gitolite vi config/gitlab.yml
</code></pre>
<ul>
<li>Set <code>email.from</code> to what should be filled in the &#8216;From&#8217; header in emails.</li>
<li>Set <code>email.to</code> to the domain name on which you want to host Gitlab, without the protocol scheme and without the path.</li>
<li>Set <code>email.protocol</code> to <code>https</code>.</li>
<li>Set <code>git_host.admin_uri</code> to <code>gitolite@localhost:gitolite-admin</code>.</li>
<li>Set <code>git_host.base_path</code> to <code>/var/lib/gitolite/repositories/</code>.</li>
<li>Set <code>git_host.host</code> to the system&#8217;s SSH domain name.</li>
<li>Set <code>git_host.git_user</code> to <code>gitolite</code>.</li>
</ul>
<p>Now tighten up security:</p>
<pre><code>$ sudo -u gitolite chmod o-rwx config/*.yml
</code></pre>
<h3>Install gems and setup database</h3>
<pre><code>$ sudo -u gitolite -H bundle install --without development test --deployment
$ sudo -u gitolite bundle exec rake db:setup RAILS_ENV=production
$ sudo -u gitolite bundle exec rake db:seed_fu RAILS_ENV=production
</code></pre>
<p>This last command will output an initial administrator account&#8217;s username and password. Write it down somewhere.</p>
<h3>Check status</h3>
<pre><code>$ sudo -u gitolite bundle exec rake gitlab:app:status RAILS_ENV=production
</code></pre>
<p>You should get all YES:</p>
<pre><code>Starting diagnostic
config/database.yml............exists
config/gitlab.yml............exists
/home/git/repositories/............exists
/home/git/repositories/ is writable?............YES
remote: Counting objects: 603, done.
remote: Compressing objects: 100% (466/466), done.
remote: Total 603 (delta 174), reused 0 (delta 0)
Receiving objects: 100% (603/603), 53.29 KiB, done.
Resolving deltas: 100% (174/174), done.
Can clone gitolite-admin?............YES
UMASK for .gitolite.rc is 0007? ............YES
</code></pre>
<h3>Run a Resque worker</h3>
<p>This worker daemon is for processing background tasks.</p>
<pre><code>$ sudo -u gitolite bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes
</code></pre>
<h2>Step 6: Generate an SSL certificate</h2>
<p>Generate a self-signed certificate. You may enter arbitrary certificate information but the Common Name must be set to the domain name on which you want to host Gitlab.</p>
<pre><code>$ cd /opt/nginx/conf
$ sudo openssl req -new -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
$ sudo chmod o-r gitlab.key
</code></pre>
<h3>Installing the certificate into your browser</h3>
<p>This self-signed certificate by itself provides encryption, but not authentication, making it vulnerable to man-in-the-middle attacks. To solve this problem, install this certificate into your browser.</p>
<p>Here&#8217;s how you do it on Google Chrome on OS X. First, copy the certificate to your local machine:</p>
<pre><code>$ scp your-server.com:/opt/nginx/conf/gitlab.crt .
</code></pre>
<p>Now open Keychain Access. Under the &#8220;Keychains&#8221; list, select &#8220;System&#8221;. Then click on the &#8220;+&#8221; button and add the certificate file.</p>
<p><a href="http://blog.phusion.nl/wp-content/uploads/2012/04/keychain.jpg"><img src="http://blog.phusion.nl/wp-content/uploads/2012/04/keychain-small.jpg" /></a></p>
<h2>Step 7: Deploy to Phusion Passenger and Nginx</h2>
<p>Install Nginx and Phusion Passenger:</p>
<pre><code>$ sudo gem install passenger --no-rdoc --no-ri
$ sudo passenger-install-nginx-module
(Choose option 1 and install Nginx to /opt/nginx)
</code></pre>
<p>Now edit the Nginx config file</p>
<pre><code>$ sudo vi /opt/nginx/conf/nginx.conf
</code></pre>
<p>and add this to the <code>http</code> block:</p>
<pre><code># This is a normal HTTP host which redirects all traffic to the HTTPS host.
server {
    listen 80;
    server_name gitlab.yourdomain.com;
    root /nowhere;
    rewrite ^ https://gitlab.phusion.nl$request_uri permanent;
}

# The actual Gitlab HTTPS host.
server {
    listen 443;
    server_name gitlab.yourdomain.com;
    root /opt/gitlabhq/public;
    ssl on;
    ssl_certificate gitlab.crt;
    ssl_certificate_key gitlab.key;
    add_header Strict-Transport-Security "max-age=315360000";
    location / {
        passenger_enabled on;
    }
    location /assets {
        expires max;
        add_header Cache-Control public;
        passenger_enabled on;
    }
}
</code></pre>
<p>Now start Nginx:</p>
<pre><code>$ sudo /opt/nginx/sbin/nginx
</code></pre>
<p>And viola, you&#8217;re up and running! You can access Gitlab through https://gitlab.yourdomain.com/.</p>
<h3>Already have Phusion Passenger installed and already running Ruby 1.8?</h3>
<p>Phusion Passenger for Nginx does not yet support multiple Ruby versions (but it will in 3.2). If you already have Ruby apps deployed on your server using Phusion Passenger, and those apps require Ruby 1.8, then you&#8217;ll have to run Gitlab on Ruby 1.9 using Phusion Passenger Standalone, and connect it to Nginx through a reverse proxy setup.</p>
<pre><code>$ cd /opt/gitlabhq
$ sudo -u gitolite passenger start -d -e production --max-pool-size 2 -S gitlab.socket
</code></pre>
<p>The HTTPS server block should then look like this:</p>
<pre><code>upstream gitlab {
    server unix:/opt/gitlabhq/gitlab.socket;
}

# The actual Gitlab HTTPS host.
server {
    listen 443;
    server_name gitlab.yourdomain.com;
    root /opt/gitlabhq/public;
    ssl on;
    ssl_certificate gitlab.crt;
    ssl_certificate_key gitlab.key;
    add_header Strict-Transport-Security "max-age=315360000";
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Ssl on;
    location / {
        if (!-f $request_filename) {
            proxy_pass http://gitlab;
            break;
        }
    }
    location /assets {
        expires max;
        add_header Cache-Control public;
        if (!-f $request_filename) {
            proxy_pass http://gitlab;
            break;
        }
    }
}
</code></pre>
<h2>Donate</h2>
<p>Gitlab started a <a href="http://blog.gitlabhq.com/weve-started-donation-campaign">donation campaign</a> a few weeks ago. It is excellent, high-quality open source software so if you like it, consider giving them a donation to support their development.</p>
<p><a href="http://www.pledgie.com/campaigns/17027"><img src="http://www.pledgie.com/campaigns/17027.png?skin_name=chrome" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>New Phusion Passenger documentation pages</title>
		<link>http://blog.phusion.nl/2012/04/15/new-phusion-passenger-documentation-pages/</link>
		<comments>http://blog.phusion.nl/2012/04/15/new-phusion-passenger-documentation-pages/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 11:58:54 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Phusion Passenger]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1509</guid>
		<description><![CDATA[The Phusion Passenger documentation is written with the excellent Asciidoc tool, which Git also uses for its manual pages. The output looks good but it&#8217;s nothing too fancy. There were a few features that we&#8217;ve wanted for a while but aren&#8217;t available in Asciidoc. We&#8217;ve written a wrapper tool around Asciidoc called Mizuho, which provides [...]]]></description>
			<content:encoded><![CDATA[<p>The Phusion Passenger <a href="http://www.modrails.com/documentation.html">documentation</a> is written with the excellent <a href="http://www.methods.co.nz/asciidoc/">Asciidoc</a> tool, which Git also uses for its manual pages. The output looks good but it&#8217;s nothing too fancy. There were a few features that we&#8217;ve wanted for a while but aren&#8217;t available in Asciidoc. We&#8217;ve written a wrapper tool around Asciidoc called <a href="https://github.com/FooBarWidget/mizuho">Mizuho</a>, which provides these features.</p>
<p>Today, we present you with the new Phusion Passenger documentation pages.</p>
<h2>Top bar with useful shortcuts</h2>
<p><img src="http://blog.phusion.nl/wp-content/uploads/2012/04/topbar.png" alt="enter image description here" /></p>
<p>The new documentation has a top bar which gives you quick access to the table of contents. It also tells you where in the documentation you are. Scroll down in the documentation, you&#8217;ll see the top bar&#8217;s title updating itself accordingly.</p>
<h2>Per-section comments</h2>
<p><img src="http://blog.phusion.nl/wp-content/uploads/2012/04/balloon.png" alt="enter image description here" /></p>
<p>You can now comment on a section by clicking on the bubble on the left of a section title. Comments are powered by <a href="https://github.com/phusion/juvia">Juvia</a>.</p>
<h2>The documentation</h2>
<ul>
<li><a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html">Apache version</a></li>
<li><a href="http://www.modrails.com/documentation/Users%20guide%20Nginx.html">Nginx version</a></li>
<li><a href="http://www.modrails.com/documentation/Users%20guide%20Standalone.html">Standalone version</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/15/new-phusion-passenger-documentation-pages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t be perfectionist: big code dumps suck</title>
		<link>http://blog.phusion.nl/2012/04/13/dont-be-perfectionist-big-code-dumps-suck/</link>
		<comments>http://blog.phusion.nl/2012/04/13/dont-be-perfectionist-big-code-dumps-suck/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 21:44:43 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1490</guid>
		<description><![CDATA[We&#8217;ve been developing Phusion Passenger 3.2 on local repositories for a while now. We didn&#8217;t want to show the changes to the world until we know that it&#8217;s at least somewhat ready for public consumption. For a long time 3.2 didn&#8217;t even fully compile. The end results speak for themselves: Phusion Passenger 3.2 introduces quite [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://twitter.com/#!/drnic/status/190864896768999425"><img src="http://blog.phusion.nl/wp-content/uploads/2012/04/drnic.jpg" alt="description" /></a></p>
<p>We&#8217;ve been developing Phusion Passenger 3.2 on local repositories for a while now. We didn&#8217;t want to show the changes to the world until we know that it&#8217;s at least somewhat ready for public consumption. For a long time 3.2 didn&#8217;t even fully compile. The end results speak for themselves: Phusion Passenger 3.2 introduces <a href="http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/">quite a large number of changes</a>. And yet there&#8217;s something that does not feel quite right here. Not only was there a large time gap between 3.0 and 3.2, we also feel that we haven&#8217;t properly communicated our development progress to the public, which could possibly have resulted in the perception that development was slow.</p>
<p>We have been too perfectionist. Dr Nic was right in booing our development method.</p>
<p>From an open source perspective as well, development behind closed doors is not the way to go. We plan on publishing changes in a more gradual manner in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/13/dont-be-perfectionist-big-code-dumps-suck/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A sneak preview of Phusion Passenger 3.2</title>
		<link>http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/</link>
		<comments>http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 15:59:14 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Phusion Passenger]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1474</guid>
		<description><![CDATA[We&#8217;ve been working on Phusion Passenger 3.2 on local repositories for a while now. Today we just pushed this code to Github. You can find it in the experimental branch. Despite the relatively minor version bump, Phusion Passenger 3.2 has actually received a major internal overhaul. This is because our version number growth rate is [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been working on <a href="http://www.modrails.com">Phusion Passenger</a> 3.2 on local repositories for a while now. Today we just pushed this code to Github. You can find it in the <a href="https://github.com/FooBarWidget/passenger/tree/experimental">experimental</a> branch. Despite the relatively minor version bump, Phusion Passenger 3.2 has actually received a major internal overhaul. This is because our version number growth rate is based on the quantity of <strong>user-visible improvements</strong>, not internal (technical) improvements.</p>
<h2>Rewritten ApplicationPool</h2>
<p>One of the central subsystems in Phusion Passenger is the <a href="https://github.com/FooBarWidget/passenger/blob/31d1b6eba8be33f9e8ca6f1dc750e05640178856/ext/common/ApplicationPool/Interface.h">ApplicationPool</a>, which spawns Ruby application processes when necessary and keeps track of them. It scales the number of processes according to the current traffic and it ensures that the number of processes do not go over your defined resource limits. It&#8217;s one of the most <a href="https://github.com/FooBarWidget/passenger/blob/d94c6c71444b90d4bee5e1016f110a2a24e977af/doc/ApplicationPool%20algorithm.txt">complex</a> parts of Phusion Passenger and consists of a lot of carefully written code. The ApplicationPool also goes through a <strong>huge</strong> amount of effort to ensuring that the user is appropriately notified in the event of problems. One of the nerving things about FastCGI (what a lot of people used before Mongrel and Phusion Passenger were introduced) was that when something goes wrong, you often have absolutely no idea why. There is no error report. Or sometimes it prints an error report to a log file, but users often have no idea where that log file is or even realize that they have to look in the log file in the first place. In contrast, Phusion Passenger displays this beautiful error message page which tells you all the details of the problem, right there in the browser. And because Phusion Passenger is heavily multithreaded, ApplicationPool was designed to be thread-safe. However, our initial implementation (during the 1.x and 2.x days) was not concurrent enough: the ApplicationPool&#8217;s mutex was locked while an application process is being spawned. This meant that Phusion Passenger is essentially frozen whenever an application process is being spawned; it will be unable to serve any requests during this time. You can&#8217;t even run passenger-status while this is happening. Phusion Passenger 3.x partially solves this issue by spawning all processes in the background, except for the first one. Another problem is that if an application behaves badly and freezes during startup, then Phusion Passenger also stays frozen. The ApplicationPool subsystem in 3.0 is partially written in C++, partially in Ruby. However we&#8217;ve found that Ruby is not a good language for system software such as Phusion Passenger. Although we love Ruby and still think Ruby is great for lots of things (web apps, sysadmin software, etc) we realized that it&#8217;s better to move that part to C++ instead. And we did: in Phusion Passenger 3.2, we&#8217;ve rewritten the entire ApplicationPool subsystem in C++. The new subsystem is much more concurrent and more fault-tolerant. It no longer holds the lock for an extended period of time and never freezes, ever. It enforces a <strong>spawn timeout</strong> on all processes: if they fail to spawn within 60 seconds then they will be killed. The new code is also much easier to understand and to maintain. This opens the road towards many potential future enhancements. 3.2 also supports multiple Ruby versions at the same time, something which many people have been waiting for.</p>
<h2>Request/response I/O handling is now evented</h2>
<p>Phusion Passenger &lt;= 3.0 uses a static number of threads to handle request/response I/O. This severely limits the amount of concurrent I/O that we can handle. in 3.2, our request/response I/O handling subsystem has been rewritten to be single-threaded and evented. We use the excellent <a href="http://software.schmorp.de/pkg/libev.html">libev</a> and <a href="http://software.schmorp.de/pkg/libeio.html">libeio</a> libraries by Marc Lehmann. This evented I/O subsystem allows us to handle a virtually unlimited amount of I/O requests concurrently and also solves some pathological edge case I/O problems that Phusion Passenger currently suffers from. It also opens the road towards future support for WebSockets, long polling and other mechanisms which require a connection socket to stay open for a potentially long time. One of the best features in the new I/O handler is <strong>real-time disk-buffered response forwarding</strong>. Traditionally, the web server would buffer the entire response before sending it to the client. This is necessary because you don&#8217;t want slow HTTP clients to block the application. However it also means that it&#8217;s not possible to flush partial response data to the client immediately (e.g. Rails 3.2 streaming), at least not without risking slow clients blocking the application. In Phusion Passenger 3.2, if the client is slow then we buffer the response data in memory, or to disk if the data is larger than a certain threshold. In contrast to most web servers we do not wait until the entire response has finished before forwarding the data; we do it immediately! You don&#8217;t need to turn this on, it&#8217;s enabled by default. Now application developers need never worry about response buffering anymore, it Just Works(tm) and does the right thing.</p>
<h2>Improved WSGI support</h2>
<p>It&#8217;s not a well-known fact because we&#8217;ve never made a fuss about it, but Phusion Passenger actually supports Python WSGI as well, and has done this since the 1.x days. Here&#8217;s a <a href="https://github.com/kwe/passenger-django-wsgi-example">demonstration of Django running on Phusion Passenger</a> and a <a href="https://github.com/galdomedia/passenger-pylons-wsgi-example">demonstration of Pylons running on Phusion Passenger</a>. Our WSGI support worked, but wasn&#8217;t particularly good. For example if the application fails to spawn then we do not display an error message in the browser. But we do now, so WSGI is now unofficially supported as a first-class citizen. Python processes are managed just like Ruby processes; all the resource limits, response buffering, etc. work exactly in the same way.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Phusion Passenger 3.0.12 released</title>
		<link>http://blog.phusion.nl/2012/04/13/phusion-passenger-3-0-12-released/</link>
		<comments>http://blog.phusion.nl/2012/04/13/phusion-passenger-3-0-12-released/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 08:42:51 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Phusion Passenger]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1465</guid>
		<description><![CDATA[Phusion Passenger is an Apache and Nginx module for deploying Ruby web applications. It has a strong focus on ease of use, stability and performance. Phusion Passenger is built on top of tried-and-true, battle-hardened Unix technologies, yet at the same time introduces innovations not found in most traditional Unix servers. Since version 3.0 it can [...]]]></description>
			<content:encoded><![CDATA[<p><em><a href="http://www.modrails.com/">Phusion Passenger</a> is an Apache and Nginx module for deploying Ruby web applications. It has a strong focus on ease of use, stability and performance. Phusion Passenger is built on top of tried-and-true, battle-hardened Unix technologies, yet at the same time introduces innovations not found in most traditional Unix servers. Since version 3.0 it can also run standalone without an external web server, making it not only easier for first-time users but also ideal on development environments.</em></p>
<h2>Recent changes</h2>
<p>Phusion Passenger is under constant maintenance and development. We are pleased to announce Phusion Passenger version 3.0.12. This is a bug fix release.</p>
<dl>
<dt>[Apache] Support Apache 2.4. The event MPM is now also supported.</dt>
<dt>[Nginx] Preferred Nginx version upgraded to 1.0.15.</dt>
<dt>[Nginx] Preferred PCRE version upgraded to 8.30.</dt>
<dt>[Nginx] Fixed compatibility with Nginx &lt; 1.0.10.</dt>
<dt>[Nginx] Nginx is now installed with http_gzip_static_module by default.</dt>
<dt>[Nginx] Fixed a memory disclosure security problem.</dt>
<dd>The issue is documented at <a href="http://www.nginx.org/en/security_advisories.html">http://www.nginx.org/en/security_advisories.html</a> and affects more modules than just Phusion Passenger. Users are advised to upgrade as soon as possible. Patch submitted by Gregory Potamianos.</dd>
<dt>[Nginx] passenger_show_version_in_header now hides the Phusion Passenger version number from the &#8216;Server:&#8217; header too.</dt>
<dd>Patch submitted by Gregory Potamianos.</dd>
<dt>Fixed a /proc deprecation warning on Linux kernel &gt;= 3.0.</dt>
</dl>
<h2>How do I upgrade to 3.0.12?</h2>
<h3>Via a gem</h3>
<p>First install the gem with the following command:</p>
<pre>gem install passenger</pre>
<p>If you&#8217;re using Phusion Passenger for Apache or for Nginx, then re-run the Apache or Nginx module installer, whichever is appropriate:</p>
<pre>passenger-install-apache2-module
passenger-install-nginx-module</pre>
<p>At the end the installer will tell you to paste a configuration snippet into your web server config file. Replace the old snippet that you already had with this new one.</p>
<p>Phusion Passenger Standalone users don&#8217;t need to run anything else. Whenever you type</p>
<pre>passenger start</pre>
<p>it will automatically upgrade itself.</p>
<h3>Via Ubuntu packages</h3>
<p>John Leach from <a href="http://www.brightbox.co.uk/">Brightbox</a> has kindly provided Ubuntu packages for Phusion Passenger. You can find <a href="http://wiki.brightbox.co.uk/docs:phusion-passenger">installation instructions</a> on the Brightbox website.<br />
(Note that John is currently packaging 3.0.12, so it might take a while before this release shows up in the apt repository.)</p>
<h3>Via RedHat/CentOS packages</h3>
<p>YUM repositories with RPMs are maintained by <a href="https://github.com/erikogan/passenger">Erik Ogan</a> and <a href="http://stealthymonkeys.com/">Stealthy Monkeys Consulting</a>. Please note that Erik is currently packaging 3.0.12, so it might take a while before this release shows up in the yum repositories.</p>
<h4>Step 1: install the release package</h4>
<p>The easiest way to install Phusion Passenger and keep it up to date is to install the passenger-release package from the <a href="http://passenger.stealthymonkeys.com/">main repository</a>:</p>
<p>Fedora Core 15:</p>
<pre>yum install http://passenger.stealthymonkeys.com/fedora/15/passenger-release.noarch.rpm</pre>
<p>Fedora Core 14:</p>
<pre>yum install http://passenger.stealthymonkeys.com/fedora/14/passenger-release.noarch.rpm</pre>
<p>RHEL 5 / CentOS 5 / ScientificLinux 5:<br />
(Note: these packages depend on <a href="http://fedoraproject.org/wiki/EPEL">EPEL</a>.)</p>
<pre>rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm</pre>
<p>RHEL 6 / CentOS 6 / ScientificLinux 6:</p>
<pre>yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm</pre>
<h4>Step 2: use Yum</h4>
<p>From there you can use <a href="http://prefetch.net/articles/yum.html">Yum</a> to install packages. For example, try one of these:</p>
<pre>yum install nginx-passenger</pre>
<p><strong>or</strong></p>
<pre>yum install mod_passenger</pre>
<p><strong>or</strong></p>
<pre>yum install passenger-standalone</pre>
<h4>Building your own packages</h4>
<p>There are instructions for building your own packages and Yum repositories in the <a href="https://github.com/FooBarWidget/passenger/tree/master/rpm#readme">rpm directory ReadMe</a> within the <a href="https://github.com/FooBarWidget/passenger">GitHub repository</a>.</p>
<h2>Final</h2>
<p>Phusion Passenger is provided to the community for free. If you like Phusion Passenger, please consider sending us a <a href="http://www.modrails.com/enterprise.html">donation</a>. Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/04/13/phusion-passenger-3-0-12-released/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Ruby Enterprise Edition 1.8.7-2012.02 released; End of Life imminent</title>
		<link>http://blog.phusion.nl/2012/02/21/ruby-enterprise-edition-1-8-7-2012-02-released-end-of-life-imminent/</link>
		<comments>http://blog.phusion.nl/2012/02/21/ruby-enterprise-edition-1-8-7-2012-02-released-end-of-life-imminent/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 16:55:00 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Ruby Enterprise Edition]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1458</guid>
		<description><![CDATA[What is Ruby Enterprise Edition? Ruby Enterprise Edition (REE) is a server-oriented distribution of the official Ruby interpreter, and includes various additional enhancements, such as: A &#8220;copy-on-write friendly&#8221; garbage collector, capable of reducing Ruby on Rails applications&#8217; memory usage by 33% on average. The tcmalloc memory allocator, which lowers overall memory usage and boosts memory [...]]]></description>
			<content:encoded><![CDATA[<h2>What is Ruby Enterprise Edition?</h2>
<p><a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> (REE) is a server-oriented distribution of the official Ruby interpreter, and includes various additional enhancements, such as:</p>
<ul>
<li>A &#8220;copy-on-write friendly&#8221; garbage collector, capable of <a href="http://www.rubyenterpriseedition.com/comparisons.html#overall_conclusion">reducing Ruby on Rails applications&#8217; memory usage by 33%</a> on average.</li>
<li>The <a href="http://code.google.com/p/google-perftools/">tcmalloc</a> memory allocator, which lowers overall memory usage and boosts memory allocation speed.</li>
<li>The ability to <a href="http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning">performance tune</a> the garbage collector.</li>
<li>The <a href="http://sites.google.com/site/brentsrubypatches">MBARI patch set</a>, for improved garbage collection efficiency.</li>
<li>Various analysis and debugging features.</li>
</ul>
<p>REE can be easily installed in parallel to your existing Ruby interpreter, allowing you switch to REE with minimal hassle or risk. REE has been out for several years now and is already used by many high-profile websites and organizations, such as <b>New York Times, Twitter, Shopify and 37signals</b>.</p>
<p>Ruby Enterprise Edition is 100% open source.</p>
<h2>Changes</h2>
<p>Ruby Enterprise Edition 2011.12 and 2012.01 have actually also been quietly released, but they didn&#8217;t have proper announcements on our blog. Here&#8217;s a cumulative summary:</p>
<dl>
<dt>Upgraded to Ruby 1.8.7-p358</dt>
<dd>REE 2011.01 was based on 1.8.7-p330. This latest version includes not only bug fixes but also various security fixes.</dd>
<dt>Upgraded to RubyGems 1.8.15</dt>
<dd>The previous REE release included RubyGems 1.5.2.</p>
<p>For a long time we&#8217;ve been reluctant to upgrade RubyGems past 1.5 because many libraries were incompatible with RubyGems &gt; 1.5. But today, the situation has been reversed: many gemspecs in the RubyGems.org repository are incompatible with RubyGems &lt; 1.8. As such, we&#8217;ve upgraded RubyGems to the latest version.</dd>
<dt>Upgraded to the MBARI 8 patch set</dt>
<dd>Brent Roman has <a href="https://sites.google.com/site/brentsrubypatches/">released</a> a new version of his MBARI patch set, which solves many mysterious stability problems that plagued previous versions. This REE release should be significantly more stable.</dd>
<dt>Compatible with Xcode &gt;= 4 and OS X Lion</dt>
<dd>The REE installer now properly advises Xcode &gt;= 4 users and OS X Lion users on how to install the proper compiler that&#8217;s necessary for installing REE.</dd>
<dt>Experimental zero-copy context switch patch removed</dt>
<dd>This experimental patch set was never production-ready, so as of this release it has been removed.</dd>
</dl>
<h2>End of Life</h2>
<p>Support for Ruby 1.8.x is slowly being dropped by the upstream Ruby core developers in favor of Ruby 1.9 and beyond. The Rails team has recently announced that they will be dropping Ruby 1.8 support in Rails 4. As such, we are also slowly End-of-Life&#8217;ing Ruby Enterprise Edition.</p>
<p>We have no plans to create a Ruby 1.9-based version of Ruby Enterprise Edition for the following reasons:</p>
<ul>
<li>A copy-on-write patch has recently been checked into Ruby 2.0.</li>
<li>Many of the patches in Ruby Enterprise Edition are simply not necessary in 1.9.</li>
<li>We wish to focus our efforts on Phusion Passenger and other products. Instead of doing many things poorly, we want to do a few things, but do them very very well.</li>
</ul>
<p>We plan on providing minor fixes and updates for the time being, but users are recommended to slowly migrate to Ruby 1.9. Phusion Passenger &lt;= 3.1 users can use <a href="http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/">reverse proxy setups</a> to run multiple Ruby versions on the same server. Starting from Phusion Passenger 3.2 it will support multiple Ruby versions natively without the need for reverse proxy setups.</p>
<h2>Looking for new maintainers</h2>
<p>We believe that Ruby Enterprise Edition has served its purpose. That said, we understand that many people still rely on Ruby 1.8 for the time being because of compatibility issues. Therefore we would like to ask for volunteers who want to take over maintenance of Ruby Enterprise Edition. Please <a href="http://groups.google.com/group/emm-ruby">contact us</a> if you are interested!</p>
<h2>Download &amp; upgrade</h2>
<p>To install Ruby Enterprise Edition, please visit <a href="http://www.rubyenterpriseedition.com/download.html">the download page</a>. To upgrade from a previous version, simply install into the same prefix that you installed to last time. Please also refer to <a href="http://www.rubyenterpriseedition.com/documentation.html">the documentation</a> for upgrade instructions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/02/21/ruby-enterprise-edition-1-8-7-2012-02-released-end-of-life-imminent/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Bundler and public applications</title>
		<link>http://blog.phusion.nl/2012/01/19/bundler-and-public-applications/</link>
		<comments>http://blog.phusion.nl/2012/01/19/bundler-and-public-applications/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 21:24:18 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1451</guid>
		<description><![CDATA[I think Bundler is a great tool. Its strength lies not in its ability to install all the gems that you&#8217;ve specified, but in automatically figuring out a correct dependency graph so that nothing conflicts with each other, and in the fact that it gives you rock-solid guarantees that whatever gems you&#8217;re using in development [...]]]></description>
			<content:encoded><![CDATA[<p>I think <a href="http://gembundler.com/">Bundler</a> is a great tool. Its strength lies not in its ability to install all the gems that you&#8217;ve specified, but in automatically figuring out a correct dependency graph so that nothing conflicts with each other, and in the fact that it gives you rock-solid guarantees that whatever gems you&#8217;re using in development is exactly what you get in production. No more weird gem version conflict errors.</p>
<p>This is awesome for most Ruby web apps that are meant to be used internally, e.g. things like Twitter, Basecamp, <a href="http://unionstationapp.com/">Union Station</a>. Unfortunately, this strength also turns in a kind of weakness when it comes to public apps like <a href="http://www.redmine.org/">Redmine</a> and <a href="https://github.com/phusion/juvia">Juvia</a>. These apps typically allow the user to choose their database driver through <code>config/database.yml</code>. However the driver must also be specified inside Gemfile, otherwise the app cannot load it. The result is that the user has to edit both database.yml and Gemfile, which introduces the following problems:</p>
<ul>
<li>The user may not necessarily be a Ruby programmer. The Gemfile will confuse him.</li>
<li>The user is not able to use the Gemfile.lock that the developer has provided. This makes installing in deployment mode with the developer-provided Gemfile.lock impossible.</li>
</ul>
<p>This can be worked around in a very messy form with groups. For example:</p>
<pre>group :driver_sqlite do
  gem 'sqlite3'
end

group :driver_mysql do
  gem 'msyql'
end

group :driver_postgresql do
  gem 'pg'
end</pre>
<p>And then, if the user chose to use MySQL:</p>
<pre>bundle install --without='driver_postgresql driver_sqlite'</pre>
<p>This is messy because you have to exclude all the things you don&#8217;t want. If the app supports 10 database drivers then the user has to put 9 drivers on the exclusion list.</p>
<p>How can we make this better? I propose supporting conditionals in the Gemfile language. For example:</p>
<pre>condition :driver => 'sqlite' do
  gem 'sqlite3'
end

condition :driver => 'mysql' do
  gem 'mysql'
end

condition :driver => 'postgresql' do
  gem 'pg'
end

condition :driver => ['mysql', 'sqlite'] do
  gem 'foobar'
end</pre>
<p>The following command would install the <code>mysql</code> and the <code>foobar</code> gems:</p>
<pre>bundle install --condition driver=mysql</pre>
<p>Bundler should enforce that the driver condition is set: if it&#8217;s not set then it should raise an error. To allow for the driver condition to not be set, the developer must explicitly define that the condition may be nil:</p>
<pre>condition :driver => nil do
  gem 'null-database-driver'
end</pre>
<p>Here, <code>bundle install</code> will install <code>null-database-driver</code>.</p>
<p>With this proposal, user installation instructions can be reduced to these steps:</p>
<ol>
<li>Edit database.yml and specify a driver.</li>
<li>Run <code>bundle install --condition driver=(driver name)</code></li>
</ol>
<p>I&#8217;ve <a href="https://github.com/carlhuda/bundler/issues/1636">opened a ticket</a> for this proposal. What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2012/01/19/bundler-and-public-applications/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>XCode 4 ships a buggy compiler</title>
		<link>http://blog.phusion.nl/2011/12/30/xcode-4-ships-a-buggy-compiler/</link>
		<comments>http://blog.phusion.nl/2011/12/30/xcode-4-ships-a-buggy-compiler/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 01:04:42 +0000</pubDate>
		<dc:creator>Hongli Lai</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby Enterprise Edition]]></category>

		<guid isPermaLink="false">http://blog.phusion.nl/?p=1432</guid>
		<description><![CDATA[You may have heard of LLVM, a compiler infrastructure library. You may have heard of GCC, the GNU C and C++ compiler. Those two are completely separate software products, but there exists llvm-gcc which is a GCC frontend that utilizes LLVM. All OS X versions &#60;= Snow Leopard originally shipped with regular gcc, but as [...]]]></description>
			<content:encoded><![CDATA[<p>You may have heard of <a href="http://www.llvm.org/">LLVM</a>, a compiler infrastructure library. You may have heard of <a href="http://gcc.gnu.org/">GCC</a>, the GNU C and C++ compiler. Those two are completely separate software products, but there exists llvm-gcc which is a GCC frontend that utilizes LLVM. All OS X versions &lt;= Snow Leopard originally shipped with regular gcc, but as of Xcode 4 (which is also the default on OS X Lion) Apple has switched to llvm-gcc as their default compiler. &#8220;Hurray&#8221;, some people may think, as they heard that LLVM generates better code and/or is faster than default GCC. Unfortunately, the reality is not that great.</p>
<p>llvm-gcc is <a href="http://www.mail-archive.com/libev@lists.schmorp.de/msg01593.html">unmaintained</a> and is considered deprecated by its developers. It has many <a href="http://llvm.org/bugs/show_bug.cgi?id=9891">bugs</a> that will never be fixed. Unfortunately these are not obscure bugs that few people will notice: today, while working on Ruby Enterprise Edition, we encountered several! Calling <code>alloca(0)</code> should return a pointer to the top of the stack. On llvm-gcc however, that code returns NULL <em>but only when compiled with -O2!</em> llvm-gcc also generates subtly different code that causes the <a href="https://sites.google.com/site/brentsrubypatches/">MBARI</a> patch set to fail completely.</p>
<p>To make matters worse, consider this program:</p>
<pre>#include &lt;alloca.h&gt;

int
main() {
    if (alloca(0) != NULL) {
        return 0;
    } else {
        return 1;
    }
}</pre>
<p>Question: when compiled with &#8220;llvm-gcc -O2&#8243;, does this program exit with 0 or with 1?</p>
<p>That was a trick question. It always returns with 0, even when alloca(0) is broken and actually returns NULL. Turns out the optimizer in -O2 thinks that alloca(0) doesn&#8217;t return NULL (even though it does) and replaces <code>if (alloca(0) != NULL)</code> with <code>if (true)</code>.</p>
<p>It is unfortunate that we have to declare OS X&#8217;s default compiler as being broken. We do not recommend its use. Instead, we recommend people to use /usr/bin/gcc-4.2 (which is the non-LLVM GCC compiler) instead of /usr/bin/gcc (which is a symlink to /usr/bin/llvm-gcc). You can enable this on most build systems by setting these two environment variables:</p>
<pre>export CC=gcc-4.2
export CXX=g++-4.2</pre>
<p>On a side note, Ruby Enterprise Edition 2011.12 is being released. The official announcement hasn&#8217;t been written yet, but we&#8217;ve made haste because of the recent Ruby <a href="http://www.ruby-lang.org/en/news/2011/12/28/denial-of-service-attack-was-found-for-rubys-hash-algorithm/">security vulnerability</a>. You can already get the files on <a href="http://www.rubyenterpriseedition.com/">the Ruby Enterprise Edition website</a>. An announcement will follow soon.</p>
<h2>Update</h2>
<p><a href="http://news.ycombinator.com/item?id=3409751">some people</a> have <a href="http://www.reddit.com/r/programming/comments/nwxzu/xcode_4_ships_a_buggy_compiler/">pointed out</a> that they consider <code>alloca(0)</code> undefined. I guess it depends on the way you interpret the documentation. It would seem pretty clear to me what <code>alloca(0)</code> means, just like what <code>memcpy(x, y, 0)</code> means, but it&#8217;s understandable when some people would interpret it as undefined.<br />
Still, <code>alloca(0)</code> failing is only one of the problems that prevented Ruby from compiling properly.</p>
<h3>Why alloca(0)?</h3>
<p>alloca(0) is used in Ruby Enterprise Edition&#8217;s conservative garbage collector, as a way to detect the end of the stack. There&#8217;s a bunch of fallback #ifdefs in the code: on platforms that don&#8217;t have alloca, it detects the end of the stack by calling a forced-non-inline function which returns the address of its sole local variable, but that assumes that the compiler supports the &#8216;noinline&#8217; keyword. In any case, all of versions depend on highly platform-specific behavior.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.phusion.nl/2011/12/30/xcode-4-ships-a-buggy-compiler/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

