af4edffcd369413effca328fdef1fd50d66bb1a9
[dcaegen2/deployments.git] / bootstrap / README-docker.md
1 ## Dockerized bootstrap for Cloudify Manager and Consul cluster
2
3 1. Preparations
4 a) Add a public key to openStack, note its name (we will use KEYNAME as example for below).  Save the private key (we will use KAYPATH as its path example), make sure it's permission is globally readable.
5 b) Load the folowing base VM images to OpenStack:  a CentOS 7 base image and a Ubuntu 16.04 base image. 
6 c) Obatin the resource IDs/UUIDs for resources needed by the inputs.yaml file, as explained belowi, from OpenStack.
7 d) DCAEGEN2 boot straping assumes that VMs are assigned private IP addresses from a network.  Each VM can also be assigned a floating public IP address from another network.
8
9
10 2. On dev machine, edit an inputs.yaml file at INPUTSYAMLPATH
11 ```
12 1       centos7image_id: '7c8d7524-de1f-490b-8418-db294bfa2d65'
13 2       ubuntu1604image_id: '4b09c18b-d69e-4ba8-a1bd-562cab91ff20'
14 3       flavor_id: '4'
15 4       security_group: '55a11193-6559-4f6c-b2d2-0119a9817062'
16 5       public_net: 'admin_floating_228_net'
17 6       private_net: 'onap-f-net'
18 7       openstack:
19 8         username: 'MY_LOGIN'
20 9         password: 'MY_PASSWORD'
21 10        tenant_name: 'TENANT_NAME'
22 11        auth_url: 'KEYSTONE_AUTH_URL'
23 12        region: 'RegionOne'
24 13      keypair: 'KEYNME'
25 14      key_filename: '/opt/dcae/key'
26 15      location_prefix: 'onapr1'
27 16      location_domain: 'onap-f.onap.homer.att.com'
28 17      codesource_url: 'https://nexus01.research.att.com:8443/repository'
29 18      codesource_version: 'solutioning01-mte2'
30 ```
31 Here is a line-by-line explanation of the arameters
32 1       UUID of the OpenStack's CentOD 7 VM image
33 2       UUID of the OpenStack's Ubuntu 16.04 VM image
34 3       ID of the OpenStack's VM flavor to be used by DCAEGEN2 VMs
35 4       UUID of the OpenStack's security group to be used for DCAEGEN2 VMs
36 5       The name of the OpenStack network where public IP addresses are allocated from
37 6       The name of the OpenStack network where private IP addresses are allocated from
38 7       Group header for OpenStack Keystone parameters
39 8       User name
40 9       Password
41 10      Name of the OpenStack tenant/project where DCAEGEN2 VMs are deployed
42 11      Openstack authentication API URL, for example 'https://horizon.playground.onap.org:5000/v2.0'
43 12      Name of the OpenStack region where DCAEGEN2 VMs are deployed, for example 'RegionOne'
44 13      Name of the public key uploaded to OpenStack in the Prepration step
45 14      Path to the private key within the conatiner (!! Do not change!!)
46 15      Prefix (location code) of all DCAEGEN2 VMs
47 16      Domain name of the OpenStack tenant 'onapr1.playground.onap.org'
48 17      Location of the raw artifact repo hosting additional boot scripts called by DCAEGEN2 VMs' cloud-init, for example: 
49         'https://nexus.onap.org/service/local/repositories/raw/content'
50 18      Path to the boot scripts within the raw artifact repo, for example: 'org.onap.dcaegen2.deployments.scripts/releases/' 
51
52
53 3. Pull and run the docker conatiner
54 ```
55 docker pull nexus3.onap.org:10003/onap/org.onap.dcaegen2.deployments.bootstrap:1.0
56
57
58 docker run -d -v /home/ubuntu/JFLucasBootStrap/utils/platform_base_installation/key:/opt/app/installer/config/key -v /home/ubuntu/JFLucasBootStrap/utils/platform_base_installation/inputs.yaml:/opt/app/installer/config/inputs.yaml -e "LOCATION=dg2" bootstrap
59
60 docker run -d -v KEYPATH:/opt/app/installer/config/key -v INPUTSYAMLPATH:/opt/app/installer/config/inputs.yaml -e "LOCATION=dg2" nexus3.onap.org:10003/onap/org.onap.dcaegen2.deployments.bootstrap:1.0
61
62 ```
63
64
65 R
66 `expand.sh` expands the blueprints and the installer script so they
67 point to the repo where the necessary artifacts (plugins, type files)
68 are store.
69
70 `docker build -t bootstrap .`  builds the image
71
72 `docker run -d -v /path/to/worldreadable_private_key:/opt/app/installer/config/key -v /path/to/inputs_file:/opt/app/installer/config/inputs.yaml -e "LOCATION=location_id_here" --name bsexec bootstrap`  runs the container and (if you're lucky) does the deployment.
73
74 (
75 1. the private key is THE private key for the public key added to OpenStack
76 2. the path to inputs and key file are FULL path starting from /
77 3. --name is optional.  if so the container name will be random
78 )
79
80
81 `example-inputs.yaml` is, as the name suggests, an example inputs file.  The values in it work in the ONAP-Future environment, except for the
82 user name and password.
83
84 To watch the action use
85 `docker logs -f bsexec`
86
87 The container stays up even after the installation is complete.
88 To enter the running container:
89 `docker exec -it bsexec /bin/bash`
90 Once in the container, to uninstall CM and the host VM and its supporting entities
91 `source dcaeinstall/bin/active`
92 `cfy local uninstall`
93
94 (But remember--before uninstalling CM, be sure to go to CM first and uninstall the Consul cluster.)
95
96
97 ####TODOS:
98 - Integrate with the maven-based template expansion.
99 - Integrate with maven-based Docker build and push to LF Docker repo
100 - Add full list of plugins to be installed onto CM
101 - Separate the Docker stuff from the non-Docker installation.  (The blueprints are common to both methods.)
102 - Get rid of any AT&T-isms
103 - (Maybe) Move the installation of the Cloudify CLI and the sshkeyshare and dnsdesig plugins into the Dockerfile,
104 so the image has everything set up and can just enter the vevn and start the Centos VM installation.
105 - Figure out what (if anything) needs to change if the container is deployed by Kubernetes rather than vanilla Docker
106 - Make sure the script never exits, even in the face of errors.  We need the container to stay up so we can do uninstalls.
107 - Figure out how to add in the deployments for the rest of the DCAE platform components.  (If this container deploys all of DCAE,
108 should it move out of the CCSDK project and into DCAE?)
109 - Figure out the right way to get the Cloudify OpenStack plugins and the Cloudify Fabric plugins onto CM.  Right now there are
110 handbuilt wagons in the Nexus repo.  (In theory, CM should be able to install these plugins whenever a blueprint calls for them.  However,
111 they require gcc, and we're not installing gcc on our CM host.)
112 - Maybe look at using a different base image--the Ubuntu 16.04 image needs numerous extra packages installed.
113 - The blueprint for Consul shows up in Cloudify Manager with the name 'blueprints'.  I'll leave it as an exercise for the reader to figure why
114 and to figure out how to change it.  (See ~ line 248 of installer-docker.sh-template.)