Move lcm certificate to lcm folder in OSM helm chart
[osm/devops.git] / packer / README.md
1 # Creation of standard VM images with Packer
2
3 ## Reference
4
5 These Packer templates are derived from the templates for building Vagrant boxes for various OS produced by the [Bento Project](https://github.com/chef/bento), produced under Apache 2 license.
6
7 ## Pre-requirements
8
9 - Hypervisor installed to generate the required type of boxes (e.g. VirtualBox, VMware, Parallels, etc.)
10 - Packer >=1.6.5
11 - Optional:
12   - Vagrant >=2.2
13   - An Openstack cloud available.
14
15 ## How to build images from Packer templates
16
17 Example 1: How to build an OSM box just for the VirtualBox provider:
18
19 ```bash
20 cd packer_templates/osm
21 packer build -only=virtualbox-iso osm-8.0.4-amd64.json
22 ```
23
24 Example 2: How to build an OSM VM with the OpenStack provider:
25
26 ```bash
27 source openrc.sh    # This is only needed the first time
28 jq 'del(."post-processors")' osm-8.0.4-amd64.json > tmp.json
29 packer build -only=openstack tmp.json
30 rm tmp.json
31 ```
32
33 As it can be seen, this type of build needs some additional details and commands, since:
34
35 - We need to source the **OpenStack credentials**, besides **additional environment variables** that are required to pass cloud-dependent parameters to Packer.
36 - We must **rip the `post-processors` part** of the template, since it is likely to be incompatible with the `openstack` builder. This rip can be made easily `jq` but, unfortunately, Packer does not work reliably with piped inputs, so we need to use an intermediate temporary file.
37
38 ## How to test Vagrant boxes produced by Packer
39
40 1. Import the local box into Packer:
41    ```bash
42    cd ../../builds
43    vagrant box add --name osm/osm-rel8 osm-8.0.4.virtualbox.box
44    ```
45 2. Use the example at `vagrant_tests` to test it:
46    ```bash
47    cd ../vagrant_tests/
48    # Edit the box name in `Vagrantfile` as appropriate
49    vagrant up
50    ```
51 3. In case the local image is no longer needed, it can be removed by:
52    ```bash
53    vagrant destroy
54    vagrant box remove osm/osm-rel8
55    ```
56
57 ## How to upload boxes to Vagrant Cloud
58
59 You need to use the [Vagrant web page](https://app.vagrantup.com/boxes/search).
60
61 Here there is a [step-by-step guide](https://blog.ycshao.com/2017/09/16/how-to-upload-vagrant-box-to-vagrant-cloud/) with screenshots.