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

https://gist.github.com/manzhikov/418da52577ef31903580

Quick install:

git clone https://gist.github.com/418da52577ef31903580.git ruby-2.2.3-railsexpress
cd ruby-2.2.3-railsexpress
bash ./install.sh

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 model@instamango.com
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:
2.1.5

build_package_patch_ruby_railsexpress() {
  fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master

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

install_package "openssl-1.0.1j" "https://www.openssl.org/source/openssl-1.0.1j.tar.gz#cff86857507624f0ad42d922bb6f77c4f1c2b819" mac_openssl --if has_broken_mac_openssl
install_package "ruby-2.1.5" "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz#4305cc6ceb094df55210d83548dcbeb5117d74eea25196a9b14fa268d354b100" patch_ruby_railsexpress ldflags_dirs standard verify_openssl

Second script for install:
install.sh

#!/usr/bin/env bash

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

  if brew --prefix readline >

Continue reading →