Release healthcheck-container 2.4.1
[dcaegen2/deployments.git] / bootstrap / README-docker.md
1 ## Dockerized bootstrap for Cloudify Manager and Consul cluster
2 1. Preparations
3
4      a) The current DCAEGEN2 boot strapping process assumes that the networking in the OpenStack is based on the following model:
5
6       a private network interconnecting the VMs; and an external network that provides "floating" IP addresses for the VMs.A router connects the two networks.  Each VM is assigned two IP addresses, one allocated from the private network when the VM is launched.
7 Then a floating IP is assigned to the VM from the external network. The UUID's of the private and external networks are needed for preparing the inputs.yaml file needed for running the bootstrap container.
8
9    b) Add a public key to openStack, note its name (we will use KEYNAME as example for below).  Save the private key (we will use KEYPATH as its path example), make sure its permission is globally readable.
10
11     c) Load the flowing base VM images to OpenStack:  a CentOS 7 base image and a Ubuntu 16.04 base image.
12
13     d) Obtain the resource IDs/UUIDs for resources needed by the inputs.yaml file, as explained below, from OpenStack.
14
15 2. On dev machine, set up a directory to hold environment-specific configuration files. Call its path CONFIGDIR.
16
17 3. Put the private key mentioned above into CONFIGDIR as a file named `key`, and make it globally readable.
18 4. Create a file named `inputs.yaml` in CONFIGDIR
19
20 ```
21 1  centos7image_id: '7c8d7524-de1f-490b-8418-db294bfa2d65'
22 2  ubuntu1604image_id: '4b09c18b-d69e-4ba8-a1bd-562cab91ff20'
23 3  flavor_id: '4'
24 4  security_group: '55a11193-6559-4f6c-b2d2-0119a9817062'
25 5  public_net: 'admin_floating_228_net'
26 6  private_net: 'onap-f-net'
27 7  openstack:
28 8    username: 'MY_LOGIN'
29 9    password: 'MY_PASSWORD'
30 10   tenant_name: 'TENANT_NAME'
31 11   auth_url: 'KEYSTONE_AUTH_URL'
32 12   region: 'RegionOne'
33 13 keypair: 'KEYNME'
34 14 key_filename: '/opt/dcae/key'
35 15 location_prefix: 'onapr1'
36 16 location_domain: 'onapdevlab.onap.org'
37 17 codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content'
38 18 codesource_version: 'org.onap.dcaegen2.deployments/releases/scripts'
39 ```
40 Here is a line-by-line explanation of the parameters
41   1. UUID of the OpenStack's CentOD 7 VM image
42   2. UUID of the OpenStack's Ubuntu 16.04 VM image
43   3. ID of the OpenStack's VM flavor to be used by DCAEGEN2 VMs
44   4. UUID of the OpenStack's security group to be used for DCAEGEN2 VMs
45   5. The name of the OpenStack network where public IP addresses are allocated from
46   6. The name of the OpenStack network where private IP addresses are allocated from
47   7. Group header for OpenStack Keystone parameters
48   8. User name
49   9. Password
50   10. Name of the OpenStack tenant/project where DCAEGEN2 VMs are deployed
51   11. penstack authentication API URL, for example 'https://horizon.playground.onap.org:5000/v2.0'
52   12. Name of the OpenStack region where DCAEGEN2 VMs are deployed, for example 'RegionOne'
53   13. Name of the public key uploaded to OpenStack in the Preparation step
54   14. Path to the private key within the container (!! Do not change!!)
55   15. Prefix (location code) of all DCAEGEN2 VMs
56   16. Domain name of the OpenStack tenant 'onapr1.playground.onap.org'
57   17. Location of the raw artifact repo hosting additional boot scripts called by DCAEGEN2 VMs' cloud-init, for example: 
58   'https://nexus.onap.org/service/local/repositories/raw/content'
59   18. Path to the boot scripts within the raw artifact repo, for example: 'org.onap.dcaegen2.deployments/releases/scripts'
60
61
62 5. Create a file in CONFIGDIR called `invinputs.yaml`.  This contains environment-specific information for the inventory service.  (TODO: examples only, not the correct values for the ONAP integration environment.)
63
64 ```
65 1 docker_host_override: "platform_dockerhost"
66 2 asdc_address: "sdc.onap.org:8443"
67 3 asdc_uri: "https://sdc.onap.org:8443"
68 4 asdc_user: "ci"
69 5 asdc_password: !!str 123456
70 6 asdc_environment_name: "ONAP-AMDOCS"
71 7 postgres_user_inventory: "postgres"
72 8 postgres_password_inventory: "onap123"
73 9 service_change_handler_image: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.servicechange-handler:latest"
74 10 inventory_image: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.inventory-api:latest
75 ```
76 Here is a line-by-line description of the parameters:
77   1. The service name for the platform docker host (should be the same in all environments)
78   2. The hostname and port of the SDC service
79   3. The URI of the SDC service
80   4. The SDC username
81   5. The SDC password
82   6. The SDC environment name
83   7. The postgres user name
84   8. The postgres password
85   9. The Docker image to be used for the service change handler (should be the same in all environments)
86   10. The Docker image to be used for the inventory service (should be the same in all environments)
87   
88 6. Create a file in CONFIGDIR called `phinputs.yaml`.  This contains environment-specific information for the policy handler.
89
90 ```
91 application_config:
92   policy_handler :
93     # parallelize the getConfig queries to policy-engine on each policy-update notification
94     thread_pool_size : 4
95  
96     # parallelize requests to policy-engine and keep them alive
97     pool_connections : 20
98  
99     # list of policyName prefixes (filters) that DCAE-Controller handles (=ignores any other policyName values)
100     scope_prefixes : ["DCAE.Config_"]
101  
102     # retry to getConfig from policy-engine on policy-update notification
103     policy_retry_count : 5
104     policy_retry_sleep : 5
105  
106     # policy-engine config
107     # These are the url of and the auth for the external system, namely the policy-engine (PDP).
108     # We obtain that info manually from PDP folks at the moment.
109     # In long run we should figure out a way of bringing that info into consul record
110     #    related to policy-engine itself.
111     policy_engine :
112         url : "https://policy-engine.onap.org:8081"
113         path_pdp : "/pdp/"
114         path_api : "/pdp/api/"
115         headers :
116             Accept : "application/json"
117             "Content-Type" : "application/json"
118             ClientAuth : "Basic bTAzOTQ5OnBvbGljeVIwY2sk"
119             Authorization : "Basic dGVzdHBkcDphbHBoYTEyMw=="
120             Environment : "TEST"
121         target_entity : "policy_engine"
122     # name of deployment-handler service in consul for policy-handler to direct the policy-updates to
123     deploy_handler : "deployment_handler"
124 ```
125 TODO: provide explanations
126
127 7. Pull and run the docker container
128 ```
129 docker login -u docker -p docker nexus3.onap.org:10001
130 docker pull nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.bootstrap:1.1-latest0
131 docker run -d --name boot -v CONFIGDIR:/opt/app/installer/config -e "LOCATION=dg2" nexus3.onap.org:10003/onap/org.onap.dcaegen2.deployments.bootstrap:1.1-latest
132 ```
133 The container stays up even after the installation is complete.  Using the docker exec command to get inside of the container, then run cfy commands to interact with the Cloudify Manager.
134
135 8. To tear down all of the DCAE installation:
136
137 ```
138 docker exec -it boot ./teardown
139 ```