Rizwan Haider | 752a48c | 2016-08-18 15:37:06 -0400 | [diff] [blame] | 1 | include ../common/Makedefs |
| 2 | |
| 3 | MYIP:=$(shell hostname -i) |
| 4 | CONFIG_DIR:=$(shell pwd) |
| 5 | DOCKER_COMPOSE_YML=./onboarding-docker-compose/docker-compose.yml |
| 6 | BOOTSTRAP_YML=./docker-compose-bootstrap.yml |
| 7 | DOCKER_PROJECT=metronetwork |
| 8 | BOOTSTRAP_PROJECT=metronetworkdbs |
| 9 | XOS_BOOTSTRAP_PORT=9998 |
| 10 | XOS_UI_PORT=9999 |
| 11 | ADMIN_USERNAME=padmin@vicci.org |
| 12 | ADMIN_PASSWORD=letmein |
| 13 | RUN_TOSCA_BOOTSTRAP=python ../common/run_tosca.py $(XOS_BOOTSTRAP_PORT) $(ADMIN_USERNAME) $(ADMIN_PASSWORD) |
| 14 | RUN_TOSCA=python ../common/run_tosca.py $(XOS_UI_PORT) $(ADMIN_USERNAME) $(ADMIN_PASSWORD) |
| 15 | |
| 16 | metronetwork: prereqs dirs download_xos download_services bootstrap onboarding |
| 17 | |
| 18 | prereqs: |
| 19 | sudo make -f ../common/Makefile.prereqs |
| 20 | |
| 21 | dirs: |
| 22 | # if this directory doesn't exist, then docker-compose will create it with root permission |
| 23 | mkdir -p key_import |
| 24 | mkdir -p onboarding-docker-compose |
| 25 | |
| 26 | download_xos: |
| 27 | make -f ../common/Makefile.services xos_core |
| 28 | |
| 29 | download_services: |
| 30 | make -f ../common/Makefile.services |
| 31 | |
| 32 | update_services: |
| 33 | make -f ../common/Makefile.services update |
| 34 | |
| 35 | update_xos: |
| 36 | make -f ../common/Makefile.services update_xos |
| 37 | |
| 38 | bootstrap: |
| 39 | @echo "[BOOTSTRAP]" |
| 40 | sudo rm -f onboarding-docker-compose/docker-compose.yml |
| 41 | sudo CONFIG_DIR=$(CONFIG_DIR) docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) up -d |
| 42 | bash ../common/wait_for_xos_port.sh $(XOS_BOOTSTRAP_PORT) |
| 43 | sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) run xos_bootstrap_ui python /opt/xos/tosca/run.py none - < ../common/fixtures.yaml |
| 44 | sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) run xos_bootstrap_ui python /opt/xos/tosca/run.py none - < ../common/mydeployment.yaml |
| 45 | $(RUN_TOSCA_BOOTSTRAP) xos.yaml |
| 46 | $(RUN_TOSCA_BOOTSTRAP) dashboard.yaml |
| 47 | |
| 48 | onboarding: |
| 49 | @echo "[ONBOARDING]" |
| 50 | # on-board the metronetwork service |
| 51 | bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos |
| 52 | $(RUN_TOSCA_BOOTSTRAP) ../common/disable-onboarding.yaml |
| 53 | $(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/metro-net/xos/metronetworkservice-onboard.yaml |
| 54 | $(RUN_TOSCA_BOOTSTRAP) ../common/enable-onboarding.yaml |
| 55 | bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/metronetwork |
| 56 | bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos |
| 57 | bash ../common/wait_for_xos_port.sh $(XOS_UI_PORT) |
| 58 | |
| 59 | containers: prereqs download_xos |
| 60 | make -f ../common/Makefile.containers xos_devel synchronizer onboarding_synchronizer |
| 61 | |
| 62 | rebuild: |
| 63 | bash ../common/rebuild.sh $(XOS_BOOTSTRAP_PORT) |
| 64 | bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos |
| 65 | |
| 66 | stop: |
| 67 | test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) stop |
| 68 | sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) stop |
| 69 | |
| 70 | showlogs: |
| 71 | sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) logs |
| 72 | |
| 73 | showlogs_bootstrap: |
| 74 | sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) logs |
| 75 | |
| 76 | rm: stop |
| 77 | test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) rm -f |
| 78 | sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) rm -f |
| 79 | |
| 80 | ps: |
| 81 | sudo docker-compose ps |
| 82 | |
| 83 | enter-ui: |
| 84 | sudo docker exec -ti metronetwork_xos_ui_1 bash |
| 85 | |
| 86 | enter-bootstrap-ui: |
| 87 | sudo docker exec -ti metronetworkdbs_xos_bootstrap_ui_1 bash |
| 88 | |
| 89 | enter-db: |
| 90 | sudo docker exec -ti metronetworkdbs_xos_db_1 bash |
| 91 | |
| 92 | django-restart: |
| 93 | sudo docker exec metronetwork_xos_ui_1 touch /opt/xos/xos/settings.py |
| 94 | |
| 95 | clean-config-folder: |
| 96 | sudo docker exec metronetwork_xos_ui_1 rm -f /opt/xos/xos_configuration/xos_mcord_config |
| 97 | sudo docker exec metronetwork_xos_ui_1 rm -f /opt/xos/xos_configuration/xos_cord_config |
| 98 | |
| 99 | |