XOS bootstrapping, WIP
diff --git a/xos/configurations/common/wait_for_xos_port.sh b/xos/configurations/common/wait_for_xos_port.sh
index 3ed5833..9c9e041 100755
--- a/xos/configurations/common/wait_for_xos_port.sh
+++ b/xos/configurations/common/wait_for_xos_port.sh
@@ -10,7 +10,7 @@
exit 1
fi
-echo "Waiting for XOS to come up"
+echo "Waiting for XOS to start listening on port $1"
until curl 0.0.0.0:$1 &> /dev/null
do
sleep 1
diff --git a/xos/configurations/frontend/Makefile b/xos/configurations/frontend/Makefile
index 1998224..ab253c0 100644
--- a/xos/configurations/frontend/Makefile
+++ b/xos/configurations/frontend/Makefile
@@ -1,14 +1,18 @@
MYIP:=$(shell hostname -i)
CONFIG_DIR:=$(shell pwd)
+DOCKER_COMPOSE_YML=./onboarding_docker_compose/docker-compose.yml
-frontend:
+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
+ 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
+
+bootstrap:
sudo make -f ../common/Makefile.prereqs
- sudo docker-compose up -d
- bash ../common/wait_for_xos.sh
- sudo docker-compose run -e CONFIG_DIR=$(CONFIG_DIR) xos python /opt/xos/tosca/run.py none /opt/xos/configurations/frontend/xos.yaml
- sudo docker-compose run xos python /opt/xos/tosca/run.py none /opt/xos/configurations/common/fixtures.yaml
- sudo docker-compose run xos python /opt/xos/tosca/run.py none /opt/xos/configurations/common/mydeployment.yaml
- sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
+ sudo docker-compose -f docker-compose-bootstrap.yml up -d
+ bash ../common/wait_for_xos_port.sh 9998
containers:
cd ../../../containers/xos; make devel
@@ -61,4 +65,4 @@
# fake keys are fine
echo somekey > key_import/exampleservice_rsa
echo somekey > key_import/exampleservice_rsa.pub
- sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/onboard/exampleservice/exampleservice-onboard.yaml
+ sudo docker-compose run xos_ui python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/onboard/exampleservice/exampleservice-onboard.yaml
diff --git a/xos/configurations/frontend/docker-compose-bootstrap.yml b/xos/configurations/frontend/docker-compose-bootstrap.yml
index 0be4506..756399c 100644
--- a/xos/configurations/frontend/docker-compose-bootstrap.yml
+++ b/xos/configurations/frontend/docker-compose-bootstrap.yml
@@ -3,36 +3,16 @@
expose:
- "5432"
-# FUTURE
-#xos_swarm_synchronizer:
-# image: xosproject/xos-swarm-synchronizer
-# labels:
-# org.xosproject.kind: synchronizer
-# org.xosproject.target: swarm
-
-xos:
+xos_bootstrap_ui:
image: xosproject/xos
- command: python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
- #command: sleep 86400 # For interactive session
+ command: python /opt/xos/manage.py runserver 0.0.0.0:9998 --insecure --makemigrations
ports:
- - "9999:8000"
+ - "9998:9998"
links:
- xos_db
volumes:
- ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config
- ../vtn/files/xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro
-# - ../../core/xoslib:/opt/xos/core/xoslib
-# - ../../tosca:/opt/xos/tosca
-# - ../../core/static:/opt/xos/core/static
-# - ../../core/dashboard:/opt/xos/core/dashboard
-# - ../../core/templatetags:/opt/xos/core/templatetags
-# - ../../core/views:/opt/xos/core/views
-# - ../../templates:/opt/xos/templates
-# - ../../configurations:/opt/xos/configurations
-# - ../../xos:/opt/xos/xos
-# - ../../api:/opt/xos/api
-# - ../../core/views:/opt/xos/core/views
-# - ../../services:/opt/xos/services
xos_synchronizer_onboarding:
image: xosproject/xos-synchronizer-onboarding
@@ -44,9 +24,10 @@
links:
- xos_db
volumes:
- - .:/root/setup:ro
+# - .:/root/setup:ro
- /var/run/docker.sock:/var/run/docker.sock
- - ./key_import:/opt/xos/key_import
+ - ./key_import:/opt/xos/key_import:ro
+ - ./onboarding-docker-compose:/opt/xos/synchronizers/onboarding/docker-compose
log_driver: "json-file"
log_opt:
max-size: "100k"
diff --git a/xos/configurations/frontend/xos.yaml b/xos/configurations/frontend/xos.yaml
index 4575de4..1b2bf22 100644
--- a/xos/configurations/frontend/xos.yaml
+++ b/xos/configurations/frontend/xos.yaml
@@ -9,6 +9,9 @@
node_templates:
xos:
type: tosca.nodes.XOS
+ properties:
+ ui_port: 9999
+ bootstrap_ui_port: 9998
/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 7d686bd..5751446 100644
--- a/xos/core/models/xosmodel.py
+++ b/xos/core/models/xosmodel.py
@@ -10,6 +10,7 @@
class XOS(PlCoreBase):
name = StrippedCharField(max_length=200, unique=True, help_text="Name of XOS", default="XOS")
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")
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 1532604..ceb2531 100644
--- a/xos/synchronizers/onboarding/templates/docker-compose.yml.j2
+++ b/xos/synchronizers/onboarding/templates/docker-compose.yml.j2
@@ -33,5 +33,9 @@
- "{{ expose }}"
{%- endfor %}
{%- endif %}
+ log_driver: "json-file"
+ log_opt:
+ max-size: "100k"
+ max-file: "5"
{%- endfor %}
diff --git a/xos/synchronizers/onboarding/xosbuilder.py b/xos/synchronizers/onboarding/xosbuilder.py
index 5eeb675..75dcd8c 100644
--- a/xos/synchronizers/onboarding/xosbuilder.py
+++ b/xos/synchronizers/onboarding/xosbuilder.py
@@ -182,6 +182,12 @@
"links": ["xos_db"],
"volumes": volume_list}
+ containers["xos_bootstrap_ui"] = {"image": "xosproject/xos-ui",
+ "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"],
+ "volumes": volume_list}
+
for c in ServiceController.objects.all():
containers["xos_synchronizer_%s" % c.name] = \
{"image": "xosproject/xos-synchronizer-%s" % controller.name,
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index f7f9ca1..5e852d8 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -9,6 +9,17 @@
tosca.nodes.XOS:
derived_from: tosca.nodes.Root
description: The root of XOS
+ properties:
+ xos_base_props
+ ui_port:
+ type: integer
+ required: false
+ description: TCP port of user interface
+ bootstrap_ui_port:
+ type: integer
+ required: false
+ descrption: TCP port of bootstrap user interface
+
tosca.nodes.XOSVolume:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index c912e1a..ef245b9 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -24,6 +24,32 @@
tosca.nodes.XOS:
derived_from: tosca.nodes.Root
description: The root of XOS
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ ui_port:
+ type: integer
+ required: false
+ description: TCP port of user interface
+ bootstrap_ui_port:
+ type: integer
+ required: false
+ descrption: TCP port of bootstrap user interface
+
tosca.nodes.XOSVolume:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/xosmodel.py b/xos/tosca/resources/xosmodel.py
index 2132f07..f7e3221 100644
--- a/xos/tosca/resources/xosmodel.py
+++ b/xos/tosca/resources/xosmodel.py
@@ -12,6 +12,7 @@
class XOSXOS(XOSResource):
provides = "tosca.nodes.XOS"
xos_model = XOS
+ copyin_props = ["ui_port", "bootstrap_ui_port"]
class XOSVolume(XOSResource):
provides = "tosca.nodes.XOSVolume"