summaryrefslogtreecommitdiff
path: root/salt/openbook/admin_web_ui/files
diff options
context:
space:
mode:
authorCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-08-30 13:09:56 -0600
committerCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-08-30 13:09:56 -0600
commit649f0dd9c5ca586d8b637400dd19c0c4059447d6 (patch)
tree5ccc992a3aa5de1bcb510911dfdb21e6a54bd197 /salt/openbook/admin_web_ui/files
initial commit
Diffstat (limited to 'salt/openbook/admin_web_ui/files')
-rw-r--r--salt/openbook/admin_web_ui/files/Dockerfile8
-rw-r--r--salt/openbook/admin_web_ui/files/admin_web_ui.json3
-rw-r--r--salt/openbook/admin_web_ui/files/build.sh35
-rw-r--r--salt/openbook/admin_web_ui/files/installdeps.sh11
-rw-r--r--salt/openbook/admin_web_ui/files/run.sh4
-rw-r--r--salt/openbook/admin_web_ui/files/start_app.sh3
6 files changed, 64 insertions, 0 deletions
diff --git a/salt/openbook/admin_web_ui/files/Dockerfile b/salt/openbook/admin_web_ui/files/Dockerfile
new file mode 100644
index 0000000..4b57ce5
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/Dockerfile
@@ -0,0 +1,8 @@
+FROM {{ pillar["baseimage"]["image_name"] }}
+MAINTAINER Carlos Konstanski <carlos@talligent.com>
+ADD docker-start.tar.xz /
+EXPOSE 8082 5701 5702
+VOLUME {{ pillar["admin_web_ui"]["dirs"]["etc_openbook_admin_web_ui"]["name"] }}
+VOLUME {{ pillar["admin_web_ui"]["dirs"]["var_log_openbook_admin_web_ui"]["name"] }}
+RUN /installdeps.sh
+ENTRYPOINT [ "/start_app.sh" ]
diff --git a/salt/openbook/admin_web_ui/files/admin_web_ui.json b/salt/openbook/admin_web_ui/files/admin_web_ui.json
new file mode 100644
index 0000000..6008b92
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/admin_web_ui.json
@@ -0,0 +1,3 @@
+{
+ "log.path": "{{ pillar["admin_web_ui"]["log"] }}"
+}
diff --git a/salt/openbook/admin_web_ui/files/build.sh b/salt/openbook/admin_web_ui/files/build.sh
new file mode 100644
index 0000000..0964047
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/build.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Do not call directly. Meant to be called from CI build script.
+
+pushd {{ pillar["admin_web_ui"]["build_dir"] }} 2>/dev/null
+
+echo "Creating tmp directory"
+rm -rf tmp
+mkdir tmp
+rm -f docker-start.tar.xz
+
+echo "Populating with custom files"
+rsync -aq data/ tmp/
+
+echo "Repackaging into .xz file"
+tar Jcvf docker-start.tar.xz -C tmp/ .
+
+echo "Deleting existing docker container"
+docker stop {{ pillar["admin_web_ui"]["container_name"] }}
+docker container prune -f
+docker rmi -f {{ pillar["admin_web_ui"]["image_name"] }}
+
+echo "Building docker Ubuntu image"
+docker build -t {{ pillar["admin_web_ui"]["image_name"] }} .
+
+echo "Push docker image to the registry"
+docker tag {{ pillar["admin_web_ui"]["image_name"] }} {{ pillar["registry"]["url"] }}/{{ pillar["admin_web_ui"]["image_name"] }}
+docker push {{ pillar["registry"]["url"] }}/{{ pillar["admin_web_ui"]["image_name"] }}
+
+echo "Cleaning up"
+rm -rf tmp
+rm -f docker-start.tar.xz
+
+popd 2>/dev/null
+exit 0
diff --git a/salt/openbook/admin_web_ui/files/installdeps.sh b/salt/openbook/admin_web_ui/files/installdeps.sh
new file mode 100644
index 0000000..7de3c7c
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/installdeps.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless
+
+curl -k \
+ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \
+ -o "{{ pillar["admin_web_ui"]["jar_name"] }}" \
+ "{{ pillar["jars"]["url"] }}{{ pillar["admin_web_ui"]["jar_name"] }}"
+
+exit 0
diff --git a/salt/openbook/admin_web_ui/files/run.sh b/salt/openbook/admin_web_ui/files/run.sh
new file mode 100644
index 0000000..9669172
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/run.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+docker run -d --net=host -v {{ pillar["admin_web_ui"]["dirs"]["etc_openbook_admin_web_ui"]["name"] }}:{{ pillar["admin_web_ui"]["dirs"]["etc_openbook_admin_web_ui"]["name"] }} -v {{ pillar["admin_web_ui"]["dirs"]["var_log_openbook_admin_web_ui"]["name"] }}:{{ pillar["admin_web_ui"]["dirs"]["var_log_openbook_admin_web_ui"]["name"] }} --name {{ pillar["admin_web_ui"]["container_name"] }} {{ pillar["registry"]["url"] }}/{{ pillar["admin_web_ui"]["image_name"] }}
+exit 0
diff --git a/salt/openbook/admin_web_ui/files/start_app.sh b/salt/openbook/admin_web_ui/files/start_app.sh
new file mode 100644
index 0000000..86daad4
--- /dev/null
+++ b/salt/openbook/admin_web_ui/files/start_app.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec java -jar {{ pillar["admin_web_ui"]["jar_name"] }} run com.talligent.openbook.verticle.Startup --cluster