Deploying Sidekiq to Ubuntu 16.04


Bookmark and Share

Sidekiq is a popular background processing tool available in Ruby. It’s fast, robust and reliable compared to other solutions out there. Sidekiq run as a process outside of rails (but including the rails environment), which means it doesn’t start when you start your rails application. During development, we start sidekiq in another terminal (or tab) using the command

to run it as a daemon we use the -d option

To kill a sidekiq daemon, you need to do  the PID of the sidekiq process. When a sidekiq process starts it enters its pid to file which can be found at

So the command to stop it would be

But making it a daemon is not a good idea, as there is no code from sidekiq to restart the process when it fails or exits on its own. So in ubuntu, which is our favorite OS for the production server, we make sidekiq a systemd process.

Before we make it into a service and if you are using rvm you need to create a wrapper for systemd so that ruby with all the gems are available for it.

Once that is done you need to create a sidekiq.service file under your …

Read More

Mina: Faster deployment and remote server automation


Bookmark and Share

Even though we use CodeShip/Circle CI/Jenkins for continuous integration, we still need to write scripts to automate our deployment. We also need to write small commands to clear cache, restart queues, etc. It’s always a good practice to not have to enter the server directly but to have it done through scripts. There are many tools available for this purpose (in multiple languages) like Capistrano, Vlad, etc.

Mina is a similar tool, but faster. The reason why it runs faster is because it generates a bash script, uploads it to the server and run there, rather than creating a new ssh session and run every command one by one. Mina is one of our default tools at Red Panthers.

To use mina in your project, add mina to your Gemfile.

and to get started do

 

http://nadarei.co/mina/setting_up_a_project.html
https://www.digitalocean.com/community/tutorials/how-to-deploy-with-mina-getting-started

 

Having a one step deployment is an important requirement for any project so have one ready using mina or capistrano.

 

Note:

Assets pre-compile

 

Run another rake task

Run shell commands

The syntax queue is referring to the fact that, the commands are all made into a single …

Read More

How to deploy a Rails app with Passenger and Apache in Ubuntu 14.04


Bookmark and Share

How to deploy a Rails app with Passenger and Apache in Ubuntu 14.04

Introduction

If you are a Ruby on Rails developer, you need a web server to host your web apps. This article shows you how to use Phusion Passenger as your Rails-friendly web server. Passenger is easy to install, configure, and maintain and it can be used with Apache. In this article, we will learn to install Passenger on Ubuntu 14.04.

Step 1 — Set Up Your Domain

In order to ensure that your site will be up and visible, you need to set up your DNS records to point your domain name towards your new server. Alternatively, you can always access your website via an IP address on your local server.

Step 2 — Install RVM

Before you start, an update of your Ubuntu operating system would ensure the upkeep of all the packages to be installed. You can do this with the following command:

      sudo apt-get update

Next step would be to install some libraries and other dependencies. This will make further ruby …

Read More