Ildar Manzhikov

Ruby and JavaScript developer

Read this first

rbenv ruby-2.2.3-railsexpress

Bash script to install ruby-2.2.3 patched railsexpress on rbenv

Quick install:

git clone ruby-2.2.3-railsexpress
cd ruby-2.2.3-railsexpress
bash ./

Continue reading →

How to add swap to an EC2 instance

Swap should take place on the Instance Storage (ephemeral) disk and not an EBS device. Swapping will cause a lot of IO and will increase cost on EBS. EBS is also slower than the Instance Store and the Instance Store comes free with the EC2 Instance.

It will usually be mounted to /mnt but if not run

sudo mount /dev/xvda2 /mnt

To then create a swap file on this device do the following for a 4GB swapfile

sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=4096

Make sure no other user can view the swap file

sudo chown root:root /mnt/swapfile
sudo chmod 600 /mnt/swapfile

Make and Flag as swap

sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile

Add/Make sure the following are in your /etc/fstab

/dev/xvda2      /mnt    auto    defaults,nobootwait,comment=cloudconfig 0   2
/mnt/swapfile swap swap defaults 0 0

and lastly enable swap

sudo swapon -a

Continue reading →

passenger-config restart-app with capistrano

I’m sure not only me having this issue after update capistrano with passenger v.5

Basically problem it looking like that:

INFO [c55a19d7] Running /usr/local/rvm/bin/rvm default do passenger-config restart-app /home/model/staging --ignore-app-not-running as
DEBUG [c55a19d7] Command: /usr/local/rvm/bin/rvm default do passenger-config restart-app /home/model/staging --ignore-app-not-running
DEBUG [c55a19d7]    *** ERROR: You are not authorized to query the status for this Phusion Passenger instance. Please try again with 'rvmsudo'.

This case is working for rvm system wide

Just add:

set :rvm_map_bins, fetch(:rvm_map_bins, []).push('rvmsudo')
set :passenger_restart_command, 'rvmsudo passenger-config restart-app'

to deploy.rb

And to not prompt the user password with sudo, just create file /etc/sudoers.d/deployer_username with content:

deployer_username ALL=(ALL)

Continue reading →

How to install via rbenv ruby with railsexpress patch

First file is version description:

build_package_patch_ruby_railsexpress() {
  fetch_git rvm-patchsets git:// master

  for p in rvm-patchsets/patches/ruby/2.1.5/railsexpress/* ; do
    patch -p1 < $p

install_package "openssl-1.0.1j" "" mac_openssl --if has_broken_mac_openssl
install_package "ruby-2.1.5" "" patch_ruby_railsexpress ldflags_dirs standard verify_openssl

Second script for install:

#!/usr/bin/env bash

if command -v brew > /dev/null
  if brew --prefix openssl > /dev/null
    CONFIGURE_OPTS="$CONFIGURE_OPTS --with-openssl-dir=`brew --prefix openssl`"

  if brew --prefix readline >

Continue reading →