Saturday, June 7, 2014

Openshift Origin Vagrant Notes

Here is some notes that I took while I was trying to follow "OpenShift Origin Vagrant Deployment Guide".


  • vagrant module install vagrant-openshift doesn't work in my setup (Vagrant 1.6.1 windows), so I tried vagrant plugin install vagrant-openshift
  • vagrant origin-local-checkout doesn't work as well. So I help myself to check using vagrant origin-local-checkout -h . It seems that the guide must be updated :
Usage: vagrant origin-local-checkout [options]
    -b, --branch [branch_name]       Check out the specified branch. Default is
'master'.
    -u, --user [username]            Your GitHub username. If provided, Vagrant
will attempt to clone your forks of the Origin repos. If not provided, or if the
 forks cannot be found, Vagrant will clone read-only copies of the OpenShift rep
os.
    -r, --replace                    Delete existing cloned dirs first. Default
is to skip repos that are already cloned.
    -h, --help                       Show this message


      command "origin-local-checkout" do
        require_relative "command/local_repo_setup"
        Commands::LocalRepoSetup
      end
  • The Local Path for vagrant-openshift plugin in my Win 8 system is at Local path is C:\Users\\.vagrant.d\gems\gem\vagrant-openshift-1.0.5\lib\vagrant-openshift\command\local_repo_setup.rb. 
  • origin-local-checkout command (and most other origin commands) needs git available in the PATH, but there is no error message telling you that it is the case when you have no git in the PATH. Silent errors are terrible for the novice developers.
  • If somehow you end up with yum complaining of database problem, the cure is yum clean dbcache.
  • Build process takes a long time in my machine, maybe because of the slow standard laptop HDD. Timeouts happened in several forms :
    • lost network connectivity, because the laptop switched to standby, and when it returned to normal, the VirtualBox VM became disconnected from the internet. The cure is quickly type sudo service network restart from additional ssh connection and prayed that the build process haven't reached to the point that requires internet connection.
    • timeout errors such as 
Timeout occurred while running ssh/sudo command: cd /data/src/github.com/openshift/builder; scl enable ruby193 "rake update_packages"

    • To increase timeout setting, change the timeout in the corresponding vagrant plugin source code, such as build_sources.rb. The local path in my sistem is  C:\Users\\.vagrant.d\gems\gem\vagrant-openshift-1.0.5\lib\vagrant-openshift\action\build_sources.rb.

sudo(env[:machine], "cd #{Constants.build_dir + "builder"}; #{scl_wrapper(is_fedora,'rake update_packages')}", {timeout: 60*30})
  • If service named complains with error message like zone example.com/IN: NS 'example.com' has no address records (A or AAAA), maybe its because vm hostname is the same with cloud domain. Set the vm hostname in Vagrantfile to something like oshift1.example.com or broker.example.com, remove /var/named/dynamic/$domain.db file and the entry in /etc/named.conf referring to it. then execute vagrant sync --clean or run puppet apply --verbose configure_origin.pp in the VM.