jobscore.passenger_nginx

Passenger NGINX

CI

Ansible Role for setting up Passenger and NGINX for Ruby applications.

Requirements

Before using this role, make sure Ruby is already installed on the target machine. You can set the path to the Ruby binary with the passenger_ruby variable.

Role Variables

Passenger Configuration

passenger_app_root: /mnt/app/public

This is the path to the public folder of your Rails application.

passenger_app_env: production

This sets the RAILS_ENV that Passenger will use to run your Rails application.

passenger_root: /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini

This is the path to your Passenger config file. Do not change this unless you’ve set up Passenger manually elsewhere.

passenger_ruby: /usr/local/bin/ruby

This is the path to your Ruby binary.

passenger_extra_config: ''

Use this variable to add or customize Passenger settings for your applications. More information about Passenger parameters for NGINX can be found here.

NGINX Configuration

nginx_server_name: www.example.com

This is the server name that NGINX will respond to for HTTP requests.

nginx_user: "www-data"

This is the user that NGINX will use to run the server.

nginx_extra_config: ''

Additional configuration parameters that you may want to add to the main nginx.conf template.

nginx_events_extra_config: ''

Extra configuration options to add under the events section of nginx.conf.

nginx_http_extra_config: ''

Extra configuration options to add under the http section of nginx.conf.

nginx_vhost_config: |
  server {
    listen 80 default_server;
    server_name {{ nginx_server_name }};
    passenger_enabled on;
    passenger_app_env {{ passenger_app_env }};
    root {{ passenger_app_root }};
  }

NGINX configuration for the Passenger app. The default settings work for all apps. You can customize this as needed using variables like in a Jinja template.

nginx_worker_processes: "auto"
nginx_worker_connections: "768"
nginx_keepalive_timeout: "65"

These values configure their respective settings in the nginx.conf template.

Example Playbooks

- hosts: servers
  roles:
    - role: jobscore.ruby
    - role: jobscore.passenger_nginx
- hosts: servers
  pre_tasks:
    - apt:
        name: ruby-full
        state: present
  roles:
    - role: jobscore.passenger_nginx
      nginx_server_name: www.example.com
      passenger_extra_config: |
        passenger_max_pool_size 6;
        passenger_min_instances 6;
        passenger_pre_start {{ nginx_server_name }};

License

MIT

Author Information

This role was created by Eric Magalhães and Glauber Batista during their work at JobScore Inc.

Informazioni sul progetto

Ansible Role for installing Passenger and NGINX for Ruby apps

Installa
ansible-galaxy install jobscore.passenger_nginx
Licenza
mit
Download
6k
Proprietario