O Phusion Passenger é um módulo para os servidores Apache e Nginx para rodar aplicações Web Ruby, como por exemplo aplicações Ruby on Rails.
Ontem foi lançada a sua versão 3.0 do Passenger e entre as novidades está o Phusion Passenger Standalone (também chamado de Phusion Passenger Lite) que pode ser utilizado em ambiente de desenvolvimento, ao invés do Mongrel ou WEBrick.
O processo de instalar e subir o Passenger em teoria é simples, mas tive que instalar algumas dependências no meu Mac OS X para poder utilizá-lo. Abaixo listo os passos que percorri na minha instalação.
Primeiro de tudo, instalei a gem do Passenger:
$ gem install passenger
Successfully installed daemon_controller-0.2.5
Successfully installed spruz-0.1.5
Successfully installed file-tail-1.0.5
Successfully installed passenger-3.0.0
4 gems installed
Depois, todo feliz, fui iniciar o Passenger:
$ passenger start
Recebi as seguintes mensagens dizendo para atualizar a RVM:
Nginx core 0.8.52 isn’t installed
Phusion Passenger Standalone will automatically install it into:
/Users/Prodis/.passenger/standalone/3.0.0-i386-ruby1.8.7-x86_64-macosx-10.5/nginx-0.8.52
This will only be done once. Please sit back and relax while installation is
in progress.
Checking for required software…
* GNU C++ compiler… found at /usr/bin/g++
* GNU make… found at /usr/bin/make
* A download tool like ‘wget’ or ‘curl’… found at /opt/local/bin/curl
* Ruby development headers… found
* OpenSSL support for Ruby… found
* RubyGems… found
Your RVM wrapper scripts are too old. Please update them first by running ‘rvm update –head && rvm reload && rvm repair all’.
Então eu atualizei a RVM:
$ rvm update --head && rvm reload && rvm repair all
E tentei de subir o Passenger de novo:
$ passenger start
E aí obtive essas mensagens indicando que eu não tinha Curl com suporte a SSL:
Nginx core 0.8.52 isn’t installed
Phusion Passenger Standalone will automatically install it into:
/Users/Prodis/.passenger/standalone/3.0.0-i386-ruby1.8.7-x86_64-macosx-10.5/nginx-0.8.52
This will only be done once. Please sit back and relax while installation is
in progress.
Checking for required software…
* GNU C++ compiler… found at /usr/bin/g++
* GNU make… found at /usr/bin/make
* A download tool like ‘wget’ or ‘curl’… found at /opt/local/bin/curl
* Ruby development headers… found
* OpenSSL support for Ruby… found
* RubyGems… found
* Rake… found at /Users/Prodis/.rvm/wrappers/ree-1.8.7-2009.10/rake
* rack… found
* Curl development headers with SSL support… not found
* OpenSSL development headers… found
* Zlib development headers… found
* file-tail… found
* daemon_controller >= 0.2.5… found
Some required software is not installed.
But don’t worry, this installer will tell you how to install them.
Press Enter to continue, or Ctrl-C to abort.
——————————————–
Installation instructions for required software
* To install Curl development headers with SSL support:
Curl was found, but it doesn’t support SSL.
Please download Curl from http://curl.haxx.se/libcurl and make sure you install it with SSL support.
If the aforementioned instructions didn’t solve your problem, then please take
a look at the Users Guide:
/Users/Prodis/.rvm/gems/ree-1.8.7-2009.10/gems/passenger-3.0.0/doc/Users guide Standalone.html
Fui até a URL indicada, entrei na página de downloads do Curl e baixei o arquivo curl-7.21.2.zip. Descompactei o arquivo zipado e instalei o Curl com os seguintes comandos:
$ ./configure --with-ssl
$ make
$ sudo make install
Mais uma vez executei o comando para iniciar o Passenger:
$ passenger start
E dessa vez o Nginx foi instalado:
Nginx core 0.8.52 isn’t installed
Phusion Passenger Standalone will automatically install it into:
/Users/Prodis/.passenger/standalone/3.0.0-i386-ruby1.8.7-x86_64-macosx-10.5/nginx-0.8.52
This will only be done once. Please sit back and relax while installation is
in progress.
Checking for required software…
* GNU C++ compiler… found at /usr/bin/g++
* GNU make… found at /usr/bin/make
* A download tool like ‘wget’ or ‘curl’… found at /usr/local/bin/curl
* Ruby development headers… found
* OpenSSL support for Ruby… found
* RubyGems… found
* Rake… found at /Users/Prodis/.rvm/wrappers/ree-1.8.7-2009.10/rake
* rack… found
* Curl development headers with SSL support… found
* OpenSSL development headers… found
* Zlib development headers… found
* file-tail… found
* daemon_controller >= 0.2.5… found
…
Downloading Nginx…
# curl http://sysoev.ru/nginx/nginx-0.8.52.tar.gz -f -L -o /tmp/Prodis-passenger-standalone-28027/nginx-0.8.52.tar.gz
Installing Phusion Passenger Standalone…
[*********************************************] Copying files… -
All done!
…
E finalmente consegui subir o Passenger em modo standalone:
$ passenger start
=============== Phusion Passenger Standalone web server started ===============
PID file: /Users/Prodis/Lab/quick-todo/tmp/pids/passenger.3000.pid
Log file: /Users/Prodis/Lab/quick-todo/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================================
Note que para usar o Passenger não utilizamos mais script/server ou rails server, somente o comando passenger start na raiz da aplicação Rails.
Uma coisa interessante do Phusion Passenger Standalone é que você não precisa iniciá-lo a partir da aplicação. Você pode passar como parâmetro para o comando start o caminho da sua aplicação Rails:
Prodis ~/Downloads [ree-1.8.7] $ passenger start ~/Lab/webstore/ -p 3001
=============== Phusion Passenger Standalone web server started ===============
PID file: /Users/Prodis/Lab/webstore/passenger.3001.pid
Log file: /Users/Prodis/Lab/webstore/passenger.3001.log
Environment: development
Accessible via: http://0.0.0.0:3001/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================================
Note que eu passei também no parâmetro -p a porta em que eu quero minha aplicação fique disponível.
Para a lista completa os parâmetros do comando start do Passenger, use o help:
$ passenger start --help
Ruby Mac OS X, Mongrel, Passenger, Rails, Ruby, Ruby on Rails, WEBrick
Comentários