update devel configuration to onboarding
Change-Id: I6b230eeea4dff0e893bc9e71a90a5f0d6806c57f
diff --git a/common/Makefile.cloudlab b/common/Makefile.cloudlab
index 7ab8a54..ee0bc48 100644
--- a/common/Makefile.cloudlab
+++ b/common/Makefile.cloudlab
@@ -10,6 +10,7 @@
prereqs:
make -f Makefile.prereqs
mkdir -p $(SETUPDIR)
+ sudo ./check_docker_version.sh
admin-openrc:
sudo cat /root/setup/admin-openrc.sh > $(SETUPDIR)/admin-openrc.sh
diff --git a/common/Makefile.prereqs b/common/Makefile.prereqs
index fce51be..381a1e7 100644
--- a/common/Makefile.prereqs
+++ b/common/Makefile.prereqs
@@ -39,3 +39,17 @@
/usr/local/bin/docker-compose:
sudo bash -c "curl -L https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
sudo chmod +x /usr/local/bin/docker-compose
+
+rebuild_docker:
+ stat docker_build || git clone https://github.com/dotcloud/docker.git docker_build
+ sudo make -C docker_build build
+ sudo make -C docker_build binary
+ sudo service docker stop
+ sudo mv /usr/bin/docker /usr/bin/docker-old
+ sudo cp docker_build/bundles/latest/binary-client/docker /usr/bin/
+ sudo cp docker_build/bundles/latest/binary-daemon/dockerd /usr/bin/
+ sudo cp docker_build/bundles/latest/binary-daemon/docker-containerd /usr/bin/
+ sudo cp docker_build/bundles/latest/binary-daemon/docker-containerd-shim /usr/bin/
+ sudo cp docker_build/bundles/latest/binary-daemon/docker-containerd-ctr /usr/bin/
+ sudo cp docker_build/bundles/latest/binary-daemon/docker-runc /usr/bin/
+ sudo service docker start
diff --git a/common/check_docker_version.sh b/common/check_docker_version.sh
new file mode 100755
index 0000000..654ff5f
--- /dev/null
+++ b/common/check_docker_version.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+DOCKER_VERSION=`docker version --format '{{.Server.Version}}'`
+
+verlte() {
+ [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
+}
+
+verlte $DOCKER_VERSION 1.10.0 && echo "Please upgrade to docker 1.10.2 or better" && exit -1
+
+exit 0
diff --git a/devel/Makefile b/devel/Makefile
index 524e4cd..992b3b4 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1,16 +1,56 @@
+include ../common/Makedefs
+
MYIP:=$(shell hostname -i)
+CONFIG_DIR:=$(shell pwd)
+DOCKER_COMPOSE_YML=./onboarding-docker-compose/docker-compose.yml
+BOOTSTRAP_YML=./docker-compose-bootstrap.yml
+DOCKER_PROJECT=devel
+BOOTSTRAP_PROJECT=develbs
+XOS_BOOTSTRAP_PORT=9998
+XOS_UI_PORT=9999
+ADMIN_USERNAME=padmin@vicci.org
+ADMIN_PASSWORD=letmein
+RUN_TOSCA_BOOTSTRAP=python ../common/run_tosca.py $(XOS_BOOTSTRAP_PORT) $(ADMIN_USERNAME) $(ADMIN_PASSWORD)
+RUN_TOSCA=python ../common/run_tosca.py $(XOS_UI_PORT) $(ADMIN_USERNAME) $(ADMIN_PASSWORD)
-cloudlab: common_cloudlab local_containers xos
+cloudlab: download_xos common_cloudlab local_containers xos
-devstack: upgrade_pkgs common_devstack local_containers xos
+devstack: download_xos upgrade_pkgs common_devstack local_containers xos
-xos:
- sudo MYIP=$(MYIP) docker-compose up -d
- bash ../common/wait_for_xos.sh
- 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 MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/cloudlab-openstack.yaml
- sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
+xos: dirs download_services bootstrap onboarding develconfig
+
+dirs:
+ # if this directory doesn't exist, then docker-compose will create it with root permission
+ mkdir -p key_import
+ mkdir -p onboarding-docker-compose
+
+download_xos:
+ make -f ../common/Makefile.services xos_core
+
+download_services:
+ make -f ../common/Makefile.services
+
+update_services:
+ make -f ../common/Makefile.services update
+
+bootstrap:
+ echo "[BOOTSTRAP]"
+ sudo rm -f onboarding-docker-compose/docker-compose.yml
+ sudo CONFIG_DIR=$(CONFIG_DIR) docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) up -d
+ bash ../common/wait_for_xos_port.sh $(XOS_BOOTSTRAP_PORT)
+ sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) run xos_bootstrap_ui python /opt/xos/tosca/run.py none - < ../common/fixtures.yaml
+ sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) run xos_bootstrap_ui python /opt/xos/tosca/run.py none - < ../common/mydeployment.yaml
+ $(RUN_TOSCA_BOOTSTRAP) xos.yaml
+
+onboarding:
+ echo "[ONBOARDING]"
+ # on-board any services here
+ bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+ bash ../common/wait_for_xos_port.sh $(XOS_UI_PORT)
+
+develconfig:
+ $(RUN_TOSCA) ../common/cloudlab-openstack.yaml
+ $(RUN_TOSCA) ../setup/nodes.yaml
common_cloudlab:
make -C ../common -f Makefile.cloudlab
@@ -19,36 +59,24 @@
make -C ../common -f Makefile.devstack
base:
- make -C ../../../containers/xos base
+ make -f ../common/Makefile.containers xos_base
local_containers:
- echo "" > ../../../containers/xos/local_certs.crt
- for CRT in $$(ls /usr/local/share/ca-certificates/*) ; do \
- echo Adding Certificate: $$CRT ;\
- cat $$CRT >> ../../../containers/xos/local_certs.crt ;\
- echo "" >> ../../../containers/xos/local_certs.crt ;\
- done
- make -C ../../../containers/xos devel
- make -C ../../../containers/synchronizer
+ make -f ../common/Makefile.containers xos_devel synchronizer onboarding_synchronizer
stop:
- sudo MYIP=$(MYIP) docker-compose stop
+ test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) stop
+ sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) stop
showlogs:
- sudo MYIP=$(MYIP) docker-compose logs
+ sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) logs
rm: stop
- sudo MYIP=$(MYIP) docker-compose rm
+ test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) rm -f
+ sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) rm -f
ps:
sudo MYIP=$(MYIP) docker-compose ps
-enter-xos:
- sudo docker exec -it devel_xos_1 bash
-
-enter-synchronizer:
- sudo docker exec -it devel_xos_synchronizer_openstack_1 bash
-
upgrade_pkgs:
sudo pip install httpie --upgrade
-
diff --git a/devel/docker-compose-bootstrap.yml b/devel/docker-compose-bootstrap.yml
new file mode 100644
index 0000000..f1a3864
--- /dev/null
+++ b/devel/docker-compose-bootstrap.yml
@@ -0,0 +1,54 @@
+xos_db:
+ image: xosproject/xos-postgres
+ expose:
+ - "5432"
+
+xos_bootstrap_ui:
+ image: xosproject/xos
+ command: python /opt/xos/manage.py runserver 0.0.0.0:9998 --insecure --makemigrations
+ environment:
+ - CONFIG_DIR
+ ports:
+ - "9998:9998"
+ links:
+ - xos_db
+ volumes:
+ - ../setup:/root/setup:ro
+ - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config
+ - ../../xos_services:/opt/xos_services
+
+xos_synchronizer_onboarding:
+ image: xosproject/xos-synchronizer-onboarding
+ command: bash -c "cd /opt/xos/synchronizers/onboarding; ./run.sh"
+# command: sleep 86400
+ labels:
+ org.xosproject.kind: synchronizer
+ org.xosproject.target: onboarding
+ links:
+ - xos_db
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ - ./key_import:/opt/xos/key_import:ro
+ - ./onboarding-docker-compose:/opt/xos/synchronizers/onboarding/docker-compose
+ - ../../xos_services:/opt/xos_services
+ log_driver: "json-file"
+ log_opt:
+ max-size: "100k"
+ max-file: "5"
+
+xos_synchronizer_openstack:
+ command: bash -c "sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
+ image: xosproject/xos-synchronizer-openstack
+ labels:
+ org.xosproject.kind: synchronizer
+ org.xosproject.target: openstack
+ links:
+ - xos_db
+ volumes:
+ - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+ - ../setup:/root/setup:ro
+ - ./images:/opt/xos/images:ro
+ log_driver: "json-file"
+ log_opt:
+ max-size: "100k"
+ max-file: "5"
diff --git a/devel/xos.yaml b/devel/xos.yaml
new file mode 100644
index 0000000..bffb9ce
--- /dev/null
+++ b/devel/xos.yaml
@@ -0,0 +1,37 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the exampleservice
+
+imports:
+ - custom_types/xos.yaml
+
+topology_template:
+ node_templates:
+ xos:
+ type: tosca.nodes.XOS
+ properties:
+ ui_port: 9999
+ bootstrap_ui_port: 9998
+ docker_project_name: devel
+ db_container_name: develbs_xos_db_1
+ frontend_only: true
+
+ /opt/xos/xos_configuration/xos_common_config:
+ type: tosca.nodes.XOSVolume
+ properties:
+ host_path: { path_join: [ SELF, CONFIG_DIR, ../common/xos_common_config, ENV_VAR ] }
+ read_only: false
+ requirements:
+ - xos:
+ node: xos
+ relationship: tosca.relationships.UsedByXOS
+
+ /root/setup:
+ type: tosca.nodes.XOSVolume
+ properties:
+ host_path: { path_join: [ SELF, CONFIG_DIR, ../setup, ENV_VAR ] }
+ read_only: false
+ requirements:
+ - xos:
+ node: xos
+ relationship: tosca.relationships.UsedByXOS
\ No newline at end of file