summaryrefslogtreecommitdiff
path: root/salt/openbook/admin_api_server/files
diff options
context:
space:
mode:
authorCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-09-21 20:54:25 -0600
committerCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-09-21 20:54:25 -0600
commit412c4c232cafde4cf59bb6e5225454bcca92a29d (patch)
tree9e838d99a53bcad90f712d531c4d904ee3d96782 /salt/openbook/admin_api_server/files
parent823dd08650327cd935b27fbe05b8dd646183dc20 (diff)
adding new microservices
Diffstat (limited to 'salt/openbook/admin_api_server/files')
-rw-r--r--salt/openbook/admin_api_server/files/Dockerfile8
-rw-r--r--salt/openbook/admin_api_server/files/admin_api_server.json15
-rw-r--r--salt/openbook/admin_api_server/files/build.sh35
-rw-r--r--salt/openbook/admin_api_server/files/installdeps.sh11
-rw-r--r--salt/openbook/admin_api_server/files/run.sh4
-rw-r--r--salt/openbook/admin_api_server/files/start_app.sh3
6 files changed, 76 insertions, 0 deletions
diff --git a/salt/openbook/admin_api_server/files/Dockerfile b/salt/openbook/admin_api_server/files/Dockerfile
new file mode 100644
index 0000000..35c5079
--- /dev/null
+++ b/salt/openbook/admin_api_server/files/Dockerfile
@@ -0,0 +1,8 @@
+FROM {{ pillar["baseimage"]["image_name"] }}
+MAINTAINER Carlos Konstanski <carlos@talligent.com>
+ADD docker-start.tar.xz /
+EXPOSE 8081 5701 5702
+VOLUME {{ pillar["admin_api_server"]["dirs"]["etc_openbook_admin_api_server"]["name"] }}
+VOLUME {{ pillar["admin_api_server"]["dirs"]["var_log_openbook_admin_api_server"]["name"] }}
+RUN /installdeps.sh
+ENTRYPOINT [ "/start_app.sh" ]
diff --git a/salt/openbook/admin_api_server/files/admin_api_server.json b/salt/openbook/admin_api_server/files/admin_api_server.json
new file mode 100644
index 0000000..40eb9a7
--- /dev/null
+++ b/salt/openbook/admin_api_server/files/admin_api_server.json
@@ -0,0 +1,15 @@
+{% raw %}
+{% set ips = openbook_gcomm_addresses.split(",") %}
+{% if ips|length > 1 %}
+{% set failover = "failover:" %}
+{% else %}
+{% set failover = "" %}
+{% endif %}
+{% endraw %}
+
+{
+ "log.path": "{{ pillar["admin_api_server"]["log"] }}",
+ "entityDS.url": "jdbc:mariadb:{% raw %}{{ failover }}{% endraw %}//{% raw %}{{ openbook_gcomm_addresses }}{% endraw %}/openbook",
+ "workflowDS.url": "jdbc:mariadb:{% raw %}{{ failover }}{% endraw %}//{% raw %}{{ openbook_gcomm_addresses }}{% endraw %}/openbook_workflow",
+ "jobsDS.url": "jdbc:mariadb:{% raw %}{{ failover }}{% endraw %}//{% raw %}{{ openbook_gcomm_addresses }}{% endraw %}/openbook_jobs"
+}
diff --git a/salt/openbook/admin_api_server/files/build.sh b/salt/openbook/admin_api_server/files/build.sh
new file mode 100644
index 0000000..feaaaa1
--- /dev/null
+++ b/salt/openbook/admin_api_server/files/build.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Do not call directly. Meant to be called from CI build script.
+
+pushd {{ pillar["admin_api_server"]["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_api_server"]["container_name"] }}
+docker container prune -f
+docker rmi -f {{ pillar["admin_api_server"]["image_name"] }}
+
+echo "Building docker Ubuntu image"
+docker build -t {{ pillar["admin_api_server"]["image_name"] }} .
+
+echo "Push docker image to the registry"
+docker tag {{ pillar["admin_api_server"]["image_name"] }} {{ pillar["registry"]["url"] }}/{{ pillar["admin_api_server"]["image_name"] }}
+docker push {{ pillar["registry"]["url"] }}/{{ pillar["admin_api_server"]["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_api_server/files/installdeps.sh b/salt/openbook/admin_api_server/files/installdeps.sh
new file mode 100644
index 0000000..2d97c9f
--- /dev/null
+++ b/salt/openbook/admin_api_server/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_api_server"]["jar_name"] }}" \
+ "{{ pillar["jars"]["url"] }}{{ pillar["admin_api_server"]["jar_name"] }}"
+
+exit 0
diff --git a/salt/openbook/admin_api_server/files/run.sh b/salt/openbook/admin_api_server/files/run.sh
new file mode 100644
index 0000000..1f5df60
--- /dev/null
+++ b/salt/openbook/admin_api_server/files/run.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+docker run -d --net=host -v {{ pillar["admin_api_server"]["dirs"]["etc_openbook_admin_api_server"]["name"] }}:{{ pillar["admin_api_server"]["dirs"]["etc_openbook_admin_api_server"]["name"] }} -v {{ pillar["admin_api_server"]["dirs"]["var_log_openbook_admin_api_server"]["name"] }}:{{ pillar["admin_api_server"]["dirs"]["var_log_openbook_admin_api_server"]["name"] }} --name {{ pillar["admin_api_server"]["container_name"] }} {{ pillar["registry"]["url"] }}/{{ pillar["admin_api_server"]["image_name"] }}
+exit 0
diff --git a/salt/openbook/admin_api_server/files/start_app.sh b/salt/openbook/admin_api_server/files/start_app.sh
new file mode 100644
index 0000000..d610377
--- /dev/null
+++ b/salt/openbook/admin_api_server/files/start_app.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec java -jar {{ pillar["admin_api_server"]["jar_name"] }} run com.talligent.openbook.verticle.Startup --cluster