aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorStamatis Katsaounis <mokats@intracom-telecom.com>2018-12-05 12:40:42 +0200
committerStamatis Katsaounis <mokats@intracom-telecom.com>2019-03-08 09:08:27 +0000
commit5f20495d6e3ec984c4e86fd76399ddf0d042b336 (patch)
tree80b452fbd39b6e1968df4b5aa2a632659f50eceb /docker
parent90cb4dca7713f84154fe2ad4c2f5e7145560f3c7 (diff)
Prepare Web Portal for ONAP integration
This patch applies all the required changes in order to support a second web portal container with the onap web portal content. Change-Id: I2f59776313bf2067dbdfb04445620b5241716ebb Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/.gitignore3
-rw-r--r--docker/Dockerfile.api7
-rw-r--r--docker/Dockerfile.web17
-rw-r--r--docker/config.env.sample3
-rw-r--r--docker/docker-compose.yml47
-rw-r--r--docker/nginx/sites-available/default-onap64
-rw-r--r--docker/nginx/sites-available/default-opnfv (renamed from docker/nginx/sites-available/default)20
-rwxr-xr-xdocker/prepare-env.sh1
-rwxr-xr-xdocker/start-nginx.sh4
9 files changed, 125 insertions, 41 deletions
diff --git a/docker/.gitignore b/docker/.gitignore
index af398fe..5ef677d 100644
--- a/docker/.gitignore
+++ b/docker/.gitignore
@@ -1,2 +1,3 @@
config.env
-vhost.env
+vhost-opnfv.env
+vhost-onap.env
diff --git a/docker/Dockerfile.api b/docker/Dockerfile.api
index d40562a..b414dd3 100644
--- a/docker/Dockerfile.api
+++ b/docker/Dockerfile.api
@@ -49,9 +49,10 @@ RUN apt-get update && apt-get install -y \
RUN pip install -U setuptools
-RUN git clone https://gerrit.opnfv.org/gerrit/dovetail-webportal $HOME/testapi && \
- cd $HOME/testapi && \
- git checkout -f $BRANCH && \
+RUN git init $HOME/testapi && \
+ (cd $HOME/testapi && \
+ git fetch --tags https://gerrit.opnfv.org/gerrit/dovetail-webportal $BRANCH && \
+ git checkout FETCH_HEAD) && \
mkdir -p $HOME/testapi/logs/api && \
mkdir -p $HOME/testapi/media/companies
diff --git a/docker/Dockerfile.web b/docker/Dockerfile.web
index 853e0f8..e5c39a1 100644
--- a/docker/Dockerfile.web
+++ b/docker/Dockerfile.web
@@ -10,6 +10,8 @@ MAINTAINER Leo Wang <grakiss.wanglei@huawei.com>
LABEL version="v2" description="OVP nginx"
ARG BRANCH=master
+ARG GUI=testapi-ui
+ARG CONTAINER=opnfv
ENV HOME /home
WORKDIR $HOME
@@ -22,16 +24,17 @@ RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*
-RUN git clone https://gerrit.opnfv.org/gerrit/dovetail-webportal $HOME/testapi && \
- cd $HOME/testapi && \
- git checkout -f $BRANCH && \
- cd $HOME/testapi/3rd_party/static/testapi-ui && \
+RUN git init $HOME/testapi && \
+ (cd $HOME/testapi && \
+ git fetch --tags https://gerrit.opnfv.org/gerrit/dovetail-webportal $BRANCH && \
+ git checkout FETCH_HEAD) && \
+ cd $HOME/testapi/3rd_party/static/$GUI && \
npm install && \
- mkdir /www && \
- cp -r $HOME/testapi/3rd_party/static /www/
+ mkdir -p /www/static && \
+ cp -r $HOME/testapi/3rd_party/static/$GUI /www/static
ADD nginx/nginx.conf /etc/nginx/nginx.conf
-ADD nginx/sites-available/default /etc/nginx/sites-available/default
+ADD nginx/sites-available/default-$CONTAINER /etc/nginx/sites-available/default
ADD supervisor/conf.d/nginx.conf /etc/supervisor/conf.d/nginx.conf
ADD start-nginx.sh $HOME/start-nginx.sh
diff --git a/docker/config.env.sample b/docker/config.env.sample
index 003d92f..f824c22 100644
--- a/docker/config.env.sample
+++ b/docker/config.env.sample
@@ -1,3 +1,4 @@
mongodb_url=mongodb://mongodb:27017/
base_url=http://ovp.localhost
-testapi_url=cvpapi:8010
+testapi_url=lfnapi:8010
+PYTHONUNBUFFERED=True
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 4edf4cc..15e28f7 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -3,47 +3,62 @@ version: '3'
services:
mongodb:
image: mongo:3.2.1
- container_name: cvp-db
+ container_name: lfn-db
volumes:
- - cvp-db:/data/db
+ - lfn-db:/data/db
expose:
- "27017"
- web:
+ webopnfv:
image: opnfv/dovetail-webportal-web:latest
- container_name: cvp-web
+ container_name: web-opnfv
restart: always
env_file:
- config.env
- - vhost.env
+ - vhost-opnfv.env
volumes:
- - cvp-testapi-logs:/home/testapi/logs
+ - lfn-testapi-logs:/home/testapi/logs
links:
- mongodb
- - cvpapi
+ - lfnapi
ports:
- "8000:8000"
- cvpapi:
+ webonap:
+ image: opnfv/dovetail-webportal-web-onap:latest
+ container_name: web-onap
+ restart: always
+ env_file:
+ - config.env
+ - vhost-onap.env
+ volumes:
+ - lfn-testapi-logs:/home/testapi/logs
+ links:
+ - mongodb
+ - lfnapi
+ ports:
+ - "8001:8000"
+ lfnapi:
image: opnfv/dovetail-webportal-api:latest
- container_name: cvp-cvpapi
+ container_name: lfn-api
env_file:
- config.env
volumes:
- - cvp-testapi-logs:/home/testapi/logs
- - cvp-company-logos:/home/testapi/media/companies
+ - lfn-testapi-logs:/home/testapi/logs
+ - lfn-company-logos:/home/testapi/media/companies
ports:
- "8010:8010"
nginx:
image: jwilder/nginx-proxy
- container_name: cvp-nginx
+ container_name: lfn-nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx-proxy/custom_proxy_settings.conf:/etc/nginx/conf.d/custom_proxy_settings.conf
depends_on:
- - web
+ - webopnfv
+ - webonap
ports:
- "80:80"
volumes:
- cvp-db:
- cvp-company-logos:
- cvp-testapi-logs:
+ lfn-db:
+ lfn-company-logos:
+ lfn-testapi-logs:
diff --git a/docker/nginx/sites-available/default-onap b/docker/nginx/sites-available/default-onap
new file mode 100644
index 0000000..e6aecb1
--- /dev/null
+++ b/docker/nginx/sites-available/default-onap
@@ -0,0 +1,64 @@
+upstream lfnapi {
+ server lfnapi:8010;
+}
+
+server {
+ listen 8000 default_server;
+ listen [::]:8000 default_server ipv6only=on;
+
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+
+ server_name localhost;
+
+ location ~* /onap-ui/ {
+ root /www/static;
+ expires 1d;
+ }
+
+ location ~* /logs/.*\.(log|out|yaml|yml|txt|conf|json|sh|)$ {
+ root /home/testapi;
+ add_header Content-Type text/plain;
+ }
+
+ location ~* /logs/.*/results {
+ root /home/testapi;
+ expires 1d;
+ autoindex on;
+ autoindex_exact_size off;
+ autoindex_localtime on;
+ }
+
+ location ~* /logs/api {
+ root /home/testapi;
+ expires 1d;
+ autoindex on;
+ autoindex_exact_size on;
+ autoindex_localtime on;
+ }
+
+ location = /api/v1/onap/results/upload {
+ client_max_body_size 20m;
+ proxy_pass http://lfnapi/api/v1/onap/results/upload;
+ proxy_set_header X-Real_IP $remote_addr;
+ proxy_set_header Host $host;
+ }
+
+ location /api/v1/ {
+ proxy_pass http://lfnapi/api/v1/;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header Host $host;
+ }
+
+ location / {
+ root /www/static/onap-ui;
+ expires 1d;
+ }
+
+ error_page 413 =200 /413.json;
+
+ location /413.json {
+ return 200 '{"msg": "Please upload a file less than 20MB.", "code": 413}';
+ }
+
+}
diff --git a/docker/nginx/sites-available/default b/docker/nginx/sites-available/default-opnfv
index 7652eb1..f271fb4 100644
--- a/docker/nginx/sites-available/default
+++ b/docker/nginx/sites-available/default-opnfv
@@ -1,5 +1,5 @@
-upstream cvpapi {
- server cvpapi:8010;
+upstream lfnapi {
+ server lfnapi:8010;
}
server {
@@ -38,50 +38,50 @@ server {
}
location /api/v1/cvp {
- proxy_pass http://cvpapi/api/v1/cvp;
+ proxy_pass http://lfnapi/api/v1/cvp;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location /api/v1/auth {
- proxy_pass http://cvpapi/api/v1/auth;
+ proxy_pass http://lfnapi/api/v1/auth;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location /api/v1/profile {
- proxy_pass http://cvpapi/api/v1/profile;
+ proxy_pass http://lfnapi/api/v1/profile;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location /api/v1/test {
- proxy_pass http://cvpapi/api/v1/test;
+ proxy_pass http://lfnapi/api/v1/test;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location = /api/v1/results {
- proxy_pass http://cvpapi/api/v1/results;
+ proxy_pass http://lfnapi/api/v1/results;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location ~* /api/v1/results/([a-zA-Z0-9]+) {
client_max_body_size 20m;
- proxy_pass http://cvpapi/api/v1/results/$1;
+ proxy_pass http://lfnapi/api/v1/results/$1;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header Host $host;
}
location ~* /api/v1/suts/hardware/([a-zA-Z0-9\-]+) {
- proxy_pass http://cvpapi/api/v1/suts/hardware/$1;
+ proxy_pass http://lfnapi/api/v1/suts/hardware/$1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location /api/v1/ {
- proxy_pass http://cvpapi/api/v1/;
+ proxy_pass http://lfnapi/api/v1/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
diff --git a/docker/prepare-env.sh b/docker/prepare-env.sh
index 61ff233..762e741 100755
--- a/docker/prepare-env.sh
+++ b/docker/prepare-env.sh
@@ -11,5 +11,4 @@ if [ "$base_url" != "" ]; then
sudo crudini --set --existing $FILE swagger base_url $base_url
sudo crudini --set --existing $FILE ui url $base_url
sudo crudini --set --existing $FILE jira OAUTH_CALLBACK_URL $base_url/api/v1/auth/signin_return_jira
- sudo crudini --set --existing $FILE lfid return_url $base_url/api/v1/auth/signin_return_cas
fi
diff --git a/docker/start-nginx.sh b/docker/start-nginx.sh
index c9949be..5f33847 100755
--- a/docker/start-nginx.sh
+++ b/docker/start-nginx.sh
@@ -1,8 +1,8 @@
#!/bin/bash
-FILE=/etc/nginx/sites-enabled/default
+NGINX_CONF=/etc/nginx/sites-enabled/default
if [ "$testapi_url" != "" ]; then
- sed -i "s/server localhost:8010/server $testapi_url/" $FILE
+ sed -i "s/server lfnapi:8010/server $testapi_url/" $NGINX_CONF
fi
service supervisor start