temp
docs/_build/
configs/kubeconfig_*.config
+*.pem
+*.crt
+*.csr
+*.key
--- /dev/null
+
+# local test with docker-compose
+
+## build images
+
+```sh
+mkdir -p /home/sysadmin/share
+sudo docker run -dt --privileged -v /home/sysadmin/share/:/home/sysadmin/share/ -v /var/run:/var/run --name o2imsbuilder centos:7
+```
+
+## Build O2 service images inside the builder container
+
+
+```sh
+sudo docker exec -it o2imsbuilder bash
+```
+
+
+```sh
+curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
+chmod +x /usr/local/bin/docker-compose
+docker-compose -v
+
+yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
+yum makecache fast
+yum install -y docker-ce
+docker ps
+
+yum install -y git
+
+cd /home/sysadmin/share/
+git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
+cd o2
+
+mkdir -p temp
+cd temp
+git clone --depth 1 --branch r/stx.7.0 https://opendev.org/starlingx/config.git
+git clone --depth 1 --branch r/stx.7.0 https://opendev.org/starlingx/distcloud-client.git
+
+git clone --depth 1 --branch r/stx.7.0 https://opendev.org/starlingx/fault.git
+cd -
+
+docker-compose build
+
+exit
+
+```
+
+## utilize a server certificates signed by a self-signed CA
+
+~~~sh
+cd o2/tests
+openssl genrsa -out my-root-ca-key.pem 2048
+openssl req -x509 -new -nodes -key my-root-ca-key.pem -days 1024 -out my-root-ca-cert.pem -outform PEM
+openssl genrsa -out my-server-key.pem 2048
+openssl req -new -key my-server-key.pem -out my-server.csr
+
+echo subjectAltName = IP:127.0.0.1 > extfile.cnf
+openssl x509 -req -in my-server.csr -CA my-root-ca-cert.pem -CAkey my-root-ca-key.pem -CAcreateserial -out my-server-cert.pem -days 365 -extfile extfile.cnf
+cat my-server-cert.pem my-server-key.pem > my-server.pem
+
+~~~
+
+Assuming, we can get following files after performing procedure above:
+
+Local CA certificate - my-root-ca-cert.pem
+Server certificate - my-server-cert.pem
+Server key - my-server-key.pem
+
+
+## Bring up docker containers
+
+~~~sh
+docker-compose build
+docker-compose up -d
+
+docker ps |grep o2
+docker logs -f o2_api_1
+docker logs -f o2_watcher_1
+~~~
+# Copyright (C) 2022 Wind River Systems, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
+
apt-get update && apt-get install ssh -y
if [ -z "${HELM_USER_PASSWD}" ];
-# Copyright (C) 2021 Wind River Systems, Inc.
+# Copyright (C) 2021-2022 Wind River Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#!/bin/bash
-# pull latest code to debug
-# cd /root/
-# git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
-# cd o2
-# git pull https://gerrit.o-ran-sc.org/r/pti/o2 refs/changes/85/7085/5
-# pip install retry
-
-# pip install -e /root/o2
-# pip install -e /src
-
-# cat <<EOF>>/etc/hosts
-# 127.0.0.1 api
-# 127.0.0.1 postgres
-# 127.0.0.1 redis
-# EOF
-
-
-flask run --host=0.0.0.0 --port=80 --cert /configs/server.crt --key /configs/server.key
+gunicorn -b 0.0.0.0:80 o2app.entrypoints.flask_application:app --certfile /configs/server.crt --keyfile /configs/server.key
sleep infinity
-# Copyright (C) 2021 Wind River Systems, Inc.
+# Copyright (C) 2021-2022 Wind River Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#!/bin/bash
-# pull latest code to debug
-# cd /root/
-# git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
-# pip install -e /root/o2
-
# python /root/o2/o2app/entrypoints/redis_eventconsumer.py
python /src/o2app/entrypoints/redis_eventconsumer.py
-# Copyright (C) 2021 Wind River Systems, Inc.
+# Copyright (C) 2021-2022 Wind River Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#!/bin/bash
-# pull latest code to debug
-# cd /root/
-# git clone "https://gerrit.o-ran-sc.org/r/pti/o2"
-# pip install -e /root/o2
-
-# python /root/o2/o2app/entrypoints/resource_watcher.py
python /src/o2app/entrypoints/resource_watcher.py
sleep infinity
value: localhost
- name: DB_PASSWORD
value: o2ims123
- - name: FLASK_APP
- value: /src/o2app/entrypoints/flask_application.py
- - name: FLASK_DEBUG
- value: {{ .Values.o2ims.logginglevel }}
+ # - name: FLASK_APP
+ # value: /src/o2app/entrypoints/flask_application.py
+ # - name: FLASK_DEBUG
+ # value: {{ .Values.o2ims.logginglevel }}
- name: LOGGING_CONFIG_LEVEL
value: {{ .Values.o2ims.logginglevel }}
- name: OS_AUTH_URL
- ./tests:/tests
entrypoint:
- /bin/sh
- - /tests/o2app-api-entry.sh
+ - /tests/o2app-api-entry2.sh
ports:
- "5005:80"
werkzeug<=2.1.2
pyOpenSSL
+
+gunicorn
--- /dev/null
+#!/bin/sh
+
+# pip install -e /src
+# python /o2ims/entrypoints/resource_watcher.py
+
+mkdir -p /etc/o2
+cp -r /configs/* /etc/o2/
+mkdir -p /src/o2common
+cp -r /o2common/* /src/o2common
+mkdir -p /src/o2ims
+cp -r /o2ims/* /src/o2ims
+mkdir -p /src/o2dms
+cp -r /o2dms/* /src/o2dms
+mkdir -p /src/o2app
+cp -r /o2app/* /src/o2app
+mkdir -p /src/helm_sdk
+cp -r /helm_sdk/* /src/helm_sdk
+
+pip install -e /src
+
+if [ -e '/tests/my-server-cert.pem' ]
+then
+cp /tests/my-root-ca-cert.pem /configs/my-root-ca-cert.pem
+cp /tests/my-server-cert.pem /configs/server.crt
+cp /tests/my-server-key.pem /configs/server.key
+gunicorn -b 0.0.0.0:80 o2app.entrypoints.flask_application:app --certfile /configs/server.crt --keyfile /configs/server.key
+else
+gunicorn -b 0.0.0.0:80 o2app.entrypoints.flask_application:app
+fi