Develop RackHD with pre-build Vagrant

Target Audient

  1. Who will runs RackHD to manage virtual nodes (InfraSIMTM) in a single OS
  2. Who will customize and run RackHD from source code

Get a Vagrant Box

  1. VagrantFile

    1. first of all , you always need a vagrantFile to run vagrant. we provide a sample in RackHD/RackHD/example folder.

      git clone https://github.com/RackHD/RackHD.git
      cd RackHD/example
    2. Edit the "Vagrantfile" in it, change the default  target.vm.box from "rackhd/rackhd"  to "rackhd/rackhd-dev"    (lightbulb)( this box is build by internal Jenkins , triggered when needed.)

      vi Vagrantfile


    3. then start the boxes  ( one VM is RackHD hosted OS(based OS is Ubuntu 14.04), another VM is InfraSIM/quanta_d51)

      vagrant up 

      then it will show message like below, then by patient while downloading

      ==> dev: Loading metadata for box 'rackhd/rackhd-dev'
      dev: URL: https://atlas.hashicorp.com/rackhd/rackhd-dev
      ==> dev: Adding box 'rackhd/rackhd-dev' (v0.01.23) for provider: virtualbox
      dev: Downloading: https://atlas.hashicorp.com/rackhd/boxes/rackhd-dev/versio ns/0.01.23/providers/virtualbox.box
      dev: Progress: 12% (Rate: 607k/s, Estimated time remaining: 0:36:15)
  2. clone RackHD

    1. find the script to help you (install_src.sh

      this script will  :

       (1) download src code 

       (2) npm install

       (3) download static images

       (4) link the local on-core/on-tasks to dependent repos' node_modules

      if PR https://github.com/RackHD/RackHD/pull/588 merged, you can directly find the script install_src.sh in RackHD/example .
      else , you can download it from https://github.com/panpan0000/RackHD/blob/InstallSRC/example/install_src.sh


    2. create working directory, where the RackHD code are cloned to (( the "~/src" folder is recommended, because the build-in rackhd-pm2-config.yml in vagrant's home directory points the source code in ~/src

      mkdir ~/src
    3. use script , to clone the code into folder "~/src" 

       if you want to use release code, like release/1.0.0 tag. run as  ./install_src.sh ~/src release/1.0.0

      ./install_src.sh  ~/src


    4. Do code customization or modification, then don't forget to re-build for what you changes ("npm install" in corresponding repos)

      blablablabla.....
    5. Start RackHD

     if your working directory is NOT ~/src as default, please do modify the "rackhd-pm2-config.yml" to update the code location.

sudo pm2 start rackhd-pm2-config.yml
f. then you will see RackHD running 
---------------------------------------------------------------------------------------------
| App name     | id | mode | pid  | status | restart | uptime | cpu  | mem       | watching |
----------------------------------------------------------------------------------------------
| on-dhcp      | 2  | fork | 4584 | online | 0       | 1s     | 66%  | 44.2 MB   | disabled |
| on-http      | 1  | fork | 4572 | online | 0       | 1s     | 67%  | 47.9 MB   | disabled |
| on-syslog    | 3  | fork | 4591 | online | 0       | 1s     | 87%  | 52.4 MB   | disabled |
| on-taskgraph | 0  | fork | 4566 | online | 0       | 1s     | 310% | 48.3 MB   | disabled |
| on-tftp      | 4  | fork | 4617 | online | 0       | 1s     | 31%  | 27.9 MB   | disabled |
--------------------|------|------|--------|------------------|------|----------------------|