Do first pass on dcae onboarding vagrant
[dcaegen2/platform/cli.git] / vagrant / README.md
1 # Vagrant for DCAE runtime
2
3 This project provides component developers the means to stand up their own local DCAE runtime environment to do local onboarding through the dcae-cli.  [Vagrant](https://www.vagrantup.com/) is the technology used and is required to the provided Vagrantfile.
4
5 ## Pre-req
6
7 1. Install Docker
8 2. Install Vagrant
9 3. Install VirtualBox
10 4. Add the following to your `/etc/hosts` (or equivalent):
11
12 ```
13 127.0.0.1 vagrant-dcae
14 ```
15
16 ## Run
17
18 Clone the [dcaegen2.platform.cli](https://gerrit.onap.org/r/#/admin/projects/dcaegen2/platform/cli) project.
19
20 ```
21 cd vagrant
22 vagrant up
23 ```
24
25 Open the following [Consul link](http://vagrant-dcae:8500/ui) to verify that Consul is running and review the listed services by clicking on each:
26
27 * [`config_binding_service`](http://vagrant-dcae:8500/ui/#/vagrant-dcae/services/config_binding_service)
28 * [`onboardingdb`](http://vagrant-dcae:8500/ui/#/vagrant-dcae/services/onboardingdb)
29
30 NOTE: The vagrant DCAE runtime requires several ports on the host machine.  See the [Vagrantfile](Vagrantfile) for all the lines that contain `forwarded_port`.
31
32 ## Post run
33
34 Post run involves setting up the dcae-cli to work with the newly instantiated local DCAE runtime environment.
35
36 ### Install
37
38 First install [dcae-cli](https://pypi.org/project/onap-dcae-cli/).
39
40 Even if you have already installed dcae-cli before, please take the time now to upgrade:
41
42 ```
43 pip install --upgrade onap-dcae-cli
44 ```
45
46 ### Configure
47
48 Type the following command and you will be taken through a series of prompts to configure dcae-cli.  For the most part, use the responses shown below except for the *user id*:
49
50 ```
51 $ dcae_cli --reinit
52 Warning! Reinitializing your dcae-cli configuration
53 Please enter the remote server url: https://git.onap.org/dcaegen2/platform/cli/plain
54 Could not download initial configuration from remote server. Attempt manually setting up? [y/N]: y
55 Please enter your user id: <your user id>
56 Now we need to set up access to the onboarding catalog
57 Please enter the onboarding catalog hostname: vagrant-dcae
58 Please enter the onboarding catalog user: postgres
59 Please enter the onboarding catalog password: onap123
60 Could not download initial profiles from remote server. Set empty default? [y/N]: y
61 Reinitialize done
62 ```
63
64 #### Profile
65
66 Next you will need to setup your default profile.
67
68 Running the following, you should see the following:
69
70 ```
71 $ dcae_cli profiles show default
72 {
73     "cdap_broker": "cdap_broker",
74     "config_binding_service": "config_binding_service",
75     "consul_host": "",
76     "docker_host": ""
77 }
78 ```
79
80 You need to set `consul_host` and `docker_host` by running the following:
81
82 ```
83 $ dcae_cli profiles set default consul_host vagrant-dcae
84 $ dcae_cli profiles set default docker_host vagrant-dcae:2376
85 ```
86
87 Repeating `dcae_cli profiles show default` should show those parameters now filled.
88
89 ### Run
90
91 You must point your Docker client to the Docker engine running in the VirtualBox instance by doing the following:
92
93 ```
94 export DOCKER_HOST="tcp://vagrant-dcae:2376"
95 ```
96
97 You must have this environment variable set everytime before you run the dcae-cli.
98
99 ## TODO
100
101 * There is a known issue where Consul does not recover after doing a `vagrant reload`.  It get