Tag Archives: ruby

PRUN: Ruby server with Docker

logo-plumbadge

The idea is that: as equivalent to LAMP (Linux/Apache/Mysql/Php) architecture, in Ruby world we could have

PRUN architecture: Postgresql + Ruby + Ubuntu + Nginx.

Name: ‘Prun’ means ‘Plum’ in Romanian language.

I have used Docker to create a container with:

  • Ubuntu 14.04 trusty
  • Postgres 9.3
  • Ruby 2.1.2
  • Nginx 1.4.6

Also based on OpenSSH to connect, Chef to manage Rails apps configurations and Supervisor to maintain daemons at the container.

The repo is published on https://github.com/jlebrijo/prun and you can see the image at Docker hub https://registry.hub.docker.com/u/jlebrijo/prun/

The basic operation should be (details in the next post):

  1. Install with Docker: docker run -d -p 2222:22 -i jlebrijo/prun
  2. Manage configuration with Chef: knife solo cook root@lebrijo.com -p 2222
  3. Deploy with Capistrano: cap production deploy

That easy!!

Install RVM in your Ubuntu Desktop

You can install RVM with this few commands:

sudo apt-get install curl
curl -L get.rvm.io | bash -s stable --auto
source /etc/profile.d/rvm.sh << or whatever says the console of rvm >>

After that, you need to check which RVM prerequisites depends on :

rvm requirements

Install last ruby version:

rvm install 2.1.2

For .bashrc executing purposes, and execute RVM ruby version when open a project, you can integrate RVM with your Gnome terminal:

RVM gnome-terminal integration
Deeper explanation here: https://rvm.io/integration/gnome-terminal/

My favourite way to configure a Rails project ruby-version and gemset is in Gemfile:

#ruby=ruby-2.1.2
#ruby-gemset=website

But you always you can use .ruby-version and .ruby-gemset files.

Chef basics for Rails Developers

In our new collaboration with Tealeaf Academy friends, we are writing about Chef/Vagrant and how to use them to manage and test your servers configuration.

This is a step-by-step guide (including github projects) to bootstrap and cook a basic Rails server:

  • Step 1. Vagrant: Creating your Development environment (Server Virtualization)
  • Step 2. Knife-solo: Kitchen structure
  • Step 3. Librarian: Managing dependencies
  • Step 4. Creating your own cookbook (rails-stack)
  • Step 5. Cook your Vagrant Box
  • Step 6. Cook a real server
  • Step 7. Deploy with Capistrano
  • Conclusions

Enjoy!!