summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker-compose-fcaps.yml45
-rw-r--r--docker-compose-pike.yml (renamed from fcaps/docker/docker-compose.yml)21
-rw-r--r--docker-compose-starlingx.yml32
-rw-r--r--docker-compose-windriver.yml32
-rw-r--r--fcaps/README.md25
-rw-r--r--fcaps/docker/Dockerfile2
-rw-r--r--fcaps/docker/Dockerfile4composer43
-rw-r--r--fcaps/fcaps/celery.py5
-rw-r--r--fcaps/fcaps/settings.py15
-rw-r--r--fcaps/run.sh5
-rw-r--r--fcaps/stop.sh2
-rw-r--r--pike/README.md24
-rw-r--r--pike/docker/Dockerfile2
-rw-r--r--pike/docker/Dockerfile4composer56
-rw-r--r--pike/pike/settings.py13
-rwxr-xr-xpike/run.sh3
-rwxr-xr-xpike/stop.sh2
-rw-r--r--starlingx/README.md25
-rw-r--r--starlingx/docker/Dockerfile2
-rw-r--r--starlingx/docker/Dockerfile4composer57
-rwxr-xr-xstarlingx/run.sh3
-rw-r--r--starlingx/starlingx/pub/config/log.yml9
-rw-r--r--starlingx/starlingx/settings.py13
-rwxr-xr-xstarlingx/stop.sh2
-rw-r--r--windriver/README.md23
-rw-r--r--windriver/docker/Dockerfile2
-rw-r--r--windriver/docker/Dockerfile4composer42
-rw-r--r--windriver/run.sh3
-rw-r--r--windriver/stop.sh2
-rw-r--r--windriver/titanium_cloud/pub/config/log.yml25
-rw-r--r--windriver/titanium_cloud/settings.py13
31 files changed, 507 insertions, 41 deletions
diff --git a/docker-compose-fcaps.yml b/docker-compose-fcaps.yml
new file mode 100644
index 00000000..7ce07820
--- /dev/null
+++ b/docker-compose-fcaps.yml
@@ -0,0 +1,45 @@
+# Copyright 2019 CMCC Corporation.
+# 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.
+
+# Only used for local test
+#First need to add broker('amqp://admin:mypass@rabbit:5672') to Celery
+
+version: '2'
+services:
+ rabbit:
+ hostname: rabbit
+ image: rabbitmq:alpine
+ environment:
+ - RABBITMQ_DEFAULT_USER=admin
+ - RABBITMQ_DEFAULT_PASS=mypass
+ ports:
+ - "5672:5672"
+ - "15672:15672"
+ - "15692:15692"
+ memcached:
+ hostname: memcached
+ image: memcached:alpine3.15
+ command: ["memcached", "-m", "2048", "-c", "1024", "-p", "11211", "-P", "/tmp/memcached1.pid", "-v"]
+ ports:
+ - "11211:11211"
+
+ worker:
+ build:
+ context: .
+ dockerfile: ./fcaps/docker/Dockerfile4composer
+ image: openstack-fcaps:test
+ environment:
+ - RABBITMQ_DEFAULT_USER=admin
+ - RABBITMQ_DEFAULT_PASS=mypass
+ - RABBITMQ_HOST=rabbit
+ - MEMCACHED_HOST=memcached
+ # volumes:
+ # - .:/fcaps
diff --git a/fcaps/docker/docker-compose.yml b/docker-compose-pike.yml
index 5a9c2569..e4e8084d 100644
--- a/fcaps/docker/docker-compose.yml
+++ b/docker-compose-pike.yml
@@ -14,18 +14,19 @@
version: '2'
services:
- rabbit:
- hostname: rabbit
- image: rabbitmq:alpine
- environment:
- - RABBITMQ_DEFAULT_USER=admin
- - RABBITMQ_DEFAULT_PASS=mypass
+ memcached:
+ hostname: memcached
+ image: memcached:alpine3.15
+ command: ["memcached", "-m", "2048", "-c", "1024", "-p", "11211", "-P", "/tmp/memcached1.pid", "-v"]
ports:
- - "15672:15672"
+ - "11211:11211"
worker:
build:
context: .
- dockerfile: Dockerfile
- volumes:
- - .:/fcaps
+ dockerfile: ./pike/docker/Dockerfile4composer
+ image: openstack-pike:test
+ environment:
+ - MEMCACHED_HOST=memcached
+ # volumes:
+ # - .:/fcaps
diff --git a/docker-compose-starlingx.yml b/docker-compose-starlingx.yml
new file mode 100644
index 00000000..3efcac51
--- /dev/null
+++ b/docker-compose-starlingx.yml
@@ -0,0 +1,32 @@
+# Copyright 2019 CMCC Corporation.
+# 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.
+
+# Only used for local test
+#First need to add broker('amqp://admin:mypass@rabbit:5672') to Celery
+
+version: '2'
+services:
+ memcached:
+ hostname: memcached
+ image: memcached:alpine3.15
+ command: ["memcached", "-m", "2048", "-c", "1024", "-p", "11211", "-P", "/tmp/memcached1.pid", "-v"]
+ ports:
+ - "11211:11211"
+
+ worker:
+ build:
+ context: .
+ dockerfile: ./starlingx/docker/Dockerfile4composer
+ image: openstack-starlingx:test
+ environment:
+ - MEMCACHED_HOST=memcached
+ # volumes:
+ # - .:/fcaps
diff --git a/docker-compose-windriver.yml b/docker-compose-windriver.yml
new file mode 100644
index 00000000..34a269c4
--- /dev/null
+++ b/docker-compose-windriver.yml
@@ -0,0 +1,32 @@
+# Copyright 2019 CMCC Corporation.
+# 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.
+
+# Only used for local test
+#First need to add broker('amqp://admin:mypass@rabbit:5672') to Celery
+
+version: '2'
+services:
+ memcached:
+ hostname: memcached
+ image: memcached:alpine3.15
+ command: ["memcached", "-m", "2048", "-c", "1024", "-p", "11211", "-P", "/tmp/memcached1.pid", "-v"]
+ ports:
+ - "11211:11211"
+
+ worker:
+ build:
+ context: .
+ dockerfile: ./windriver/docker/Dockerfile4composer
+ image: openstack-windriver:test
+ environment:
+ - MEMCACHED_HOST=memcached
+ # volumes:
+ # - .:/fcaps
diff --git a/fcaps/README.md b/fcaps/README.md
index 8005e176..b02e0d72 100644
--- a/fcaps/README.md
+++ b/fcaps/README.md
@@ -13,3 +13,28 @@
# limitations under the License.
# Micro service of MultiCloud plugin for Wind River Titanium Cloud.
+
+### local test with docker-composer:
+
+docker-compose -f docker-compose-fcaps.yml build
+
+docker-compose -f docker-compose-fcaps.yml up -d
+
+docker ps
+
+### Test memcached
+docker exec -it openstack_worker_1 sh
+
+cat <<EOF>testmemcached.py
+import memcache
+mem = memcache.Client(['memcached:11211'], debug=1)
+mem.set("testkey1","testvalue1")
+value1 = mem.get("testkey1")
+print("memcached is working" if value1=="testvalue1" else "memcached is not working")
+EOF
+
+python testmemcached.py
+
+exit
+
+docker-compose -f docker-compose-fcaps.yml down \ No newline at end of file
diff --git a/fcaps/docker/Dockerfile b/fcaps/docker/Dockerfile
index 3de775a7..f25e28ac 100644
--- a/fcaps/docker/Dockerfile
+++ b/fcaps/docker/Dockerfile
@@ -25,7 +25,7 @@ USER root
COPY ./multicloud-openstack-fcaps-*.zip /opt/multicloud-openstack-fcaps.zip
RUN apk update && \
- apk add pcre pcre-dev uwsgi memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
cd /opt/ && \
unzip -q -o -B multicloud-openstack-fcaps.zip && \
chmod +x /opt/fcaps/*.sh && \
diff --git a/fcaps/docker/Dockerfile4composer b/fcaps/docker/Dockerfile4composer
new file mode 100644
index 00000000..0c5c1657
--- /dev/null
+++ b/fcaps/docker/Dockerfile4composer
@@ -0,0 +1,43 @@
+# FROM python:3.8-alpine
+FROM nexus3.onap.org:10001/onap/integration-python:9.1.0
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+
+ENV MSB_PROTO "http"
+ENV MSB_ADDR "127.0.0.1"
+ENV MSB_PORT "80"
+ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
+ENV AAI_PORT "8443"
+ENV AAI_SCHEMA_VERSION "v13"
+ENV AAI_USERNAME "AAI"
+ENV AAI_PASSWORD "AAI"
+
+EXPOSE 9011
+
+# RUN addgroup -S onap && adduser -S -G onap onap
+USER root
+
+COPY ./fcaps /opt/fcaps/
+COPY ./share /opt/fcaps/lib/share
+# COPY ./multicloud-openstack-fcaps-*.zip /opt/multicloud-openstack-fcaps.zip
+
+RUN apk update && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ cd /opt/ && \
+ chmod +x /opt/fcaps/*.sh && \
+ pip3 install --no-cache-dir -r /opt/fcaps/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/fcaps/uwsgi-requirements.txt && \
+ apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
+ mkdir -p /var/log/onap/multicloud/fcaps && \
+ chown onap:onap /var/log/onap -R && \
+ chown onap:onap /opt/fcaps -R
+
+
+USER onap
+
+WORKDIR /opt/fcaps
+CMD /bin/sh -c /opt/fcaps/run.sh
diff --git a/fcaps/fcaps/celery.py b/fcaps/fcaps/celery.py
index ca3b2e56..93ad6982 100644
--- a/fcaps/fcaps/celery.py
+++ b/fcaps/fcaps/celery.py
@@ -16,11 +16,14 @@ from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
import logging
+from django.conf import settings
+
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fcaps.settings')
-app = Celery('fcaps')
+# app = Celery('fcaps', broker='amqp://guest:guest@localhost:5672//')
+app = Celery('fcaps', broker=settings.RABBITMQ_URL)
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
diff --git a/fcaps/fcaps/settings.py b/fcaps/fcaps/settings.py
index 37021e05..5e663c61 100644
--- a/fcaps/fcaps/settings.py
+++ b/fcaps/fcaps/settings.py
@@ -79,9 +79,12 @@ TIME_ZONE = 'UTC'
STATIC_URL = '/static/'
-
DEFAULT_MSB_ADDR = "127.0.0.1"
-DEFAULT_CACHE_BACKEND_LOCATION = '127.0.0.1:11211'
+# DEFAULT_CACHE_BACKEND_LOCATION = '127.0.0.1:11211'
+MEMCACHED_HOST = os.environ.get('MEMCACHED_HOST', '127.0.0.1')
+MEMCACHED_PORT = os.environ.get('MEMCACHED_PORT', '11211')
+DEFAULT_CACHE_BACKEND_LOCATION = "%s:%s" % (MEMCACHED_HOST, MEMCACHED_PORT)
+
CACHES = {
'default': {
@@ -90,6 +93,14 @@ CACHES = {
}
}
+# [RABBITMQ]
+RABBITMQ_DEFAULT_USER = os.environ.get('RABBITMQ_DEFAULT_USER', 'guest')
+RABBITMQ_DEFAULT_PASS = os.environ.get('RABBITMQ_DEFAULT_PASS', 'guest')
+RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')
+RABBITMQ_PORT = os.environ.get('RABBITMQ_PORT', '5672')
+RABBITMQ_URL = "amqp://%s:%s@%s:%s//" % (
+ RABBITMQ_DEFAULT_USER, RABBITMQ_DEFAULT_PASS, RABBITMQ_HOST, RABBITMQ_PORT)
+
# [MSB]
DEFAULT_MSB_PROTO = "http"
MSB_SERVICE_PROTOCOL = os.environ.get('MSB_PROTO', DEFAULT_MSB_PROTO)
diff --git a/fcaps/run.sh b/fcaps/run.sh
index e8b82097..864644c5 100644
--- a/fcaps/run.sh
+++ b/fcaps/run.sh
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
+# memcached should be provided as sidecar to avoid GPLv3 license issue
+# memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
export PYTHONPATH=lib/share
#service rabbitmq-server restart
@@ -36,5 +37,3 @@ while [ ! -f $logDir/fcaps.log ]; do
done
tail -F $logDir/fcaps.log
-
-
diff --git a/fcaps/stop.sh b/fcaps/stop.sh
index d608abed..88c30b10 100644
--- a/fcaps/stop.sh
+++ b/fcaps/stop.sh
@@ -15,4 +15,4 @@
#ps auxww | grep 'manage.py runserver 0.0.0.0:9011' | awk '{print $2}' | xargs kill -9
ps auxww |grep 'uwsgi --http :9011 --module fcaps.wsgi --master' |awk '{print $2}' |xargs kill -9
-ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
+# ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
diff --git a/pike/README.md b/pike/README.md
index e6231224..a7f27615 100644
--- a/pike/README.md
+++ b/pike/README.md
@@ -13,3 +13,27 @@
# limitations under the License.
# Micro service of MultiCloud plugin for pike.
+### local test with docker-composer:
+
+docker-compose -f docker-compose-pike.yml build
+
+docker-compose -f docker-compose-pike.yml up -d
+
+docker ps
+
+### Test memcached
+docker exec -it openstack_worker_1 sh
+
+cat <<EOF>testmemcached.py
+import memcache
+mem = memcache.Client(['memcached:11211'], debug=1)
+mem.set("testkey1","testvalue1")
+value1 = mem.get("testkey1")
+print("memcached is working" if value1=="testvalue1" else "memcached is not working")
+EOF
+
+python testmemcached.py
+
+exit
+
+docker-compose -f docker-compose-pike.yml down \ No newline at end of file
diff --git a/pike/docker/Dockerfile b/pike/docker/Dockerfile
index 7ce54023..ce239b22 100644
--- a/pike/docker/Dockerfile
+++ b/pike/docker/Dockerfile
@@ -38,7 +38,7 @@ USER root
COPY ./multicloud-openstack-pike-*.zip /opt/multicloud-openstack-pike.zip
RUN apk update && \
- apk add pcre pcre-dev uwsgi memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
cd /opt/ && \
unzip -q -o -B /opt/multicloud-openstack-pike.zip -d /opt/ && \
rm -f /opt/multicloud-openstack-pike.zip && \
diff --git a/pike/docker/Dockerfile4composer b/pike/docker/Dockerfile4composer
new file mode 100644
index 00000000..cbc5c8cf
--- /dev/null
+++ b/pike/docker/Dockerfile4composer
@@ -0,0 +1,56 @@
+# Copyright (c) 2018 Intel Corporation.
+#
+# 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.
+
+# FROM python:3.8-alpine
+FROM nexus3.onap.org:10001/onap/integration-python:9.1.0
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+
+ENV MSB_PROTO "http"
+ENV MSB_ADDR "127.0.0.1"
+ENV MSB_PORT "80"
+ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
+ENV AAI_PORT "8443"
+ENV AAI_SERVICE_URL ""
+ENV AAI_SCHEMA_VERSION "v13"
+ENV AAI_USERNAME "AAI"
+ENV AAI_PASSWORD "AAI"
+
+EXPOSE 9007
+
+# RUN addgroup -S onap && adduser -S -G onap onap
+USER root
+
+COPY ./pike /opt/pike/
+COPY ./share /opt/pike/lib/share
+# COPY ./multicloud-openstack-pike-*.zip /opt/multicloud-openstack-pike.zip
+RUN apk update && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ cd /opt/ && \
+ pip3 install --no-cache-dir -r /opt/pike/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/pike/uwsgi-requirements.txt && \
+ apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
+ mkdir -p /var/log/onap/multicloud/openstack/pike && \
+ chown onap:onap /var/log/onap -R && \
+ chown onap:onap /opt/pike -R
+
+RUN mkdir -p /var/log/onap/multicloud/openstack/pike/
+
+USER onap
+WORKDIR /opt/pike
+CMD /bin/sh -c "/opt/pike/run.sh" \ No newline at end of file
diff --git a/pike/pike/settings.py b/pike/pike/settings.py
index 83c7415f..d765ca37 100644
--- a/pike/pike/settings.py
+++ b/pike/pike/settings.py
@@ -79,14 +79,25 @@ TIME_ZONE = 'UTC'
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
+MEMCACHED_HOST = os.environ.get('MEMCACHED_HOST', '127.0.0.1')
+MEMCACHED_PORT = os.environ.get('MEMCACHED_PORT', '11211')
+DEFAULT_CACHE_BACKEND_LOCATION = "%s:%s" % (MEMCACHED_HOST, MEMCACHED_PORT)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'LOCATION': '127.0.0.1:11211',
+ 'LOCATION': DEFAULT_CACHE_BACKEND_LOCATION,
}
}
+# [RABBITMQ]
+RABBITMQ_DEFAULT_USER = os.environ.get('RABBITMQ_DEFAULT_USER', 'guest')
+RABBITMQ_DEFAULT_PASS = os.environ.get('RABBITMQ_DEFAULT_PASS', 'guest')
+RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')
+RABBITMQ_PORT = os.environ.get('RABBITMQ_PORT', '5672')
+RABBITMQ_URL = "amqp://%s:%s@%s:%s//" % (
+ RABBITMQ_DEFAULT_USER, RABBITMQ_DEFAULT_PASS, RABBITMQ_HOST, RABBITMQ_PORT)
+
# [MSB]
DEFAULT_MSB_PROTO = "http"
MSB_SERVICE_PROTOCOL = os.environ.get('MSB_PROTO', DEFAULT_MSB_PROTO)
diff --git a/pike/run.sh b/pike/run.sh
index c4ac483a..fb81ee93 100755
--- a/pike/run.sh
+++ b/pike/run.sh
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
+# memcached should be provided as sidecar to avoid GPLv3 license issue
+# memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
export PYTHONPATH=lib/share
#nohup python manage.py runserver 0.0.0.0:9007 2>&1 &
diff --git a/pike/stop.sh b/pike/stop.sh
index 6343dd1b..77ee7036 100755
--- a/pike/stop.sh
+++ b/pike/stop.sh
@@ -15,4 +15,4 @@
#ps auxww | grep 'manage.py runserver 0.0.0.0:9007' | awk '{print $2}' | xargs kill -9
ps auxww |grep 'uwsgi --http :9007 --module pike.wsgi --master' |awk '{print $2}' |xargs kill -9
-ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
+# ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
diff --git a/starlingx/README.md b/starlingx/README.md
index c8b300a5..48c7be7d 100644
--- a/starlingx/README.md
+++ b/starlingx/README.md
@@ -13,3 +13,28 @@
# limitations under the License.
# Micro service of MultiCloud plugin for starlingx.
+
+
+docker-compose -f docker-compose-starlingx.yml build
+
+docker-compose -f docker-compose-starlingx.yml up -d
+
+docker ps
+
+### Test memcached
+docker exec -it openstack_worker_1 sh
+
+cat <<EOF>testmemcached.py
+import memcache
+mem = memcache.Client(['memcached:11211'], debug=1)
+mem.set("testkey1","testvalue1")
+value1 = mem.get("testkey1")
+print("memcached is working" if value1=="testvalue1" else "memcached is not working")
+EOF
+
+python testmemcached.py
+
+exit
+
+docker-compose -f docker-compose-starlingx.yml down
+
diff --git a/starlingx/docker/Dockerfile b/starlingx/docker/Dockerfile
index 79b351d3..d0cb914d 100644
--- a/starlingx/docker/Dockerfile
+++ b/starlingx/docker/Dockerfile
@@ -39,7 +39,7 @@ USER root
# COPY ./ /opt/
COPY ./multicloud-openstack-starlingx-*.zip /opt/multicloud-openstack-starlingx.zip
RUN apk update && \
- apk add pcre pcre-dev uwsgi memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
cd /opt/ && \
unzip -q -o -B /opt/multicloud-openstack-starlingx.zip -d /opt/ && \
rm -f /opt/multicloud-openstack-starlingx.zip && \
diff --git a/starlingx/docker/Dockerfile4composer b/starlingx/docker/Dockerfile4composer
new file mode 100644
index 00000000..e99dce8d
--- /dev/null
+++ b/starlingx/docker/Dockerfile4composer
@@ -0,0 +1,57 @@
+# Copyright (c) 2019 Intel Corporation.
+#
+# 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.
+
+# FROM python:3.8-alpine
+FROM nexus3.onap.org:10001/onap/integration-python:9.1.0
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+
+ENV MSB_PROTO "http"
+ENV MSB_ADDR "127.0.0.1"
+ENV MSB_PORT "80"
+ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
+ENV AAI_PORT "8443"
+ENV AAI_SERVICE_URL ""
+ENV AAI_SCHEMA_VERSION "v13"
+ENV AAI_USERNAME "AAI"
+ENV AAI_PASSWORD "AAI"
+
+EXPOSE 9009
+
+# RUN addgroup -S onap && adduser -S -G onap onap
+USER root
+
+COPY ./starlingx /opt/starlingx/
+COPY ./share /opt/starlingx/lib/share
+# COPY ./ /opt/
+# COPY ./multicloud-openstack-starlingx-*.zip /opt/multicloud-openstack-starlingx.zip
+RUN apk update && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ cd /opt/ && \
+ pip3 install --no-cache-dir -r /opt/starlingx/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/starlingx/uwsgi-requirements.txt && \
+ apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
+ mkdir -p /var/log/onap/multicloud/openstack/starlingx && \
+ chown onap:onap /var/log/onap -R && \
+ chown onap:onap /opt/starlingx -R
+
+RUN mkdir -p /var/log/onap/multicloud/openstack/starlingx/
+
+USER onap
+WORKDIR /opt/starlingx
+CMD /bin/sh -c "/opt/starlingx/run.sh"
diff --git a/starlingx/run.sh b/starlingx/run.sh
index 66dd111f..81d2df39 100755
--- a/starlingx/run.sh
+++ b/starlingx/run.sh
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
+# memcached should be provided as sidecar to avoid GPLv3 license issue
+# memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
export PYTHONPATH=lib/share
# uwsgi --http :9009 --module starlingx.wsgi --master --processes 4
diff --git a/starlingx/starlingx/pub/config/log.yml b/starlingx/starlingx/pub/config/log.yml
index ef68a653..d819c233 100644
--- a/starlingx/starlingx/pub/config/log.yml
+++ b/starlingx/starlingx/pub/config/log.yml
@@ -16,11 +16,11 @@ version: 1
disable_existing_loggers: False
loggers:
- starlingx:
+ starlingx_base:
handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
- starlingx_base:
+ starlingx:
handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
@@ -32,6 +32,7 @@ loggers:
handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
+
handlers:
console_handler:
level: "DEBUG"
@@ -44,3 +45,7 @@ handlers:
formatter: "standard"
maxBytes: 52428800
backupCount: 10
+
+formatters:
+ standard:
+ format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s"
diff --git a/starlingx/starlingx/settings.py b/starlingx/starlingx/settings.py
index d5362e4b..c19e8571 100644
--- a/starlingx/starlingx/settings.py
+++ b/starlingx/starlingx/settings.py
@@ -80,14 +80,25 @@ TIME_ZONE = 'UTC'
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
+MEMCACHED_HOST = os.environ.get('MEMCACHED_HOST', '127.0.0.1')
+MEMCACHED_PORT = os.environ.get('MEMCACHED_PORT', '11211')
+DEFAULT_CACHE_BACKEND_LOCATION = "%s:%s" % (MEMCACHED_HOST, MEMCACHED_PORT)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'LOCATION': '127.0.0.1:11211',
+ 'LOCATION': DEFAULT_CACHE_BACKEND_LOCATION,
}
}
+# [RABBITMQ]
+RABBITMQ_DEFAULT_USER = os.environ.get('RABBITMQ_DEFAULT_USER', 'guest')
+RABBITMQ_DEFAULT_PASS = os.environ.get('RABBITMQ_DEFAULT_PASS', 'guest')
+RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')
+RABBITMQ_PORT = os.environ.get('RABBITMQ_PORT', '5672')
+RABBITMQ_URL = "amqp://%s:%s@%s:%s//" % (
+ RABBITMQ_DEFAULT_USER, RABBITMQ_DEFAULT_PASS, RABBITMQ_HOST, RABBITMQ_PORT)
+
# [MSB]
DEFAULT_MSB_PROTO = "http"
MSB_SERVICE_PROTOCOL = os.environ.get('MSB_PROTO', DEFAULT_MSB_PROTO)
diff --git a/starlingx/stop.sh b/starlingx/stop.sh
index 3f7fd2a1..8de97f96 100755
--- a/starlingx/stop.sh
+++ b/starlingx/stop.sh
@@ -15,4 +15,4 @@
#ps auxww | grep 'manage.py runserver 0.0.0.0:9009' | awk '{print $2}' | xargs kill -9
ps auxww |grep 'uwsgi --http :9009 --module starlingx.wsgi --master' |awk '{print $2}' |xargs kill -9
-ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
+# ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
diff --git a/windriver/README.md b/windriver/README.md
index d3bcc195..f6dcf8ad 100644
--- a/windriver/README.md
+++ b/windriver/README.md
@@ -13,3 +13,26 @@
# limitations under the License.
# Micro service of MultiCloud plugin for Wind River Titanium Cloud.
+
+docker-compose -f docker-compose-windriver.yml build
+
+docker-compose -f docker-compose-windriver.yml up -d
+
+docker ps
+
+### Test memcached
+docker exec -it openstack_worker_1 sh
+
+cat <<EOF>testmemcached.py
+import memcache
+mem = memcache.Client(['memcached:11211'], debug=1)
+mem.set("testkey1","testvalue1")
+value1 = mem.get("testkey1")
+print("memcached is working" if value1=="testvalue1" else "memcached is not working")
+EOF
+
+python testmemcached.py
+
+exit
+
+docker-compose -f docker-compose-windriver.yml down
diff --git a/windriver/docker/Dockerfile b/windriver/docker/Dockerfile
index 0f26f13b..4815c3b0 100644
--- a/windriver/docker/Dockerfile
+++ b/windriver/docker/Dockerfile
@@ -24,7 +24,7 @@ USER root
# COPY ./ /opt/windriver/
COPY ./multicloud-openstack-windriver-*.zip /opt/multicloud-openstack-windriver.zip
RUN apk update && \
- apk add pcre pcre-dev uwsgi memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
cd /opt/ && \
unzip -q -o -B multicloud-openstack-windriver.zip && \
chmod +x /opt/windriver/*.sh && \
diff --git a/windriver/docker/Dockerfile4composer b/windriver/docker/Dockerfile4composer
new file mode 100644
index 00000000..5d0dfc35
--- /dev/null
+++ b/windriver/docker/Dockerfile4composer
@@ -0,0 +1,42 @@
+# FROM python:3.8-alpine
+FROM nexus3.onap.org:10001/onap/integration-python:9.1.0
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+
+ENV MSB_PROTO "http"
+ENV MSB_ADDR "127.0.0.1"
+ENV MSB_PORT "80"
+ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
+ENV AAI_PORT "8443"
+ENV AAI_SCHEMA_VERSION "v13"
+ENV AAI_USERNAME "AAI"
+ENV AAI_PASSWORD "AAI"
+
+EXPOSE 9005
+
+# RUN addgroup -S onap && adduser -S -G onap onap
+USER root
+
+COPY ./windriver /opt/windriver/
+COPY ./share /opt/windriver/lib/share
+# COPY ./ /opt/windriver/
+# COPY ./multicloud-openstack-windriver-*.zip /opt/multicloud-openstack-windriver.zip
+RUN apk update && \
+ apk add pcre pcre-dev uwsgi wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ cd /opt/ && \
+ chmod +x /opt/windriver/*.sh && \
+ pip3 install --no-cache-dir -r /opt/windriver/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/windriver/uwsgi-requirements.txt && \
+ apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
+ mkdir -p /var/log/onap/multicloud/openstack/windriver && \
+ chown onap:onap /var/log/onap -R && \
+ chown onap:onap /opt/windriver -R
+
+USER onap
+
+WORKDIR /opt/windriver
+CMD /bin/sh -c /opt/windriver/run.sh
diff --git a/windriver/run.sh b/windriver/run.sh
index c65ecdf8..32a0a5bb 100644
--- a/windriver/run.sh
+++ b/windriver/run.sh
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
+# memcached should be provided as sidecar to avoid GPLv3 license issue
+# memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid
export PYTHONPATH=lib/share
#nohup python manage.py runserver 0.0.0.0:9005 2>&1 &
diff --git a/windriver/stop.sh b/windriver/stop.sh
index 882fb74d..5570eef7 100644
--- a/windriver/stop.sh
+++ b/windriver/stop.sh
@@ -15,4 +15,4 @@
#ps auxww | grep 'manage.py runserver 0.0.0.0:9005' | awk '{print $2}' | xargs kill -9
ps auxww |grep 'uwsgi --http :9005 --module titanium_cloud.wsgi --master' |awk '{print $2}' |xargs kill -9
-ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
+# ps auxww | grep 'memcached -d -m 2048 -c 1024 -p 11211 -P /tmp/memcached1.pid' | awk '{print $2}' | xargs kill -9
diff --git a/windriver/titanium_cloud/pub/config/log.yml b/windriver/titanium_cloud/pub/config/log.yml
index 280980d0..cb61b526 100644
--- a/windriver/titanium_cloud/pub/config/log.yml
+++ b/windriver/titanium_cloud/pub/config/log.yml
@@ -1,31 +1,38 @@
+
version: 1
disable_existing_loggers: False
loggers:
- titanium_cloud:
- handlers: [titanium_cloud_handler]
+ starlingx_base:
+ handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
- newton_base:
- handlers: [titanium_cloud_handler]
+ starlingx:
+ handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
- common:
- handlers: [titanium_cloud_handler]
+ newton_base:
+ handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
- starlingx_base:
- handlers: [titanium_cloud_handler]
+ common:
+ handlers: [console_handler, file_handler]
level: "DEBUG"
propagate: False
+
handlers:
- titanium_cloud_handler:
+ console_handler:
+ level: "DEBUG"
+ class: "logging.StreamHandler"
+ formatter: "standard"
+ file_handler:
level: "DEBUG"
class: "logging.handlers.RotatingFileHandler"
filename: "/var/log/onap/multicloud/openstack/windriver/titanium_cloud.log"
formatter: "standard"
maxBytes: 52428800
backupCount: 10
+
formatters:
standard:
format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s"
diff --git a/windriver/titanium_cloud/settings.py b/windriver/titanium_cloud/settings.py
index eee2f1d6..8a4be612 100644
--- a/windriver/titanium_cloud/settings.py
+++ b/windriver/titanium_cloud/settings.py
@@ -80,7 +80,10 @@ STATIC_URL = '/static/'
DEFAULT_MSB_PROTO = "http"
DEFAULT_MSB_ADDR = "127.0.0.1"
-DEFAULT_CACHE_BACKEND_LOCATION = '127.0.0.1:11211'
+# DEFAULT_CACHE_BACKEND_LOCATION = '127.0.0.1:11211'
+MEMCACHED_HOST = os.environ.get('MEMCACHED_HOST', '127.0.0.1')
+MEMCACHED_PORT = os.environ.get('MEMCACHED_PORT', '11211')
+DEFAULT_CACHE_BACKEND_LOCATION = "%s:%s" % (MEMCACHED_HOST, MEMCACHED_PORT)
CACHES = {
'default': {
@@ -89,6 +92,14 @@ CACHES = {
}
}
+# [RABBITMQ]
+RABBITMQ_DEFAULT_USER = os.environ.get('RABBITMQ_DEFAULT_USER', 'guest')
+RABBITMQ_DEFAULT_PASS = os.environ.get('RABBITMQ_DEFAULT_PASS', 'guest')
+RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')
+RABBITMQ_PORT = os.environ.get('RABBITMQ_PORT', '5672')
+RABBITMQ_URL = "amqp://%s:%s@%s:%s//" % (
+ RABBITMQ_DEFAULT_USER, RABBITMQ_DEFAULT_PASS, RABBITMQ_HOST, RABBITMQ_PORT)
+
# [MSB]
MSB_SERVICE_PROTOCOL = os.environ.get('MSB_PROTO', DEFAULT_MSB_PROTO)
MSB_SERVICE_ADDR = os.environ.get('MSB_ADDR', DEFAULT_MSB_ADDR)