Skip to content

Instantly share code, notes, and snippets.

View FooBarWidget's full-sized avatar

Hongli Lai FooBarWidget

View GitHub Profile

Deployment error resistance helps preventing visitors from experiencing problems in case your deployments fail.

We all make mistakes. A new application version could contain a bug that prevents it from starting. An error message in the browser could scare away visitors. Would it not be great if visitors can be shielded from this problem?

Enter deployment error resistance. Use it in combination with rolling restarts. If your app fails to start, Phusion Passenger Enterprise will log the problem, redirect the request to an existing process, flag your application so that no existing processes are shutdown and no new processes are spawned. You can perform emergency fixing while your visitors continue to get served.

Now you can sleep more and worry less, with Phusion Passenger Enterprise.

Resource control features allow you limit resource usage and to keep misbehaving applications in line.

If you run several applications on your server, but one application is more important than the other, would it not be great if you can give the most important one more resources? Or if your application or one of its libraries contain bugs that could cause it go to on a rampage, would it not be great if they can be kept in line until you've fixed the problem?

Phusion Passenger Enterprise allows you to limit the maximum number of processes, limit the memory usage and limit the maximum request time on a per-application basis or even per-URL basis. Sleep more and worry less with Phusion Passenger Enterprise.

require 'thread'
begin
require 'soap/wsdlDriver'
rescue LoadError
require 'savon'
end
class VatUtils
SERVICE_URL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'.freeze
VAT_FORMAT = /\A([A-Z]{2})([0-9A-Za-z\+\*\.]{2,12})\Z/.freeze
PhusionPassenger.on('request', function(headers, socket) {
var data =
"Status: 200\r\n" +
"Content-Type: text/html\r\n" +
"\r\n" +
"<h1>Hello Node.js in Passenger</h1>\n";
for (var i = 0; i < headers.keys.length; i++) {
var key = headers.keys[i];
data += key + " = " + headers[key] + "<br>\n";
}

Introduction

Phusion Passenger can be configured in 2 ways, the "originally packaged" configuration and the "natively packaged" configuration. Depending on the configuration, Phusion Passenger locates its files (also called assets) in a different manner.

Originally packaged

This is the configuration you get when you checkout Phusion Passenger from git,

From bd2e1311aa25b341be015a8d96deddeda7e88c47 Mon Sep 17 00:00:00 2001
From: "Hongli Lai (Phusion)" <[email protected]>
Date: Sun, 15 Jan 2012 18:56:12 +0100
Subject: [PATCH] Set 'overflow: auto' on 'pre' tags so that the browser will
show horizontal scroll bars for long code examples.
---
stylesheets/asciidoc.css | 1 +
themes/flask/flask.css | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# encoding: binary
require 'socket'
require 'zlib'
require 'stringio'
GZIP = true
CHUNKED = true
$io = StringIO.new
$io.binmode
# encoding: binary
require 'socket'
require 'zlib'
require 'stringio'
GZIP = false
CHUNKED = true
io = StringIO.new
io.binmode
class WhatsGoingOn
def initialize(io)
@io = io
end
def analyze
require 'rbconfig'
require 'rubygems'
print('Ruby exe', ruby_exe)
print('Ruby version', RUBY_VERSION)