Added HTTPS support
[pti/o2.git] / README-o2imsbuilder.md
1
2 ## Build and deploy O2 services over O-Cloud (INF)
3
4
5 ## Bring up builder container from O-Cloud controller node
6
7
8 ```sh
9 mkdir -p /home/sysadmin/share
10 sudo docker run -dt --privileged -v /home/sysadmin/share/:/home/sysadmin/share/ -v /var/run:/var/run --name o2imsbuilder centos:7
11 ```
12
13 ## Build O2 service images inside the builder container
14
15
16 ```sh
17 sudo docker exec -it o2imsbuilder bash
18 ```
19
20
21 ```sh
22 curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
23 chmod +x /usr/local/bin/docker-compose
24 docker-compose -v
25
26 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
27 yum makecache fast
28 yum install -y docker-ce
29 docker ps
30
31 yum install -y git
32
33 cd /home/sysadmin/share/
34 git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
35 cd o2
36
37 mkdir -p temp
38 cd temp
39 git clone --depth 1 --branch r/stx.7.0 https://opendev.org/starlingx/config.git
40 git clone --branch master https://opendev.org/starlingx/distcloud-client.git
41 (cd distcloud-client && git reset --hard eb4e7eeeb09bdf2e1b80984b378c5a8ea9930f04)
42 cd -
43
44 docker-compose build
45
46 exit
47
48 ```
49
50 ### Push O2 service images to local registry (with auth user admin)
51
52 ```sh
53 sudo docker tag o2imsdms:latest registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
54 sudo docker image push registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
55
56 ```
57
58 ## Deploy O2 services with helm chart over O-Cloud controller node (with auth user admin)
59
60 ```sh
61 export NAMESPACE=oran-o2
62 kubectl create ns ${NAMESPACE}
63
64 cd /home/sysadmin/
65 source /etc/platform/openrc
66 cat <<EOF>ocloud-override.yaml
67 imagePullSecrets:
68   - default-registry-key
69
70 o2ims:
71   serviceaccountname: admin-oran-o2
72   images:
73     tags:
74       o2service: registry.local:9001/o-ran-sc/pti-o2imsdms:2.0.0
75       postgres: docker.io/library/postgres:9.6
76       redis: docker.io/library/redis:alpine
77     pullPolicy: IfNotPresent
78   logginglevel: "DEBUG"
79
80 ocloud:
81   OS_AUTH_URL: "${OS_AUTH_URL}"
82   OS_USERNAME: "${OS_USERNAME}"
83   OS_PASSWORD: "${OS_PASSWORD}"
84 EOF
85
86 sudo docker login registry.local:9001 -u ${OS_PROJECT_NAME} -p ${OS_PASSWORD}
87
88 kubectl -n ${NAMESPACE} create secret docker-registry ${OS_PROJECT_NAME}-${NAMESPACE}-registry-secret \
89 --docker-server=registry.local:9001 --docker-username=${OS_PROJECT_NAME} \
90 --docker-password=${OS_PASSWORD} --docker-email=noreply@windriver.com
91
92 cd /home/sysadmin/share/o2
93
94 helm install o2imstest charts/ -f /home/sysadmin/ocloud-override.yaml
95
96 kubectl -n ${NAMESPACE} get pods
97
98 ```
99
100 ### test api endpoint
101
102 ```sh
103 curl -k http(s)://<Node IP>:30205
104 curl -k http(s)://<Node IP>:30205/o2ims_infrastructureInventory/v1
105 ```
106
107
108 ### Debug tips
109
110 ```sh
111 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c o2api
112 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c postgres
113 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c o2pubsub
114 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c watcher
115
116
117 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c o2api
118
119 kubectl -n ${NAMESPACE} exec -it o2api-<xxx> -c postgres -- bash
120     psql -U o2ims
121
122         \c o2ims
123
124         \d
125
126         select * from ocloud;
127
128         \q
129
130     exit
131
132 ```
133
134 ## Issues:
135
136 1, there is chance the containers crash due to random bootstrap order of containers