Skip to content

Wakame vdc install on Gentoo linux (2013, winter, en)

Tomofumi Hayashi edited this page Dec 5, 2013 · 4 revisions

Beginnings

This article describes "how to install Wakame-vdc, IaaS (Infrastructure as a Service) cloud computing framework in Gentoo Linux, one of the common Linux distributions.

Technical summary for Wakame-vdc is described in following URL:

The goal of this article is limited to following things:

  • prepare for install Wakame-vdc
  • install Wakame-vdc from github
  • verify that all services (daemons) work without errors.

This article focuses on getting the services to start. It does not guarantee that Wakame-vdc will work correctly. Please let me know if you find mistakes or have comments. I will update it.

Target platform

The target platform is Gentoo Linux, running under kvm(qemu), with the following specifications:

  • CPU: x86_64 x 4
  • HDD: 20G
  • Memory: 4G

Setup Gentoo Linux

Install Gentoo Linux on the above virtual machine.

The following pages describes how to install Gentoo.

After installing, Wakame-vdc requires you to activate the following kernel features.

  • kvm
  • virtio
  • lxc
  • IPTABLE
  • EBTABLE
  • OpenVZ

Activate nested kvm

To activate nested kvm, modify /etc/modprove.d/kvm.conf to contain the following:

#/etc/modprove.d/kvm.conf
options kvm_intel nested=1
options kvm_amd nested=1

Install the required software through portage

Install these portage packages that Wakame-vdc requires.

vgen1 ~ # emerge --autounmask-write git rabbitmq-server nginx ebtables iptables ethtool vconfig \
         curl openssl dnsmasq libxml2 libxslt erlang sqlite app-emulation/qemu dosfstools \
         net-misc/ipcalc tmux bridge-utils app-misc/screen iproute2 open-iscsi wireshark openvswitch vzctl \
         mysql mod_proxy_html 
vgen1 ~ # etc-update
vgen1 ~ # emerge git rabbitmq-server nginx ebtables iptables ethtool vconfig curl openssl dnsmasq \
          libxml2 libxslt erlang sqlite app-emulation/qemu dosfstools net-misc/ipcalc tmux bridge-utils \
          app-misc/screen iproute2 open-iscsi wireshark openvswitch vzctl mysql mod_proxy_html

Please wait for the portage build to finish and fix any errors that you might encounter.

Install Apache

Wakame-vdc requires apache mod_proxy, so emerge apache requires following arguments.

APACHE2_MODULES="proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" emerge apache

Configure MySQL

The MySQL that we just installed requires some configuration. Execute emerge with the "--config" option. Keep the MySQL root password empty.

vgen1 wakame-vdc # emerge --config =dev-db/mysql-5.1.70


