Ruby Web Dev Env (RMR) in OpenSolaris JeOS Prototype

OpenSolaris 200906 JeOS Prototype is PURE CLI enviroment, so its small true command line only enviroment, as such is ideal install BASE for web services like is Ruby Web Dev environment (RMR) = Ruby Rack MySQL Ruby Rails.

In this example I will demonstrate use of Ruby 1.8, Ruby Rack 1.0.1, MySql 5.1, Ruby Rails 2.3.3 from main and contrib PKGs OpenSolaris 200906 repository in OpenSolaris 200906 JeOS Prototype.

General Information - JeOS Prototype OpenSolaris project

Download OpenSolaris 200906 JeOS Prototype VM for one 10+ most popular Virtualization Formats:

JeOS: Just enough OS Project Homepage

OpenSolaris 2009.06 JeOS Prototype VM Images Download

OpenSolaris 2009.06 JeOS Prototype 10 Simple Usage Samples

Discussion jeos-discuss@opensolaris.org (Main page)

Discussion jeos-discuss@opensolaris.org (Archives)

Part 1: Check JeOS readiness as user root

1. Switch to root

pfexec su - root

2a. Check, if PKG will clean download cache on SUCCESS

root@osol-jeos:~# pkg property flush-content-cache-on-success
PROPERTY                       VALUE
flush-content-cache-on-success True

2b. Check, then we increase PKG download patience for slowest networks

root@osol-jeos:~# set | grep PKG
PKG_CLIENT_TIMEOUT=120
PKG_TIMEOUT_MAX=16

2c. Check, then we use right main repository for opensolaris.org and have configured contrib one

root@osol-jeos:~# pkg publisher
PUBLISHER                             TYPE     STATUS   URI
opensolaris.org          (preferred)  origin   online   http://pkg.opensolaris.org/release/
contrib                               origin   online   http://pkg.opensolaris.org/contrib/

2d. Check, then we can access these repositories

root@osol-jeos:~# pkg refresh --full

2e. Check, opensolaris.org download speed of whole repository catalog

root@osol-jeos:~# curl pkg.opensolaris.org/release/catalog/0 >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1333k  100 1333k    0     0  93491      0  0:00:14  0:00:14 --:--:--  126k

2f. Check, if we have enough memory and activated swap (I recommend if possible to have VM with 768MB-1GB RAM configured)

root@osol-jeos:~# top | grep Memory
Memory: 1024M phys mem, 525M free mem, 512M total swap, 512M free swap

2g. Check, if you have enough disk space in host, in case then you use a growing Virtual disk Format

At least 2GB of disk space is needed

Part2: Install Ruby RMR on OpenSolaris JeOS Prototype

Check, then we see needed packages in contrib repository:

root@osol-jeos:~# pkg refresh --all
root@osol-jeos:~# pkg list -a ruby-mysql ruby-rails ruby-rack
NAME (PUBLISHER)                              VERSION         STATE      UFIX
ruby-mysql (contrib)                          2.8.1-0.111     known      ----
ruby-rack (contrib)                           1.0.1-0.111     known      ----
ruby-rails (contrib)                          2.3.3-0.111     known      ----

1. Installing Ruby 1.8 as base

root@osol-jeos:~# pkg install SUNWruby18
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1 11853/11853     6.14/6.14

PHASE                                        ACTIONS
Install Phase                            13859/13859
Deleting content cache

2. Install Ruby Rack and Ruby Rails

root@osol-jeos:~# pkg install ruby-rails
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1   9632/9632   10.93/10.93

PHASE                                        ACTIONS
Install Phase                            11641/11641
Deleting content cache
root@osol-jeos:~# pkg install ruby-rack
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     902/902     0.70/0.70

PHASE                                        ACTIONS
Install Phase                              1116/1116
Deleting content cache

3. Install MySQL DB and Ruby MySQL driver in chunks

root@osol-jeos:~# pkg install  SUNWmysql51 SUNWmysql-base
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    2/2     335/335   84.19/84.19

PHASE                                        ACTIONS
Install Phase                                427/427
Deleting content cache
root@osol-jeos:~# pkg install  SUNWmysql51lib
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1         9/9     5.16/5.16

PHASE                                        ACTIONS
Install Phase                                  47/47
Deleting content cache
root@osol-jeos:~# pkg install ruby-mysql
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     293/293     0.37/0.37

PHASE                                        ACTIONS
Install Phase                                354/354
Deleting content cache

Part 3: Configure and use Ruby Environment

Check Ruby Rack example

root@osol-jeos:/usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example# rackup lobster.ru &

[1] 1058
root@osol-jeos:/usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example# [2009-12-10 17:11:33] INFO  WEBrick 1.3.1
[2009-12-10 17:11:33] INFO  ruby 1.8.7 (2008-08-11) [i386-solaris2.11]
[2009-12-10 17:11:33] INFO  WEBrick::HTTPServer#start: pid=1058 port=9292

root@osol-jeos:/usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example#  links http://localhost:9292/

root@osol-jeos:/usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example#  fg
rackup lobster.ru

Press Ctrl-C

\^C[2009-12-10 17:19:11] INFO  going to shutdown ...
[2009-12-10 17:19:11] INFO  WEBrick::HTTPServer#start done.

root@osol-jeos:/usr/ruby/1.8/lib/ruby/gems/1.8/gems/rack-1.0.1/example#  

See more information about contrib Ruby stuff look in blogs.sun.com

webstack-discuss@opensolaris.org

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hands-on experience with Virtualization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today