2012/09/28

Rails3.2 with ruby193 on CentOS6.3

Do you know "openshift"?
Red Hat provides their own paas with Rails3 rpms.

normaly Rails3 setups, using "gem install&gem update", community software is very fine,
If you want to use older-stabler software Rails3 stack like CentOS, you have to chose red-hat's rpms.

Rails3 configration(Redhat's openshift)
*p1*
  ruby 1.8.7-352-7 (community 1.8.7-357  plus redhat's 7 patch)
  Rails 3.0.13-1

*p2*
  ruby 1.9.3-1-4
  Rails 3.2.3-1


=======================================================
#!/bin/sh
#
# Installing Rails3 and ruby193 rpms from Red Hat(openshift) repository
#  on CentOS6/RHEL6
# getting openshift repository
#
cat> /etc/yum.repos.d/openshift.repo 2>&1 <EOF

[openshift]
baseurl=http://mirror.openshift.com/pub/crankcase/rhel-6/\$basearch
gpgcheck=0
EOF
yum -y install ruby193-rubygem-rails ruby193-rubygem-rack ruby193-rubygem-sqlite3
#
# switching to ruby193
#
. /opt/rh/ruby193/enable
#
# check ruby ver.
ruby -v
#
# check rails ver.
rails -v

========================================================

before you play with rails3.2,  type enabling command.

$  .    /opt/rh/ruby193/enable
$  rails -v
$  rails new test1 

Have a fun!!


2012/09/21

Adding KVM guest node with Jenkins

Making Build script with KVM(virtinst)
  • Click to [New Job]
  • Pull down [Add build step]  and enter building virtual guest like..

sudo qemu-img create -f qcow2 /var/lib/libvirt/images/RH62x64.qcow2 60G
sudo virt-install --name=RH62x64 --hvm --connect=qemu:///system \
--disk path=/var/lib/libvirt/images/RH62x64.qcow2,size=60,format=qcow2 \
--disk path=/export/rhel-server-6.2-x86_64-dvd.iso,bus=ide,device=cdrom \
--graphics vnc,keymap=ja --vcpus=2 --ram=2048 --os-type=linux --os-variant=rhel6 \
--extra-args="ks=http://192.168.122.1/ks/anaconda-ks.cfg" --location=http://192.168.122.1/os/RH62/


  • Click to [Save]
  • Click to [Build Now] then you 'll get a kvm guest.


Adding KVM guest with Jenkins
Computer Name -> QEMU
Hypervisor Host -> 127.0.0.1
Username -> root


  • Click to [New Node] and enter node information
Secondary launch method -> Launch slave via execution of command on the Master
Launch command  -> ssh root@192.168.122.XXX exec java -jar slave.jar -jnlpUrl http://192.168.122.1:8080/computer/RH63x64/slave-agent.jnlp

also, you have to make scp files to new added guest root-home.


authorized_keys:  -> root@[guest ip]:/root/.ssh/
[put Jenkins'  RSA pub-key from (/var/lib/jenkins/.ssh/id_rsa.pub)]
/var/run/jenkins/war/WEB-INF/slave.jar: ->  root@[guest ip]:/root/
Making Build script on KVM node
  • Click to [New Job]
  • Choose [Build multi-configuration project]
  • Go to [Configuration Matrix] and select execution nodes.
  • Pull down [Add build step]  and enter building virtual guest like..

2012/09/20

Installing jenkins on Ubuntu 12.04 lts

$ sudo apt-get install jenkins

.
.
.
.
.
.
That's all !!  
open url  http://localhost:8080







I'll command my repeated Jobs to Mr.Jenkins!!

2012/08/01

Githubを使ったソース管理のメモ

開発コードはネット上に置いてどこでもデバッグできる様にしよう!!

■Gitアカウントの作成
 https://github.com/
  アカウント名+パスワードを覚えておきます。
 以下のリポジトリ名でソース管理できます。

https://github.com/<アカウント名>/<リポジトリ>.git

■githubレポジトリの作成
  githubのメニューから作成しておきます。
■ローカルディスクの登録
 開発フォルダ全体を登録します。
$ git init
$ git remote add origin https://github.com/<アカウント名>/<リポジトリ>.git
$ git push -u origin master

■差分の登録
 こまめにcommitして管理します。
$ git add .
$ git commit -m "<編集内容>"
$ git push

■環境の取り出し
 出先を問わずにソースの取り出し
$ mkdir xxxx
$ cd xxxx
$ git init
$ git clone  https://github.com/<アカウント名>/<リポジトリ>.git

2012/07/17

Rails3 on CentOS6.3

Installing  Rails3
Installing some pkg for Rails with yum and gem commands.
# yum -y install rubygem-rake ruby-devel make sqlite-devel gcc-c++
# gem install rails sqlite3 therubyracer

Creating Rails application
(adding your user-id into /etc/sudoers)
$ rails new ruby_app1
$ cd ruby_app1
$ rails server
/usr/lib/ruby/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
      from /usr/lib/ruby/gems/1.8/gems/execjs-1.4.0/lib/execjs.rb:5
      from /usr/lib/ruby/gems/1.8/gems/coffee-script-2.2.0/lib/coffe_script.rb:1:in `require'

Updating 'Gemfile'
$ echo "gem 'therubyracer'" >> Gemfile

Restarting application server
$ rails server
you can see the local application on your browser 'http://localhost:3000'






have a fun!!

2012/03/06

Updating your CentOS system with DVD

### Updating from DVD
When you don't have enough network connection with CentOS/RHEL system.
Try DVD updating!!

Mounting DVD media.
# mkdir /cdrom
# mount /dev/sr0 /cdrom
or
# mount -o loop xxxx-dvd.iso /cdrom



Making dvd repository for yum's updating.
CentOS5,6/RHEL6:
 # cat >/etc/yum.repos.d/dvd.repo
[dvd]
baseurl=file:///cdrom
[send ctl-D]

RHEL5:
 # cat >/etc/yum.repos.d/dvd.repo
[dvd]
baseurl=file:///cdrom/Server/
[send ctl-D]


Updating with "yum" command.
# yum -y --nogpgcheck --enablerepo=dvd [--disablerepo=\*] update

2012/02/05

SSDのアクセス速度

SSDに変更して消費電力やパソコンの反応が良くなる事に満足していたが、どうしてもカタログ値通りにはならないので調査した。普段、200MB/sの読み書きのところが、。。。


440MB/S以上を達成!!

やり方は簡単、「ファイル」→「テストデータ」→「0」でテストする。
確かにオール0の書き込みはインチキ(最適化)できるかも。

SSD: OCZ-AGILITY3 120G (SATA-6G)