Add support for docker
Change-Id: I699cf694fe360a86d809d0c3a3d6435660d0509b
diff --git a/horizon/files/entrypoint.sh b/horizon/files/entrypoint.sh
new file mode 100644
index 0000000..be7a8ff
--- /dev/null
+++ b/horizon/files/entrypoint.sh
@@ -0,0 +1,24 @@
+{%- from "horizon/map.jinja" import server with context -%}
+#!/bin/bash -e
+
+cat /srv/salt/pillar/horizon-server.sls | envsubst > /tmp/horizon-server.sls
+mv /tmp/horizon-server.sls /srv/salt/pillar/horizon-server.sls
+
+salt-call --local --retcode-passthrough state.highstate
+
+{% for service in server.services %}
+service {{ service }} stop || true
+{% endfor %}
+
+export APACHE_RUN_USER=horizon
+export APACHE_RUN_GROUP=horizon
+export APACHE_PID_FILE=/var/run/apache2/apache2.pid
+export APACHE_RUN_DIR=/var/run/apache2
+export APACHE_LOCK_DIR=/var/lock/apache2
+export APACHE_LOG_DIR=/var/log/apache2
+
+su horizon --shell=/bin/sh -c 'apachectl -DFOREGROUND'
+
+{#-
+vim: syntax=jinja
+-#}
\ No newline at end of file
diff --git a/horizon/server/service.sls b/horizon/server/service.sls
index d549c57..344a095 100644
--- a/horizon/server/service.sls
+++ b/horizon/server/service.sls
@@ -83,4 +83,15 @@
- require:
- file: horizon_log_dir
+{%- if grains.get('virtual_subtype', None) == "Docker" %}
+
+horizon_entrypoint:
+ file.managed:
+ - name: /entrypoint.sh
+ - template: jinja
+ - source: salt://horizon/files/entrypoint.sh
+ - mode: 755
+
+{%- endif %}
+
{%- endif %}