Configuring pkg...

 * Please provide a password for the mysql 'root' user now, in the
 * MYSQL_ROOT_PASSWORD env var or through the /root/.my.cnf file.
 * Avoid ["'\_%] characters in the password
    >
 * Retype the password
    >

In addition, add the following configuration in /etc/mysql/my.cnf:

#/etc/mysql/my.cnf
[mysqld]
binlog-format = mixed

(optional) Openvswitch

If you failed to install openvswitch, following post may fix it. http://forums.gentoo.org/viewtopic-p-7442402.html

If it still fails, you may install it without portage from .tar.gz archives.

Download Wakame-vdc

This section downloads Wakame-vdc from github, changes the configuration files and so on.

This article assumes that the Wakame-vdc's target directory is the following. Of course, you can install to another directory. Wakame-vdc: /root/wakame-vdc config files: /etc/wakame-vdc

Pull wakame-vdc from github

Wakame-vdc is a very active project, so let's pull the tree and checkout the latest stable version (at Dec 2013), ref/tags/v13.08.0.

vgen1 ~ #git clone https://github.com/axsh/wakame-vdc.git
(snip)
vgen1 wakame-vdc # git checkout -b v13080 refs/tags/v13.08.0
Switched to a new branch 'v13080'

Install Ruby

Wakame-vdc is written mainly in ruby, so ruby is required for wakame-vdc. Wakame-vdc has script to install ruby, so install ruby with their script.

vgen1 wakame-vdc # make
(if [ -d ruby-build ]; then \
  cd ruby-build; git pull; \
        else \
  git clone https://github.com/sstephenson/ruby-build.git; \
fi)
Cloning into 'ruby-build'...
remote: Counting objects: 2619, done.
remote: Compressing objects: 100% (1461/1461), done.
remote: Total 2619 (delta 1193), reused 2333 (delta 945)
Receiving objects: 100% (2619/2619), 369.87 KiB | 278 KiB/s, done.
Resolving deltas: 100% (1193/1193), done.
(cd /root/wakame-vdc/ruby-build; ./bin/ruby-build 2.0.0-p247 /root/wakame-vdc/ruby)
Downloading ruby-2.0.0-p247.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/c351450a0bed670e0f5ca07da3458a5b
Installing ruby-2.0.0-p247...
Installed ruby-2.0.0-p247 to /root/wakame-vdc/ruby

gem install bundler --no-rdoc --no-ri
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
touch ruby-stamp
touch build-ruby-stamp
vgen1 wakame-vdc #

Add PATH in /etc/profile

Add the above ruby path into PATH in /etc/profile and activate the changes.

export PATH=${PATH}:/root/wakame-vdc/ruby/bin/

Install Gem Package

gem (officialy called rubygem) is a packaging system for ruby. Wakame-vdc requires several packages so install these packages as follows:

vgen1 wakame-vdc # ./ruby/bin/gem install reek roodi flog flay yard 
(略)

Install Bundler Package

Bundler is a ruby package manager on application level and it is used in Wakame-vdc. The following commands install required packages for each of Wakame-vdc's processes.

vgen1 wakame-vdc # for i in `find . -name "Gemfile"` ; do pushd `dirname $i`;  /root/wakame-vdc/ruby/bin/bundle install; popd; done
(snip)

Add/Modify Configuration Files

Copy configuration files from template.

vgen1 wakame-vdc # cd ./dcmgr/config/
vgen1 config # cp -f dcmgr_gui.yml.example dcmgr_gui.yml
vgen1 config # cp -f database.yml.example database.yml
vgen1 config # cp -f load_balancer.yml.example load_balancer.yml
vgen1 config # cp -f instance_spec.yml.example instance_spec.yml
vgen1 config # cp -f load_balancer_spec.yml.example load_balancer_spec.yml
vgen1 config # cp -f dcmgr.conf.example /etc/wakame-vdc/dcmgr.conf
vgen1 config # cp -f snapshot_repository.yml.example /etc/wakame-vdc/snapshot_repository.yml
vgen1 config # cp -f nsa.conf.example /etc/wakame-vdc/nsa.conf
vgen1 config # cp -f sta.conf.example /etc/wakame-vdc/sta.conf
vgen1 config # cp -f hva.conf.example /etc/wakame-vdc/hva.conf

For the frontend process, copy following configuration.

vgen1 wakame-vdc # cd ./frontend/admin/config
vgen1 config # cp admin.yml.example admin.yml

For the hva process.

vgen1 dcmgr # mkdir /var/lib/wakame-vdc
vgen1 dcmgr # mkdir /var/lib/wakame-vdc/instances
vgen1 dcmgr # mkdir /var/lib/wakame-vdc/instances/tmp

Wakame-vdc requires tmp and tmp/images directory, so let's make them.

vgen1 wakame-vdc # mkdir tmp
vgen1 wakame-vdc # mkdir tmp/images

Copy the following configuration and save it as tmp/apache-proxy.conf.

# tmp/apache-proxy.conf
# Minimal apache configuration for image storage.
# Gerenated from apache-proxy.conf.tmpl SHELL variable template.
Listen *:8080
User apache
Group apache

ServerRoot /usr/lib64/apache2
DocumentRoot /var/www/html

LoadModule mime_module modules/mod_mime.so
LoadModule dir_module modules/mod_dir.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule alias_module modules/mod_alias.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<IfModule prefork.c>
PidFile /dev/null
</IfModule>

TypesConfig /etc/mime.types
DefaultType None
AddDefaultCharset utf-8

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "|/bin/cat" common
ErrorLog "|/bin/cat"
LogLevel info
</IfModule>

DirectoryIndex index.html

<Directory />
  AllowOverride None
</Directory>

<Directory ${VDC_ROOT}/tmp>
  AllowOverride All
  Options FollowSymLinks
  #Order deny,allow
  Allow from all
</Directory>

DavLockDB ${VDC_ROOT}/tmp/images/davlock
Alias /images ${VDC_ROOT}/tmp/images
<Location /images>
  DAV on
  Options All
</Location>

Modify tests/vdc.sh

tests/vdc.sh is a script to set up a Wakame-vdc environment on one machine. It's mainly targetted to CentOS/RedHat Linux, so a minor change is required for Gentoo Linux. Apply the change as follows.

wakame_vdc_p1.diff

diff --git a/dcmgr/vendor/cache/bit-struct-0.13.7.gem b/dcmgr/vendor/cache/bit-struct-0.13.7.gem
deleted file mode 100644
index 0078e1c..0000000
Binary files a/dcmgr/vendor/cache/bit-struct-0.13.7.gem and /dev/null differ
diff --git a/tests/vdc.sh b/tests/vdc.sh
index fc05d13..155aa0c 100755
--- a/tests/vdc.sh
+++ b/tests/vdc.sh
@@ -34,10 +34,10 @@ function cleanup {
     killall dnsmasq
   } || :

-  /sbin/iscsiadm -m node -u
+  /usr/sbin/iscsiadm -m node -u
   ps -ef | egrep '[t]gtd' -q && {
     /usr/sbin/tgt-admin --dump | grep ^\<target | awk '{print $2}' | sed 's,>$,,' | while read iqn; do echo ... ${iqn}; /usr/sbin/tgt-admin --delete ${iqn}; done
-    initctl stop tgt
+    /etc/init.d/tgtd stop
   } || :

   ps -ef | egrep 'bin/[k]vm' -q && {
@@ -84,11 +84,11 @@ function cleanup {
   rm -rf ${tmp_path}/volumes/vol-* ${tmp_path}/snap/* ${tmp_path}/instances/i-*

   # force reset and restart rabbitmq
-  /etc/init.d/rabbitmq-server status && /etc/init.d/rabbitmq-server stop
+  /etc/init.d/rabbitmq status && /etc/init.d/rabbitmq stop
   [[ -f /var/lib/rabbitmq/mnesia/ ]] && rm -rf /var/lib/rabbitmq/mnesia/
-  /etc/init.d/rabbitmq-server start
+  /etc/init.d/rabbitmq start

-  (initctl status tgt | grep stop) && initctl start tgt
+  (/etc/init.d/tgtd status | grep stop) && /etc/init.d/tgtd start

   set -e
 }
@@ -134,7 +134,7 @@ function run_standalone() {
   screen_it metadata  "cd ./dcmgr; bundle exec unicorn -p ${metadata_port} -o ${metadata_bind} ./config-metadata.ru 2>&1 | tee ${tmp_path}/vdc-metadata.log"
   screen_it api       "cd ./dcmgr; bundle exec unicorn -p ${api_port} -o ${api_bind} ./config-dcmgr.ru 2>&1 | tee ${tmp_path}/vdc-dcmgr.log"
   screen_it auth      "cd ./frontend/dcmgr_gui; bundle exec unicorn -p ${auth_port} -o ${auth_bind} ./app/api/config.ru 2>&1 | tee ${tmp_path}/vdc-auth.log"
-  screen_it proxy     "${abs_path}/builder/conf/hup2term.sh /usr/sbin/httpd -X -f ${tmp_path}/apache-proxy.conf"
+  screen_it proxy     "${abs_path}/builder/conf/hup2term.sh /usr/sbin/apache2 -X -f ${tmp_path}/apache-proxy.conf"
   screen_it webui     "cd ./frontend/dcmgr_gui; bundle exec unicorn -p ${webui_port} -o ${webui_bind} ./config.ru 2>&1 | tee ${tmp_path}/vdc-webui.log"
   screen_it sta       "cd ./dcmgr; ./bin/sta -i ${host_node_id} 2>&1 | tee ${tmp_path}/vdc-sta.log"
   screen_it admin     "cd ./frontend/admin; bundle exec unicorn -p ${admin_port} -o ${admin_bind} ./config.ru 2>&1 | tee ${tmp_path}/vdc-admin.log"
diff --git a/tests/vdc.sh.d/config.env b/tests/vdc.sh.d/config.env
index 4c25398..bf490d0 100644
--- a/tests/vdc.sh.d/config.env
+++ b/tests/vdc.sh.d/config.env
@@ -6,7 +6,7 @@ dcmgr_gui_dbname="wakame_dcmgr_gui"

 hypervisor=${hypervisor:-'openvz'}

-ipaddr=$(/sbin/ip route get 8.8.8.8 | head -1 | awk '{print $7}')
+ipaddr=$(/bin/ip route get 8.8.8.8 | head -1 | awk '{print $7}')

 account_id=a-shpoolxx

@@ -29,8 +29,8 @@ proxy_port=8080
 proxy_bind=127.0.0.1

 # networks table
-ipv4_gw="${ipv4_gw:-$(/sbin/ip route get 8.8.8.8 | head -1 | awk '{print $3}')}"
-prefix_len="${prefix_len:-$(/sbin/ip route show | awk '$9 == ip { sub(/.*\//, "", $1); print $1; }' ip=$ipaddr)}"
+ipv4_gw="${ipv4_gw:-$(/bin/ip route get 8.8.8.8 | head -1 | awk '{print $3}')}"
+prefix_len="${prefix_len:-$(/bin/ip route show | awk '$9 == ip { sub(/.*\//, "", $1); print $1; }' ip=$ipaddr)}"

 dns_server=${dns_server:-${ipaddr}}
 dhcp_server=${dhcp_server:-${ipaddr}}
diff --git a/tests/vdc.sh.d/demodata.sh b/tests/vdc.sh.d/demodata.sh
index 429ec5f..9e723b5 100755
--- a/tests/vdc.sh.d/demodata.sh
+++ b/tests/vdc.sh.d/demodata.sh
@@ -36,7 +36,7 @@ hypervisor=${hypervisor:?"hypervisor needs to be set"}

 # networks table
 ipv4_gw=${ipv4_gw:?"ipv4_gw needs to be set"}
-prefix_len="${prefix_len:-$(/sbin/ip route show | awk '$9 == ip { sub(/.*\//, "", $1); print $1; }' ip=$ipaddr)}"
+prefix_len="${prefix_len:-$(/bin/ip route show | awk '$9 == ip { sub(/.*\//, "", $1); print $1; }' ip=$ipaddr)}"

 dns_server=${dns_server:-${ipaddr}}
 dhcp_server=${dhcp_server:-${ipaddr}}

Copy above diff and save it like 'wakame_vdc_p1.diff' and apply it.

vgen1 wakame-vdc # patch -p1 < ../wakame-vdc-work/wakame_vdc_p1.diff

Run Wakame-vdc!

With the above changes, this section tries to run Wakame-vdc!

Invoke tests/vdc.sh

tests/vdc.sh establishes a demo environment and runs several daemons. Let's run tests/vdc.sh with PATH environment changes. Sometimes tests/vdc.sh fails to start/restart rabbitmq, please run it manually if it fails.

At the first time to run tests/vdc.sh, tests/vdc.sh downloads some demo VM images so it takes several minutes/hours. Please wait...

vgen1 wakame-vdc # export PATH=${PATH}:/root/wakame-vdc/ruby/bin
gen1 wakame-vdc # ./tests/vdc.sh
(snip)

The temporally download files are in "/var/tmp/__parallel-curl.sh/", so if you want to, you can keep an eye on the progress in that directory.

After downloading the demo environment and setting it up, tests/vdc.sh uses GNU screen to run several processes in single terminal. This GNU screen configures "escape ^z^z", so verify that all processes is in work by "+z" -> "n" key combination.

Hey, Let's See Wakame-vdc!

Open the URL "http://:9000/". If you see the following page, it's working! You can log into this demo environment with User/Pass = demo/demo. Wakame-vdc top page screenshot

Closing

This article introduces 'how to install Wakame-vdc in Gentoo Linux.' It does not include other topics, such as 'how to use it' and 'how to configure it'. Those might be taken care of in the future.

Happy Hacking!