Difference between revisions of "Honeycomb/Releases/1609/Setting Up Your Dev Environment"

From fd.io
Jump to: navigation, search
(Building Honeycomb)
(Setup settings.xml)
 
(10 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
<pre>
 
<pre>
 
git clone ssh://[username]@gerrit.fd.io:29418/honeycomb
 
git clone ssh://[username]@gerrit.fd.io:29418/honeycomb
 +
cd honeycomb
 +
git checkout stable/1609
 
</pre>
 
</pre>
  
== Building in a vagrant environment ==
+
== Building the code ==
 
+
A vagrant environment has been provided to simplify building Honeycomb.
+
 
+
=== Install The Enviroment ===
+
 
+
You will need a virtual machine and Vagrant software to host and launch the build environment.
+
 
+
==== Install Virtualbox or VMWare ==== 
+
 
+
The default configuration supports VMWare and VirtualBox.  You will need to install *one* of them.
+
 
+
VirtualBox is free.  You can download and install VirtualBox from [https://www.virtualbox.org/wiki/Downloads here].
+
 
+
VMWare runs faster than VirtualBox, but requires purchase. You can acquire [https://www.vmware.com/products/fusion VMWare Fusion (Mac)] or [https://www.vmware.com/products/workstation VMWare Workstation (Windows)]
+
 
+
VMware runs faster than VirtualBox. To use VMware you will need to obtain a VMware plugin for Vagrant. You can learn more about support for VMware from the Vagrant documentation: https://docs.vagrantup.com/v2/vmware/.
+
 
+
==== Install Vagrant software. ====
+
 
+
Install the Vagrant software:
+
https://docs.vagrantup.com/v2/installation/index.html
+
 
+
==== Install vagrant-cachier ====
+
 
+
Optional: To cache apt/yum (for faster Vagrant VM rebuild), install vagrant-cachier.
+
 
+
At the unix command line run:
+
 
+
<pre>$ vagrant plugin install vagrant-cachier</pre>
+
 
+
=== Customize Vagrant  ===
+
The vagrant file included needs to be updated as follows. The file can be found at build-root/vagrant/Vagrantfile
+
 
+
<pre>$ vi ./build-root/vagrant/Vagrantfile</pre>
+
 
+
 
+
==== Change the CPU/Memory config of the VM (Optional) ====
+
You may wish to increase the number of CPU, amount of memory, or otherwise configure the Vagrant VM you're about to create. You can do so after creating the VM, as well.
+
 
+
Depending on which provider you are using, you can edit the appropriate section and set the memory or num of cpus
+
 
+
<syntaxhighlight lang="ruby">
+
  config.vm.provider "virtualbox" do |vb|
+
    vb.memory = "4096"
+
  end
+
  config.vm.provider "vmware_fusion" do |fusion,override|
+
    fusion.vmx["memsize"] = "4096"
+
  end
+
  config.vm.provider "vmware_workstation" do |vws,override|
+
    vws.vmx["memsize"] = "8192"
+
    vws.vmx["numvcpus"] = "4"
+
  end
+
</syntaxhighlight>
+
 
+
==== Configure http proxy (optional) ====
+
When running behind a proxy/firewall, you may need to set http_proxy and https_proxy in the environment. You can use the export command to make the following environmental variables available to child processes:
+
 
+
<pre>$ export http_proxy=http://<proxy-server>:<port>
+
$ export https_proxy=https://<proxy-server>:<port></pre>
+
 
+
Vagrant can do this for you by installing proxyconf:
+
 
+
<pre>$ vagrant plugin install vagrant-proxyconf</pre>
+
 
+
=== Running Vagrant ===
+
 
+
For more information about using Vagrant on a command-line interface (CLI), see: https://docs.vagrantup.com/v2/cli/index.html
+
 
+
=== cd to the vagrant directory ===
+
 
+
In the command-line interface, navigate to the directory that has the pre-configured Vagrantfile. (In the following sample command, <install_dir> is the directory where you unzipped or cloned the Honeycomb software.)
+
 
+
<pre>$ cd <install_dir>/vagrant/</pre>
+
 
+
=== Build the VM with Vagrant ===
+
 
+
By default this will build an Ubuntu 14.0.4 VM.
+
 
+
If you wish to use VMWareFusion as your provider, use:
+
<pre>$ (export VAGRANT_DEFAULT_PROVIDER=vmware_fusion;vagrant up)</pre>
+
 
+
When you first start Vagrant, it is normal for it to run for several minutes, building the VM, and building Honeycomb.
+
 
+
Use the Vagrant up command to cause Vagrant to start. Vagrant uses the Vagrantfile in the current working directory.
+
<pre>$ vagrant up</pre>
+
 
+
 
+
=== Access the shell ===
+
 
+
Use the Vagrant SSH command to access the running Vagrant machine and give you access to a shell.
+
 
+
<pre>$ vagrant ssh</pre>
+
 
+
If you wish to forward X-windows server requests, use this variation:
+
 
+
<pre>$ vagrant ssh -- -X</pre>
+
 
+
Success!
+
 
+
You've set up the basic environment that you need in order to start building the Honeycomb codebase.
+
 
+
 
+
== Building outside the vagrant environment ==
+
  
 
Make sure all the prerequisites are installed.
 
Make sure all the prerequisites are installed.
Line 126: Line 25:
 
=== Building VPP ===
 
=== Building VPP ===
  
Clone VPP according to: https://gerrit.fd.io/r/#/admin/projects/vpp
+
Clone VPP according to: https://gerrit.fd.io/r/#/admin/projects/vpp and checkout to stable/1609 branch
  
 
Dive into VPP's build-root folder:
 
Dive into VPP's build-root folder:
Line 151: Line 50:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd build-vpp-native/vpp-api/java/
 
cd build-vpp-native/vpp-api/java/
mvn install:install-file -Dfile=jvpp-16.09.jar -DgroupId=io.fd.vpp    -DartifactId=jvpp -Dversion=16.09-SNAPSHOT -Dpackaging=jar
+
mvn install:install-file -Dfile=jvpp-registry-16.09.jar -DgroupId=io.fd.vpp    -DartifactId=jvpp-registry -Dversion=16.09 -Dpackaging=jar
 +
mvn install:install-file -Dfile=jvpp-core-16.09.jar -DgroupId=io.fd.vpp    -DartifactId=jvpp-core -Dversion=16.09 -Dpackaging=jar
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 161: Line 61:
  
 
==== Setup settings.xml ====
 
==== Setup settings.xml ====
 
If you wish to build honeycomb outside of the provided vagrant environment.
 
  
 
Put the following in your ~/.m2/settings.xml
 
Put the following in your ~/.m2/settings.xml
Line 283: Line 181:
 
Now Honeycomb can be run with:
 
Now Honeycomb can be run with:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
sudo v3po/karaf/target/assembly/bin/karaf clean
+
sudo sh vpp-integration/minimal-distribution/target/vpp-integration-distribution-1.16.9-SNAPSHOT-hc/vpp-integration-distribution-1.16.9-SNAPSHOT/honeycomb
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For further interactions with Honeycomb, refer to [[Honeycomb/Running Honeycomb]]
+
== Building packages ==
 +
After the code has been built, you can build an RPM or DEB package for honeycomb.
 +
 
 +
=== RPM ===
 +
Export build number variable:
 +
 
 +
  export BUILD_NUMBER=33
 +
 
 +
Run package building script from:
 +
 
 +
  packaging/rpm/rpmbuild.sh 
 +
 
 +
=== DEB ===
 +
Export build number variable:
 +
 
 +
  export BUILD_NUMBER=33
 +
 
 +
Run package building script from:
 +
 
 +
  packaging/deb/debuild.sh

Latest revision as of 12:24, 20 September 2016

Prerequisites

Building Honeycomb project requires:

  • Java 8
  • Maven (version 3.2.5 and above should be fine)
  • Properly set maven settings(displayed below) to access nexus.fd.io

Obtain the honeycomb source code

Make sure you have registered your ssh key with gerrit.

git clone ssh://[username]@gerrit.fd.io:29418/honeycomb
cd honeycomb
git checkout stable/1609

Building the code

Make sure all the prerequisites are installed.

To make sure fresh Honeycomb build is compatible with VPP, building VPP is also required to make sure the same JVpp version is used preventing out-of-sync exceptions. In case only Honeycomb needs to be built, skip Building VPP section.

Building VPP

Clone VPP according to: https://gerrit.fd.io/r/#/admin/projects/vpp and checkout to stable/1609 branch

Dive into VPP's build-root folder:

cd vpp/build-root/

Build VPP:

make distclean && ./bootstrap.sh && make V=0 PLATFORM=vpp TAG=vpp install-deb

Install VPP:

sudo dpkg -i *.deb

Start VPP:

sudo start vpp

Install JVpp into local maven repository to make Honeycomb pick up the same JVpp version

cd build-vpp-native/vpp-api/java/
mvn install:install-file -Dfile=jvpp-registry-16.09.jar -DgroupId=io.fd.vpp     -DartifactId=jvpp-registry -Dversion=16.09 -Dpackaging=jar
mvn install:install-file -Dfile=jvpp-core-16.09.jar -DgroupId=io.fd.vpp     -DartifactId=jvpp-core -Dversion=16.09 -Dpackaging=jar

Now current Vpp is up and running.

Building Honeycomb

Now Honeycomb can be built and it will use latest JVpp produced during VPP build.

Setup settings.xml

Put the following in your ~/.m2/settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=2 tabstop=2: -->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
  <profiles>
    <profile>
      <id>fd.io-release</id>
      <repositories>
        <repository>
          <id>fd.io-mirror</id>
          <name>fd.io-mirror</name>
          <url>https://nexus.fd.io/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>fd.io-mirror</id>
          <name>fd.io-mirror</name>
          <url>https://nexus.fd.io/content/repositories/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
 
    <profile>
      <id>fd.io-snapshots</id>
      <repositories>
        <repository>
          <id>fd.io-snapshot</id>
          <name>fd.io-snapshot</name>
          <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>fd.io-snapshot</id>
          <name>fd.io-snapshot</name>
          <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <id>opendaylight-snapshots</id>
      <repositories>
        <repository>
          <id>opendaylight-snapshot</id>
          <name>opendaylight-snapshot</name>
          <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>opendaylight-shapshot</id>
          <name>opendaylight-snapshot</name>
          <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
 
  <activeProfiles>
    <activeProfile>fd.io-release</activeProfile>
    <activeProfile>fd.io-snapshots</activeProfile>
    <activeProfile>opendaylight-snapshots</activeProfile>
  </activeProfiles>
</settings>

Building Honeycomb

cd honeycomb/
mvn clean install

Now Honeycomb can be run with:

sudo sh vpp-integration/minimal-distribution/target/vpp-integration-distribution-1.16.9-SNAPSHOT-hc/vpp-integration-distribution-1.16.9-SNAPSHOT/honeycomb

Building packages

After the code has been built, you can build an RPM or DEB package for honeycomb.

RPM

Export build number variable:

 export BUILD_NUMBER=33

Run package building script from:

 packaging/rpm/rpmbuild.sh  

DEB

Export build number variable:

 export BUILD_NUMBER=33

Run package building script from:

 packaging/deb/debuild.sh