How do I Configure Ruby App Server

CloudJiffy supports the following Ruby application servers:

1.Apache2 + Passenger :
The default dynamic mod_passenger.so module was added to the Apache build. It is included in the modules folder while Ruby environment creation and is enabled by default.

2.NGINX + Passenger

3.NGINX + Puma

4.NGINX + Unicorn

5.NGINX server was recompiled with Passenger, Puma and Unicorn in-built modules. Each of them represents a separate server for Ruby scripts processing. You can choose one  you need due to your application’s size, number of visitors, required rapidness, etc.

Taking into consideration that NGINX has several supported modules let’s see how to enable the one you need.

NGINX Modules Setting

Passenger module is the default one for all new Ruby environments with NGINX application server. In order to enable another module, follow the next steps:

1. Click Config button next to the application server of your NGINX-Ruby environment.

2. In the opened Configuration Manager panel navigate to the conf > nginx.conf file.

3. Find the include app_servers strings:

#    include  app_servers/nginx-unicorn.conf;
#    include  app_servers/nginx-puma.conf;
      include  app_servers/nginx-passenger.conf;


4. Uncomment the string for the required module and comment the previously active one.

Don’t forget to comment previously used module, otherwise you’ll get the compatibility errors. Only one string should be uncommented.

5. Save the changes made and Restart the NGINX application server in order to apply them.

6. Deploy my Ruby application if you haven’t done this before.

7. Generate and add SSH key to your dashboard. Access the NGINX Ruby container via CloudJiffy SSH Gateway in the way described in this instruction.

Note: added SSH key is attached to my account, but not just to a separate environment

8. While inside the container you should navigate to the ROOT folder:

cd /var/www/webroot/ROOT/

9. Then run one of the following commands depending on the module you would like to enable:

  • for Puma

    pumactl -F config/puma.rb start

  • for Unicorn

    unicorn_rails -c config/unicorn.rb -D

That’s all! Now you can work with the chosen Ruby NGINX module.

Note:

  • If you would like to switch back to the Passenger in-built module, just enter one of the following commands (depending on the module you’ve used before)

    • pumactl -F config/puma.rb stop
    • ps aux | grep 'unicorn' | awk '{print $2}' | xargs kill -QUIT

        and repeat 1-5 steps of this instruction uncommenting Passenger line in config file.

  • Thin and Mongrel servers are not supported due to large CPU and memory usage.

 


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 11080