summaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2018-10-05 16:05:20 -0700
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2018-10-08 17:03:33 -0700
commitf2e83b24260b018bb7cc30421eda6c9a8cebc309 (patch)
tree14b462dd803352a1321b07bc5125e27da59158ae /dashboard
parent2ea6c6198bc2aac73b04edad8c5a10d5534cdc2e (diff)
Development Override Compose File
Now that images are built and hosted for the dashboard and worker container the compose file can reference upstream images instead of ones locally built. A second compose file is added which overrides compose configuration so that images are built locally. Initial commands for running the container are moved into 'init.sh' which gets copied into the image, since the current images cannot be ran by themselves as they require the command listed in the compose file. The compose version bumped from 2 to 3 as there are no version 2 specific features being used that need to be modified. Change-Id: I23813a859a676ba009cba8f5a62b7153da006eef Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/Makefile11
-rw-r--r--dashboard/docker-compose.override-dev.yml25
-rw-r--r--dashboard/docker-compose.yml27
-rw-r--r--dashboard/readme.txt17
-rw-r--r--dashboard/requirements.txt (renamed from dashboard/web/requirements.txt)0
-rw-r--r--dashboard/src/static/bower.json3
-rw-r--r--dashboard/web/Dockerfile29
-rwxr-xr-xdashboard/web/init.sh12
-rw-r--r--dashboard/worker/Dockerfile22
-rwxr-xr-xdashboard/worker/init.sh10
-rw-r--r--dashboard/worker/requirements.txt18
11 files changed, 123 insertions, 51 deletions
diff --git a/dashboard/Makefile b/dashboard/Makefile
index 9070917..e5f4fb2 100644
--- a/dashboard/Makefile
+++ b/dashboard/Makefile
@@ -1,5 +1,14 @@
build:
- docker-compose build
+ docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml build
+
+dev-up:
+ docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml up -d
+
+dev-start:
+ docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml start
+
+dev-stop:
+ docker-compose -f docker-compose.yml -f docker-compose.override-dev.yml stop
up:
docker-compose up -d
diff --git a/dashboard/docker-compose.override-dev.yml b/dashboard/docker-compose.override-dev.yml
new file mode 100644
index 0000000..e1e1632
--- /dev/null
+++ b/dashboard/docker-compose.override-dev.yml
@@ -0,0 +1,25 @@
+---
+##############################################################################
+# Copyright (c) 2018 Trevor Bramwell and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+version: '3'
+services:
+ web:
+ image: opnfv/pharos-tools-laas-dashboard:dev
+ build:
+ context: .
+ dockerfile: web/Dockerfile
+ volumes:
+ - ./src:/pharos_dashboard
+ worker:
+ image: opnfv/pharos-tools-laas-celery:dev
+ build:
+ context: .
+ dockerfile: worker/Dockerfile
+ volumes:
+ - ./src:/pharos_dashboard
diff --git a/dashboard/docker-compose.yml b/dashboard/docker-compose.yml
index 4e57ff3..19e9afd 100644
--- a/dashboard/docker-compose.yml
+++ b/dashboard/docker-compose.yml
@@ -7,9 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
-
-version: '2'
+version: '3'
services:
nginx:
restart: always
@@ -19,27 +17,23 @@ services:
- "80:80"
volumes:
- ./config/nginx:/etc/nginx/conf.d
- - /var/lib/pharos_dashboard/static:/static
- - /var/lib/pharos_dashboard/media:/media
+ - pharos-static:/static:ro
+ - pharos-media:/media
depends_on:
- web
web:
+ image: opnfv/pharos-tools-laas-dashboard:latest
restart: always
- build: ./web/
container_name: dg01
- # yamllint disable rule:line-length
- command: bash -c "python manage.py migrate && python manage.py collectstatic --no-input && gunicorn pharos_dashboard.wsgi -b 0.0.0.0:8000"
- # yamllint enable rule:line-length
depends_on:
- postgres
links:
- postgres
env_file: config.env
volumes:
- - ./:/pharos_dashboard
- - /var/lib/pharos_dashboard/static:/static
- - /var/lib/pharos_dashboard/media:/media
+ - pharos-static:/pharos_dashboard/static/
+ - pharos-media:/pharos_dashboard/media/
expose:
- "8000"
@@ -59,17 +53,14 @@ services:
- "5672:5672"
worker:
+ image: opnfv/pharos-tools-laas-celery:latest
restart: always
- build: ./worker/
- # yamllint disable rule:line-length
- command: bash -c "celery -A pharos_dashboard worker -l info -B --schedule=~/celerybeat-schedule"
- # yamllint enable rule:line-length
env_file: config.env
links:
- postgres
- rabbitmq
- volumes:
- - ./:/pharos_dashboard
volumes:
+ pharos-media:
+ pharos-static:
pharos-data:
external: true
diff --git a/dashboard/readme.txt b/dashboard/readme.txt
index 2a25912..96ece92 100644
--- a/dashboard/readme.txt
+++ b/dashboard/readme.txt
@@ -9,23 +9,24 @@
The dashboard is deployed using docker-compose.
-Application / database files are saved in /var/lib/pharos_dashboard/.
+
+Application / database files are saved in the 'pharos-data' container
+which needs to be pre-built before bringing up the dashboard.
Deployment:
- clone the repository
- complete the config.env.sample file and save it as config.env
-- install docker, docker-compose and bower
-- run 'bower install' in ./src/static/ to fetch javascript dependencies
-- run 'make build' to build the containers
+- install docker, docker-compose
- run 'make data'
- run 'make up' to run the dashboard
Updating:
+- run 'docker-compose pull'
+- run 'docker-compose up -d'
- make stop
- git pull
-- run 'bower install' if javascript dependencies changed
- make build
- make start
@@ -34,3 +35,9 @@ If there is migrations that need user input (like renaming a field), they need t
Logs / Shell access:
- there is some shortcuts in the makefile
+
+Development:
+
+- Install dependencies listed in 'Deployment'
+- run 'make build'
+- run 'make dev-up'
diff --git a/dashboard/web/requirements.txt b/dashboard/requirements.txt
index 19365bc..19365bc 100644
--- a/dashboard/web/requirements.txt
+++ b/dashboard/requirements.txt
diff --git a/dashboard/src/static/bower.json b/dashboard/src/static/bower.json
index f473747..9ae744a 100644
--- a/dashboard/src/static/bower.json
+++ b/dashboard/src/static/bower.json
@@ -20,5 +20,8 @@
"fullcalendar": "^2.9.0",
"jquery-migrate": "^3.0.0",
"startbootstrap-sb-admin-2-blackrockdigital": "^3.3.7"
+ },
+ "resolutions": {
+ "font-awesome": "~4.6.3"
}
}
diff --git a/dashboard/web/Dockerfile b/dashboard/web/Dockerfile
index 228b0b0..a153192 100644
--- a/dashboard/web/Dockerfile
+++ b/dashboard/web/Dockerfile
@@ -1,7 +1,26 @@
+##############################################################################
+# Copyright (c) 2018 Trevor Bramwell and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+FROM node as static
+RUN npm install -g bower
+ADD src/static/ /static
+WORKDIR /static/
+RUN bower install --allow-root
+
FROM python:3.5
ENV PYTHONUNBUFFERED 1
-RUN mkdir /config
-ADD ./requirements.txt /config/
-RUN pip install -r /config/requirements.txt
-RUN mkdir -p /pharos_dashboard/src
-WORKDIR /pharos_dashboard/src
+
+ADD requirements.txt /requirements.txt
+RUN pip install -r /requirements.txt
+
+ADD web/init.sh /init.sh
+ADD src/ /pharos_dashboard/
+COPY --from=static /static/ pharos_dashboard/static/
+
+WORKDIR /pharos_dashboard/
+CMD ["/init.sh"]
diff --git a/dashboard/web/init.sh b/dashboard/web/init.sh
new file mode 100755
index 0000000..736acc1
--- /dev/null
+++ b/dashboard/web/init.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+##############################################################################
+# Copyright (c) 2018 Trevor Bramwell and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+python manage.py migrate && \
+python manage.py collectstatic --no-input && \
+gunicorn pharos_dashboard.wsgi -b 0.0.0.0:8000
diff --git a/dashboard/worker/Dockerfile b/dashboard/worker/Dockerfile
index c1e8aff..cd0f797 100644
--- a/dashboard/worker/Dockerfile
+++ b/dashboard/worker/Dockerfile
@@ -1,8 +1,22 @@
+##############################################################################
+# Copyright (c) 2018 Trevor Bramwell and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
FROM python:3.5
ENV PYTHONUNBUFFERED 1
-RUN mkdir /config
-ADD ./requirements.txt /config/
-RUN pip install -r /config/requirements.txt
+
+ADD requirements.txt /requirements.txt
+RUN pip install -r /requirements.txt
+
+ADD worker/init.sh /init.sh
+ADD src/ /pharos_dashboard/
+
RUN useradd -ms /bin/bash celery
USER celery
-WORKDIR /pharos_dashboard/src
+
+WORKDIR /pharos_dashboard/
+CMD ["/init.sh"]
diff --git a/dashboard/worker/init.sh b/dashboard/worker/init.sh
new file mode 100755
index 0000000..ecec2a1
--- /dev/null
+++ b/dashboard/worker/init.sh
@@ -0,0 +1,10 @@
+#!/bin/bash -e
+##############################################################################
+# Copyright (c) 2018 Trevor Bramwell and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+celery -A pharos_dashboard worker -l info -B --schedule=~/celerybeat-schedule
diff --git a/dashboard/worker/requirements.txt b/dashboard/worker/requirements.txt
deleted file mode 100644
index 19365bc..0000000
--- a/dashboard/worker/requirements.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-celery==3.1.23
-cryptography==2.3.1
-Django==1.10
-django-bootstrap3==7.0.1
-django-crispy-forms==1.6.0
-django-filter==0.14.0
-django-registration==2.1.2
-djangorestframework==3.4.6
-gunicorn==19.6.0
-jira==1.0.7
-jsonpickle==0.9.3
-oauth2==1.9.0.post1
-oauthlib==1.1.2
-pika==0.10.0
-psycopg2==2.6.2
-PyJWT==1.4.2
-requests==2.11.0
-django-fernet-fields==0.5