launch the modified UI container
diff --git a/xos/configurations/common/wait_for_xos_file.sh b/xos/configurations/common/wait_for_xos_file.sh
new file mode 100755
index 0000000..1214dc4
--- /dev/null
+++ b/xos/configurations/common/wait_for_xos_file.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+display_usage() {
+ echo -e "\nUsage:\n$0 [fn] \n"
+}
+
+if [ $# -lt 1 ]
+then
+ display_usage
+ exit 1
+fi
+
+echo "Waiting for XOS to create file $1"
+
+until find $1 &> /dev/null
+do
+ sleep 1
+ RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+ if [[ $RUNNING_CONTAINER == "" ]]; then
+ echo Container may have failed. check with \"make showlogs\'
+ exit 1
+ fi
+done
+echo "XOS is ready"
diff --git a/xos/configurations/frontend/Makefile b/xos/configurations/frontend/Makefile
index ab253c0..99f8ec0 100644
--- a/xos/configurations/frontend/Makefile
+++ b/xos/configurations/frontend/Makefile
@@ -1,13 +1,18 @@
MYIP:=$(shell hostname -i)
CONFIG_DIR:=$(shell pwd)
DOCKER_COMPOSE_YML=./onboarding_docker_compose/docker-compose.yml
+BOOTSTRAP_YML=./docker-compose-bootstrap.yml
frontend: bootstrap
- sudo docker-compose -f docker-compose-bootstrap.yml run -e CONFIG_DIR=$(CONFIG_DIR) xos_bootstrap_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/frontend/xos.yaml
+ sudo docker-compose -f $(BOOTSTRAP_YML) run -e CONFIG_DIR=$(CONFIG_DIR) xos_bootstrap_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/frontend/xos.yaml
+ sudo rm -f onboarding-docker-compose/docker-compose.yml
+ bash ../common/wait_for_xos_file.sh onboarding-docker-compose/docker-compose.yml
+ cp onboarding-docker-compose/docker-compose.yml .
+ sudo docker-compose up -d
bash ../common/wait_for_xos_port.sh 9999
- sudo docker-compose -f $(DOCKER_COMPOSE_YML) run xos_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/common/fixtures.yaml
- sudo docker-compose -f $(DOCKER_COMPOSE_YML) run xos_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/common/mydeployment.yaml
- sudo docker-compose -f $(DOCKER_COMPOSE_YML) run xos_ui python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
+ sudo docker-compose run xos_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/common/fixtures.yaml
+ sudo docker-compose run xos_ui python /opt/xos/tosca/run.py none /opt/xos/configurations/common/mydeployment.yaml
+ sudo docker-compose run xos_ui python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
bootstrap:
sudo make -f ../common/Makefile.prereqs
@@ -21,13 +26,13 @@
#cd ../../../containers/xos; make devel
stop:
- sudo docker-compose stop
+ sudo docker-compose -f $(BOOTSTRAP_YML) stop
showlogs:
sudo docker-compose logs
rm: stop
- sudo docker-compose rm
+ sudo docker-compose -f $(BOOTSTRAP_YML) rm
ps:
sudo docker-compose ps
diff --git a/xos/configurations/frontend/xos.yaml b/xos/configurations/frontend/xos.yaml
index 1b2bf22..b88e4f3 100644
--- a/xos/configurations/frontend/xos.yaml
+++ b/xos/configurations/frontend/xos.yaml
@@ -12,6 +12,7 @@
properties:
ui_port: 9999
bootstrap_ui_port: 9998
+ container_base_name: frontend
/opt/xos/xos_configuration/xos_common_config:
type: tosca.nodes.XOSVolume
diff --git a/xos/core/models/xosmodel.py b/xos/core/models/xosmodel.py
index 5751446..b44c3cd 100644
--- a/xos/core/models/xosmodel.py
+++ b/xos/core/models/xosmodel.py
@@ -12,6 +12,7 @@
ui_port = models.IntegerField(help_text="Port for XOS UI", default=80)
bootstrap_ui_port = models.IntegerField(help_text="Port for XOS UI", default=81)
db_container_name = StrippedCharField(max_length=200, help_text="name of XOS db container", default="xos_db")
+ container_base_name = StrippedCharField(max_length=200, help_text="base name for containers")
def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/synchronizers/onboarding/templates/docker-compose.yml.j2 b/xos/synchronizers/onboarding/templates/docker-compose.yml.j2
index ceb2531..c444427 100644
--- a/xos/synchronizers/onboarding/templates/docker-compose.yml.j2
+++ b/xos/synchronizers/onboarding/templates/docker-compose.yml.j2
@@ -1,6 +1,7 @@
{% for container_name, container in containers.iteritems() %}
{{ container_name}}:
+# container_name: {{ container.container_base_name }}_{{ container_name }}_1
image: {{ container.image }}
{%- if container.command %}
command: {{ container.command }}
@@ -12,7 +13,7 @@
{%- endfor %}
{%- endif %}
{%- if container.links %}
- lines:
+ links:
{%- for link in container.links %}
- {{ link }}
{%- endfor %}
diff --git a/xos/synchronizers/onboarding/xosbuilder.py b/xos/synchronizers/onboarding/xosbuilder.py
index 75dcd8c..da2c6fd 100644
--- a/xos/synchronizers/onboarding/xosbuilder.py
+++ b/xos/synchronizers/onboarding/xosbuilder.py
@@ -173,16 +173,19 @@
containers["xos_db"] = \
{"image": "xosproject/xos-postgres",
+ "container_base_name": xos.container_base_name,
"expose": [5432]}
containers["xos_ui"] = \
{"image": "xosproject/xos-ui",
+ "container_base_name": xos.container_base_name,
"command": "python /opt/xos/manage.py runserver 0.0.0.0:%d --insecure --makemigrations" % xos.ui_port,
"ports": {"%d"%xos.ui_port : "%d"%xos.ui_port},
"links": ["xos_db"],
"volumes": volume_list}
containers["xos_bootstrap_ui"] = {"image": "xosproject/xos-ui",
+ "container_base_name": xos.container_base_name,
"command": "python /opt/xos/manage.py runserver 0.0.0.0:%d --insecure --makemigrations" % xos.bootstrap_ui_port,
"ports": {"%d"%xos.bootstrap_ui_port : "%d"%xos.bootstrap_ui_port},
"links": ["xos_db"],
@@ -191,6 +194,7 @@
for c in ServiceController.objects.all():
containers["xos_synchronizer_%s" % c.name] = \
{"image": "xosproject/xos-synchronizer-%s" % controller.name,
+ "container_base_name": xos.container_base_name,
"command": 'bash -c "sleep 120; bash /opt/xos/synchronizers/%s/run.sh"',
"links": ["xos_db"],
"volumes": volume_list}
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 5e852d8..ee21be7 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -19,6 +19,10 @@
type: integer
required: false
descrption: TCP port of bootstrap user interface
+ container_base_name:
+ type: string
+ required: false
+ description: Base name for containers
tosca.nodes.XOSVolume:
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index ef245b9..472382e 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -49,6 +49,10 @@
type: integer
required: false
descrption: TCP port of bootstrap user interface
+ container_base_name:
+ type: string
+ required: false
+ description: Base name for containers
tosca.nodes.XOSVolume:
diff --git a/xos/tosca/resources/xosmodel.py b/xos/tosca/resources/xosmodel.py
index f7e3221..daba4f5 100644
--- a/xos/tosca/resources/xosmodel.py
+++ b/xos/tosca/resources/xosmodel.py
@@ -12,7 +12,7 @@
class XOSXOS(XOSResource):
provides = "tosca.nodes.XOS"
xos_model = XOS
- copyin_props = ["ui_port", "bootstrap_ui_port"]
+ copyin_props = ["ui_port", "bootstrap_ui_port", "container_base_name"]
class XOSVolume(XOSResource):
provides = "tosca.nodes.XOSVolume"