3 [Packer][1] is a tool for automatically creating VM and container images,
4 configuring them and post-processing them into standard output formats.
6 We build OpenDaylight's Vagrant base boxes and Docker images via Packer.
10 You'll need to [install Packer][2], of course.
12 OpenDaylight's Packer configuration is divided into build-specific variables,
13 output-specific templates and a set of shared provisioning scripts. To do a
14 specific build, combine the template for the desired output artifact type with
15 a variable file. For example, to build a LibVirt-based Vagrant base box with
16 ODL Beryllium and CentOS 7.2.1511:
19 packer build -var-file=vars/opendaylight-4.0.0.json -var-file=vars/centos-7.2.1511.json templates/libvirt.json
22 To build the same box with VirtualBox as the virtualization provider:
25 packer build -var-file=vars/opendaylight-4.0.0.json -var-file=vars/centos-7.2.1511.json templates/virtualbox.json
28 To build a Beryllium SR1 Docker container:
31 packer build -var-file=vars/opendaylight-4.1.0.json -var-file=vars/centos-7.2.1511.json templates/docker.json
34 Note that LibVirt, VirtualBox and Docker will need to work on your local system
35 to run Packer builds that use them. You may need to disable LibVirt/VBox when
38 From a high level, the builds:
40 - Download and verify the CentOS ISO specified in the variables file.
41 - Boot the ISO and do low-level configuration via a Kickstart template.
42 - Run a set of shell scripts, listed in the template's shell provisioner
43 section, to do any configuration required by the builder (VBox, Docker),
44 other provisioners (Ansible) or post-processors (Vagrant, Docker).
45 - Install and configure the version of OpenDaylight specified in the variables
46 file using the [ansible-opendaylight role][3].
47 - Export, compress and package the VM as a Vagrant base box or Docker image.
51 This section documents how to run OpenDaylight's Vagrant base boxes and Docker
56 This section documents how to run OpenDaylight Vagrant base boxes and Docker
57 images. That have been built by the Integration/Packaging project and pushed
58 to hosting services for easy consumption.
60 #### Vagrant Base Boxes
62 OpenDaylight uses the official Atlas Vagrant base box hosting service.
64 The [opendaylight/odl][4] repository contains built versions of every box
67 To use the latest version, simply specify `opendaylight/odl` as the base
68 box in your Vagrantfile.
71 $ vagrant init -m opendaylight/odl
73 Vagrant.configure(2) do |config|
74 config.vm.box = "opendaylight/odl"
78 Boot the box (will download from Atlas if not cached locally) and connect:
85 OpenDaylight will already be installed and running:
88 $ sudo systemctl is-active opendaylight
92 To connect to the Karaf shell:
95 $ ssh -p 8101 karaf@localhost
99 To use a version other than latest, specify it in your Vagrantfile.
102 Vagrant.configure(2) do |config|
103 config.vm.box = "opendaylight/odl"
104 config.vm.box_version = "= 3.4.0"
110 Up-to-date Docker images can be pulled from [OpenDaylight's DockerHub][5].
112 Download the latest image and start a container with ODL running:
115 $ docker run -ti opendaylight/odl /opt/opendaylight/bin/karaf
118 To run a specific version, include a tag:
121 $ docker run -ti opendaylight/odl:4.1.0 /opt/opendaylight/bin/karaf
126 This section documents how to run locally-built OpenDaylight Vagrant base boxes
127 and Docker images. Users not interested in building their own artifacts should
128 see the Pre-Built section above.
130 #### Vagrant Base Boxes
132 The `vagrant` post-processor outputs built .box files into the current
137 Build 'qemu' finished.
139 ==> Builds finished. The artifacts of successful builds are:
140 --> qemu: 'qemu' provider box: opendaylight-4.1.0-centos-7.2.1511-libvirt.box
142 opendaylight-4.1.0-centos-7.2.1511-libvirt.box
145 Import the local box into Vagrant with:
148 $ vagrant box add --name "odl" opendaylight-4.1.0-centos-1511.box --force
149 ==> box: Adding box 'odl' (v0) for provider:
150 box: Downloading: file:///home/daniel/packaging/packer/opendaylight-4.1.0-centos-1511.box
151 ==> box: Successfully added box 'odl' (v0) for 'virtualbox'!
154 To connect to your new box, you'll need a trivial Vagrantfile:
157 $ vagrant init -m odl
159 Vagrant.configure(2) do |config|
160 config.vm.box = "odl"
164 Boot the box and connect:
171 OpenDaylight will already be installed and running:
174 $ sudo systemctl is-active opendaylight
178 To connect to the Karaf shell:
181 $ ssh -p 8101 karaf@localhost
187 The `docker-tag` post-processor imports the built Docker image into your local
192 REPOSITORY TAG IMAGE ID CREATED SIZE
193 opendaylight/odl 4.1.0 8c9e8c24081e 2 days ago 1.408 GB
196 Use `docker run` to start a container. Point it at the Karaf executable
197 to run OpenDaylight as the container's process.
200 $ docker run -ti opendaylight/odl:4.1.0 /opt/opendaylight/bin/karaf
203 [1]: https://www.packer.io/
205 [2]: https://www.packer.io/intro/getting-started/setup.html
207 [3]: https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging/ansible-opendaylight.git
209 [4]: https://atlas.hashicorp.com/opendaylight/boxes/odl
211 [5]: https://hub.docker.com/r/opendaylight/