📜 ⬆️ ⬇️

Ruby on Rails. Passenger quickstart

Small introduction


I plan to translate with testing all 8 sections of the original library with links to the original, they are not always accurate and relevant, that is, it will rather be not an exact translation, but a retelling.

To start:

In general, Passenger can be installed:
')
  1. System-wide:
    1.1 Package manager of your distribution.
    1.2 From the tarball.
  2. Locally via RubyGems.

The passenger itself can be started with the 3rd keys:

passenger start
passenger stop
passenger status

But the most important is the key - help after the command (which is quite usual), for example

$ passenger start --help

Very useful. It will be clear why.

Passenger integrates with apache, nginx, can work as a lightweight stand-alone web server. If in the Rails application it is added to the Gemfile, then the rails server will launch it, not WEBricks, having previously installed it for you locally, but you can do it differently, see below. The meaning of a complete build with binary files is not very clear, can an ordinary user connect modules to apache2 or nginx?

Quick Start / Quickstart: Ruby + Phusion Passenger


This 5-minute tutorial will teach you how to launch ruby ​​applications with PhusionPassenger server in development mode. Strictly speaking described the installation option RubyGems. (Approx. Translation)

  1. What is Passenger?
  2. Preparation of demo applications.
  3. Updating your gem bundle.
  4. Start the server.
    bundle exec rails server
  5. Logs.
  6. Stop the server.
  7. Findings.

What is Passenger?

Passenger is an open-source web application server ( there is also an Enterprise version - approx. ). It serves HTTP requests, manages resources, allows diagnostics, monitoring, etc.
Passenger is very easy to use further active bragging creators in the original video.
This guide is not comprehensive. Instead, it allows you to start work as quickly as possible, after which you can consider . The translation will be more important there, more difficult, with illustrations.

Preparing Demo Applications

As usual, "hello world."
Rails:
$ git clone https://github.com/phusion/passenger-ruby-rails-demo.git $ cd passenger-ruby-rails-demo
Sinantra:
$ git clone https://github.com/phusion/passenger-ruby-sinatra-demo.git $ cd passenger-ruby-sinatra-demo

Updating your gem bundle

Run:

From the translator: it's not entirely clear

"Open your app's Gemfile and add" passenger ":"
Open and add.

$ gem "passenger", ">= 5.0.25", require: "phusion_passenger/rack_handler"

Gem, Gemfile's themselves already exist.

# gem 'passenger'

So guess. I tried and so and so - it works. This is a note.

Then everything is obvious

$ cd /path-to-your-app
$ bundle install
...
Installing passenger xxx
...
Your bundle is complete!

Server startup

Now you can start the server:

$ bundle exec passenger start
======= Phusion Passenger Standalone web server started =======
PID file: /Users/phusion/myapp/tmp/pids/passenger.3000.pid
Log file: /Users/phusion/myapp/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
===============================================================

It is better not to run a standalone passenger on localhost and port 3000, better

$ bundle exec passenger start -p 8081 -a 192.168.1.1

Or whatever you have.

As already said

$ bundle exec rails server

Launches passsenger, which will pop up locally.

Logs

Logging is rich, usually log / passenger.XXXX.log, where XXXX is the port number, under Rails messages are also output to the terminal. Here the topic is extensive, after all, the logs of the applications and web servers themselves ( this is my opinion - approx. Transl. )

Server shutdown

Not hard to guess:
Ctrl-C or

$ bundle exec passenger stop

From another console.

findings

To be honest, "take a pie from the shelf."

UPD1. In general, this entry. As the authors put it, "In 5 minutes, get acquainted with the product." Therefore, the cougar with the unicorn is not mentioned (see comments below). Then, the authors are sometimes subjective, I convey their words. It should also be borne in mind that advice has to be checked. And a drawback. Phusion Passenger not only supports Ruby, but the volume is a bit large. The second I have at my disposal are two laboratory virtual machines CentOS 7.2 and Debian 8.0, alas, I use Apache, Nginx is installed, but is used less frequently. After a brief introduction follows two sections, but I will try to remove the repetitions and collect the most valuable of the basics and practices.

Source: https://habr.com/ru/post/278735/


All Articles