2 ## Build and deploy O2 services over O-Cloud (INF)
5 ## Bring up builder container from O-Cloud controller node
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
13 ## Build O2 service images inside the builder container
17 sudo docker exec -it o2imsbuilder bash
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
26 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
28 yum install -y docker-ce
33 cd /home/sysadmin/share/
34 git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
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)
50 ### Push O2 service images to local registry (with auth user admin)
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
58 ## Deploy O2 services with helm chart over O-Cloud controller node (with auth user admin)
61 export NAMESPACE=oran-o2
62 kubectl create ns ${NAMESPACE}
65 source /etc/platform/openrc
66 cat <<EOF>ocloud-override.yaml
68 - default-registry-key
71 serviceaccountname: admin-oran-o2
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
81 OS_AUTH_URL: "${OS_AUTH_URL}"
82 OS_USERNAME: "${OS_USERNAME}"
83 OS_PASSWORD: "${OS_PASSWORD}"
86 sudo docker login registry.local:9001 -u ${OS_PROJECT_NAME} -p ${OS_PASSWORD}
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
92 cd /home/sysadmin/share/o2
94 helm install o2imstest charts/ -f /home/sysadmin/ocloud-override.yaml
96 kubectl -n ${NAMESPACE} get pods
100 ### test api endpoint
103 curl -k http(s)://<Node IP>:30205
104 curl -k http(s)://<Node IP>:30205/o2ims_infrastructureInventory/v1
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
117 kubectl -n ${NAMESPACE} logs -f o2api-<xxx> -c o2api
119 kubectl -n ${NAMESPACE} exec -it o2api-<xxx> -c postgres -- bash
126 select * from ocloud;
136 1, there is chance the containers crash due to random bootstrap order of containers