Add ciao-webui container files

This commit add the `Dockerfile` and other files
needed in order to build a docker image of
the ciao-webui dashboard

Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
This commit is contained in:
Simental Magana, Marcos
2016-08-24 11:49:46 -05:00
parent f7c030b047
commit f0f36699e8
4 changed files with 144 additions and 0 deletions

18
ciao-webui/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM clearlinux
MAINTAINER marcos.simental.magana@intel.com
ARG WEBUI_VERSION=1.2.8.14
ARG swupd_args
RUN swupd bundle-add network-basic nodejs-basic $swupd_args
RUN mkdir -p /etc/ciao-webui
COPY ciao_config.json /etc/ciao-webui
COPY bootstrap.sh /usr/bin/bootstrap.sh
RUN curl -LOk https://github.com/01org/ciao-webui/archive/v${WEBUI_VERSION}.tar.gz
RUN tar xf v${WEBUI_VERSION}.tar.gz
RUN mv ciao-webui-${WEBUI_VERSION} ciao-webui
CMD '/usr/bin/bootstrap.sh'

54
ciao-webui/README.md Normal file
View File

@@ -0,0 +1,54 @@
Ciao webui
==========
[![](https://images.microbadger.com/badges/image/clearlinux/ciao-webui.svg)](http://microbadger.com/images/clearlinux/ciao-webui "Get your own image badge on microbadger.com")
[![](https://images.microbadger.com/badges/version/clearlinux/ciao-webui.svg)](http://microbadger.com/images/clearlinux/ciao-webui "Get your own version badge on microbadger.com")
This provides a ciao web dashboard container
Build
-----
```
docker build -t clearlinux/ciao-webui .
```
Or just pull it from Dockerhub
------------------------------
```
docker pull clearlinux/ciao-webui
```
Create Ciao-webui SSL certificates
----------------------------------
```
YOUR_HOST=`hostname -f`
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout webui_key.pem \
-out webui_cert.pem -subj "/CN=$YOUR_HOST"
```
Run the Ciao-webui Container
----------------------------
```
docker run -v `pwd`/webui_key.pem:/etc/pki/ciao-webui-key.pem \
-v `pwd`/webui_cert.pem:/etc/pki/ciao-webui-cert.pem \
-e CONTROLLER_HOST=controller.example.com \
-e IDENTITY_HOST=keystone.example.com \
-p 443:443 -d clearlinux/ciao-webui
```
Environment Variables
---------------------
- ``IDENTITY_HOST``
Identity (Keystone) host
- ``CONTROLLER_HOST``
Controller (ciao-controller) host
- ``CERT_PASS``
Passprhase for the ciao-webui certificate
- ``MODE``
Ciao-webui deployment mode (production|development)
default is `production`
Extra Build ARGs
----------------
- ``swupd_args`` Specifies [SWUPD](https://clearlinux.org/documentation/swupdate_how_to_run_the_updater.html) flags
Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#/arg

48
ciao-webui/bootstrap.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
NODE_ENV=$MODE
CONTROLLER_HOST=$CONTROLLER_HOST
IDENTITY_HOST=$IDENTITY_HOST
CERT_PASS=$CERT_PASS
_usage(){
>&2 echo "usage:"
>&2 echo " $ docker run -v /path/to/ciao-webui-key.pem:/etc/pki/ciao-webui-key.pem \\"
>&2 echo " -v /path/to/ciao-webui-cert.pem:/etc/pki/ciao-webui-cert.pem \\"
>&2 echo " -e CONTROLLER_HOST=controller.example.com \\"
>&2 echo " -e IDENTITY_HOST=keystone.example.com \\"
>&2 echo "(optional: -e CERT_PASS=certificate_passphrase )"
}
if [[ -z $MODE ]] ; then
NODE_ENV="production"
fi
if [[ -z $CONTROLLER_HOST || -z $IDENTITY_HOST ]] ; then
>&2 echo -e "missing CONTROLLER_HOST or IDENTITY_HOST arguments\n"
_usage
exit
fi
if [[ ! -r /etc/pki/ciao-webui-key.pem ]] ; then
>&2 echo -e "missing /etc/pki/ciao-webui-key.pem\n"
_usage
exit
fi
if [[ ! -r /etc/pki/ciao-webui-cert.pem ]] ; then
>&2 echo -e "missing /etc/pki/ciao-webui-cert.pem\n"
_usage
exit
fi
sed -i.bak s/##MODE##/$NODE_ENV/g /etc/ciao-webui/ciao_config.json
sed -i.bak s/##CONTROLLER_HOST##/$CONTROLLER_HOST/g /etc/ciao-webui/ciao_config.json
sed -i.bak s/##KEYSTONE_HOST##/$IDENTITY_HOST/g /etc/ciao-webui/ciao_config.json
sed -i.bak s/##CERT_PASS##/$CERT_PASS/g /etc/ciao-webui/ciao_config.json
ln -sf /etc/ciao-webui/ciao_config.json /ciao-webui/config/ciao_config.json
cd /ciao-webui
export PORT=443
./deploy.sh $NODE_ENV

View File

@@ -0,0 +1,24 @@
{
"##MODE##": {
"controller": {
"host": "##CONTROLLER_HOST##",
"port": "8774",
"protocol": "https"
},
"keystone": {
"host": "##KEYSTONE_HOST##",
"port": "35357",
"protocol": "https",
"uri": "/v3/auth/tokens"
},
"ui": {
"protocol": "https",
"certificates": {
"key": "/etc/pki/ciao-webui-key.pem",
"cert": "/etc/pki/ciao-webui-cert.pem",
"passphrase": "##CERT_PASS##",
"trusted": []
}
}
}
}