So you got PhotonOS running in your DC! Awesome. Now you’ve been playing around with Cloud Native Apps, and came across habitat and want to give it a shot. Here’s my notes on how I got a habitat .hart package, as a docker container, running in a Photon end point.

I’m going to use my habitat-jenkins as the demo.

First go ahead and clone the repo and build the .hart locally in your hab studio :

$ git clone https://github.com/jjasghar/habitat-jenkins $ cd habitat-jenkins $ hab studio enter [ 1][default:/src:0]# build [ 2][default:/src:0]# hab start YOURORIGIN/jenkins-war # verify everything comes up [ 3][default:/src:0]# hab pkg export docker YOURORIGIN/jenkins-war # export to a container [ 4][default:/src:0]# logout # leave the studio $ docker run -p 8080:8080 -it YOURORIGIN/jenkins-war:latest # run container

Now lets get the container over to the PhotonOS box:

$ docker save jjasghar/jenkins-war:latest > jenkins.tar $ scp jenkins.tar root@PHOTONHOST://root/ # this can be where ever, but demowise... $ ssh root@PHOTONHOST root@PHOTONHOST [ ~ ] # docker load < jenkins.tar de4244ee79bb: Loading layer [==================================================>] 431.6 MB/431.6 MB Loaded image: YOURORIGIN/jenkins-war:latest root@PHOTONHOST [ ~ ] # logout

Ok, lets verify everything is what we expect.

$ export DOCKER_HOST = tcp://PHOTONHOST:2375 $ docker images --all REPOSITORY TAG IMAGE ID CREATED SIZE YOURORIGIN/jeknins-war latest 1a29c0686c54 Less than a second ago 427 MB [ -- snip -- ] $ docker run -p 8080:8080 -it YOURORIGIN/jenkins-war:latest hab-sup ( MR ) : Butterfly Member ID ad83fdf99b7d4a6fa719c60fedb2fa3f hab-sup ( SR ) : Adding jjasghar/jenkins-war/2.9/20170410195441 hab-sup ( MR ) : Starting butterfly on 0.0.0.0:9638 hab-sup ( MR ) : Starting http-gateway on 0.0.0.0:9631 hab-sup ( SC ) : Updated config.xml 14987bc61b9df77b5ff24736af6c1b6b3301240bef151cb85c0057c29ee02500 jenkins-war.default ( SR ) : Initializing jenkins-war.default ( SV ) : Starting process as user = hab, group = hab jenkins-war.default ( O ) : + hab pkg path core/jre8 jenkins-war.default ( O ) : + export JAVA_HOME = /hab/pkgs/core/jre8/8u111/20161214012044 jenkins-war.default ( O ) : + export JENKINS_CONFIG = /hab/svc/jenkins-war/config jenkins-war.default ( O ) : + export JENKINS_HOME = /hab/svc/jenkins-war/data jenkins-war.default ( O ) : + hab pkg path core/gcc-libs jenkins-war.default ( O ) : + LD_LIBRARY_PATH = /hab/pkgs/core/gcc-libs/5.2.0/20161208223920/lib [ -- snip -- ] jenkins-war.default ( O ) : Apr 10, 2017 9:41:31 PM hudson.WebAppMain $3 run jenkins-war.default ( O ) : INFO: Jenkins is fully up and running

After this, you can run something like: