summaryrefslogtreecommitdiffstats
path: root/fuel/build/f_odl_docker/puppet/modules/opnfv
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@ericsson.com>2015-03-24 01:23:32 -0400
committerDaniel Smith <daniel.smith@ericsson.com>2015-03-24 07:42:27 -0400
commita5a094a199226f312e795c3019c5793094e5378e (patch)
tree0dca8f818af549f096c93814c420e7e584246935 /fuel/build/f_odl_docker/puppet/modules/opnfv
parent97e758182bf69a616db216a43636d96f2c776770 (diff)
TOPIC: ODL DOCKER
AUTHOR: DANIEL SMITH *** PLEASE MERGE ** UPDATED TO REFLECT INPUT FRMO J. BJUREL - fixed whitespaces - fixed location of .erb file (they should have been in templates - the directory was there just int he wrong spot) - removed opcheck.pp from common opnfv class - Removed Debug from fuel/build/Makefile :) UPDATE: Input from S. Berg and F. Bockners incorporated. Merge required before we can refactor to common puppet manifest directory This patchset delivers the folowing functionality: - implementation of the common/opnfv-puppet structure / move of .pp files and update of f_odl_docker to build / source from there - creation of f_odl_doc subclass - fetch of latest stable release of ODL - fetch of latest docker binary release (TODO: this will be changed in next patchset push) - build of docker container with all needed libs and port exposure for DLUX and OVSDB/ODL with Openstack Integration (OVS Manager) - deployment of both the target odl docker image as well as the docker runtime binary to the control nodes via puppet script. GENERATES: - docker-latest - binary of docker for use on control node - odl_docker_image.tar - a docker container with a ODL controller running DLUX and OVSDB ENABLE / DISABLE: - Comment/Un-comment "SUBDIRS += f_odl_doc in base (fuel/build/) Makefile Breakdown of Update / Edits per File: ===================================== fuel/build/Makefile - Modified include to capture the newly created f_odl_doc directory fuel/build/f_odl_docker/Makefile - Fetches libraries and produces two outputs: docker-latest - binary of docker (actually lxc-docker cause ODL Container is running 12.04 (precise) libraries - i.e java7, tz 12.04, etc) odl_docker_image.tar - this is a docker image defined in ./dockefile/Dockerfile and contains the ODL distro + setup and deployment scripts for runtime on the target control node. fuel/build/f_odl_docker/dockerfile/Dockerfile - This Dockerfile defined the packages for use in the Docker Container that will run ODL with DLUX and OVSDB submodules. It also defines the ports to be exposed to the HOST OS (and thus as well through docker the ODL Controller exists in a private, but routable via but the fuel (10.20.0.0/16) and the tenants public network since docker handles the mapping (see the docker run command in the start_odl_docker.sh script) fuel/build/f_odl_docker/dockerfile/check_feature.sh - Simple expect script that starts up a client and checks that the features are installed (used during visual demo only) TODO - Replace with API call to ODL KARAF to install features (LOOKUP - Dont know how to address Karaf programatically - LOOKUP) fuel/build/f_odl_docker/dockerfile/speak.sh - Expect script called by odl_start_docker.sh once karaf is up to install the features that we need (runtime inside container script) called via ENTRYPOINT in Dockerfile at runtime on control node. fuel/build/f_odl_docker/dockerfile/start_odl_docker.sh - This is the CMD/ENTRYPOINT defined in docker and is what is called from the controller when you start the container (note: This runs inside the conatiner), not to be confused with staring the actual container on the control node). This script fires up Karaf first time, loads DLUX and OVSDB modules and monitors that the container is up. The container itself is started on the control node via /opt/opnfv/start_odl_container.sh which includes the syntax for the port mapping (RANDOM or 1:1). TODO - integrate into controller monitor script to ensure better handling (stop, start, monitor) of docker processes remove expect helper scripts and replace with API/JSON or some other appropriate method to KARAF fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_doc.pp - This puppet manifest defined where the docker binary and docker image should be placed on the target control node. /opt/opnfv/start_odl_container.sh will install docker binary package (if necessary) and load ODL docker image into docker, start the image. This file just ensures placement in /opt/opnfv/odl_docker fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp (MODIFICATION): - Removed previous includes and updated to have only f_odl_doc added fuel/build/f_odl_doc/scripts/start_odl_container.sh - this is the control script that will start the docker container (to be run on the control node), this is deployed this is deployed to /opt/opnfv on the control node via odl_doc puppet manifest file. JIRA: DEPRECATED: Deleted files are no longer needed due to new implementation of ODL. Change-Id: I26c13cc468a2aba18af78b7a3c78a719033f03e0 Signed-off-by: Daniel Smith <daniel.smith@ericsson.com>
Diffstat (limited to 'fuel/build/f_odl_docker/puppet/modules/opnfv')
-rw-r--r--fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp40
-rwxr-xr-xfuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh88
2 files changed, 128 insertions, 0 deletions
diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp
new file mode 100644
index 0000000..ae24460
--- /dev/null
+++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp
@@ -0,0 +1,40 @@
+class opnfv::odl_docker
+{
+ case $::fuel_settings['role'] {
+ /controller/: {
+
+ file { "/opt":
+ ensure => "directory",
+ }
+
+ file { "/opt/opnfv":
+ ensure => "directory",
+ owner => "root",
+ group => "root",
+ mode => 777,
+ }
+
+ file { "/opt/opnfv/odl":
+ ensure => "directory",
+ }
+
+ file { "/opt/opnfv/odl/odl_docker_image.tar":
+ ensure => present,
+ source => "/etc/puppet/modules/opnfv/odl_docker/odl_docker_image.tar",
+ mode => 750,
+ }
+
+ file { "/opt/opnfv/odl/docker-latest":
+ ensure => present,
+ source => "/etc/puppet/modules/opnfv/odl_docker/docker-latest",
+ mode => 750,
+ }
+
+ file { "/opt/opnfv/odl/start_odl_conatiner.sh":
+ ensure => present,
+ source => "/etc/puppet/modules/opnfv/scripts/start_odl_container.sh",
+ mode => 750,
+ }
+ }
+ }
+}
diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh
new file mode 100755
index 0000000..0b4fd46
--- /dev/null
+++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+# Ericsson Canada Inc.
+# Authoer: Daniel Smith
+#
+# A helper script to install and setup the ODL docker conatiner on the controller
+#
+#
+# Inputs: odl_docker_image.tar
+#
+# Usage: ./start_odl_docker.sh
+
+# ENVS
+source ~/.bashrc
+source ~/openrc
+
+# VARS
+
+# Switch for Dev mode - uses apt-get on control to cheat and get docker installed locally rather than from puppet source
+
+DEV=1
+
+# Switch for 1:1 port mapping of EXPOSED ports in Docker to the host, if set to 0, then random ports will be used - NOTE: this doesnt work for all web services X port on Host --> Y port in Container,
+# especially for SSL/HTTPS cases. Be aware.
+
+MATCH_PORT=1
+
+LOCALPATH=/opt/opnfv/odl_docker
+DOCKERBINNAME=docker-latest
+DOCKERIMAGENAME=odl_docker_image.tar
+DNS=8.8.8.8
+HOST_IP=`ifconfig br-fw-admin | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'`
+
+
+# Set this to "1" if you want to have your docker container startup into a shell
+
+
+ENABLE_SHELL=1
+
+
+echo " Fetching Docker "
+if [ "$DEV" -eq "1" ];
+# If testing Locally (on a control node) you can set DEV=1 to enable apt-get based install on the control node (not desired target, but good for testing).
+then
+ echo "Dev Mode - Fetching from Internet";
+ echo " this wont work in production builds";
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
+ mkdir -p $LOCALPATH
+ wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O $LOCALPATH/$DOCKERBINNAME
+ wget http://ftp.us.debian.org/debian/pool/main/d/docker.io/docker.io_1.3.3~dfsg1-2_amd64.deb
+ chmod 777 $LOCALPATH/$DOCKERBINNAME
+ echo "done ";
+else
+ echo "Using Binaries delivered from Puppet"
+ echo "Starting Docker in Daemon mode"
+ chmod +x $LOCALPATH/$DOCKERBINNAME
+ $LOCALPATH/$DOCKERBINNAME -d &
+fi
+
+
+# We need to perform some cleanup of the Openstack Environment
+echo "TODO -- This should be automated in the Fuel deployment at some point"
+echo "However, the timing should come after basic tests are running, since this "
+echo " part will remove the subnet router association that is deployed automativally"
+echo " via fuel. Refer to the ODL + Openstack Integration Page "
+
+# Import the ODL container into docker
+
+echo "Importing ODL container into docker"
+$LOCALPATH/$DOCKERBINNAME load -i $LOCALPATH/$DOCKERIMAGENAME
+
+echo " starting up ODL - DLUX and Mapping Ports"
+if [ "$MATCH_PORT" -eq "1" ]
+then
+ echo "Starting up Docker..."
+ docker rm odl_docker
+
+if [ "$ENABLE_SHELL" -eq "1" ];
+then
+ echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)"
+ docker run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel /bin/bash
+else
+ echo "Starting Conatiner in Daemon mode - no shell will be provided and docker attach will not provide shell)"
+ docker run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel
+ echo "should see the process listed here in docker ps -a"
+ docker ps -a;
+ echo "Match Port enabled, you can reach the DLUX login at: "
+ echo "http://$HOST_IP:8181/dlux.index.html"
+fi