CORD-911 deploy xos-gui and xos-rest-gw
Change-Id: I6d0663e21835accbe5a8df27805dd9e838fcd1ab
diff --git a/roles/cord-profile/tasks/main.yml b/roles/cord-profile/tasks/main.yml
index beb17f5..628947b 100644
--- a/roles/cord-profile/tasks/main.yml
+++ b/roles/cord-profile/tasks/main.yml
@@ -83,6 +83,9 @@
- xos.yaml
- xos-bootstrap-docker-compose.yaml
- onboard-chameleon.yaml
+ - onboard-xos-gui.yaml
+ - onboard-xos-rest-gw.yaml
+ - gateway-config.yml
- name: Create profile specific templated TOSCA config files
template:
diff --git a/roles/cord-profile/templates/gateway-config.yml.j2 b/roles/cord-profile/templates/gateway-config.yml.j2
new file mode 100644
index 0000000..0e70f01
--- /dev/null
+++ b/roles/cord-profile/templates/gateway-config.yml.j2
@@ -0,0 +1,9 @@
+default:
+ xos:
+ host: xos
+ port: 9000
+ redis:
+ host: redis
+ port: 6379
+ gateway:
+ port: 3000
\ No newline at end of file
diff --git a/roles/cord-profile/templates/onboard-xos-gui.yaml.j2 b/roles/cord-profile/templates/onboard-xos-gui.yaml.j2
new file mode 100644
index 0000000..e05c999
--- /dev/null
+++ b/roles/cord-profile/templates/onboard-xos-gui.yaml.j2
@@ -0,0 +1,27 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the exampleservice
+
+imports:
+ - custom_types/xos.yaml
+
+topology_template:
+ node_templates:
+
+ # UI Container
+ xos-spa-gui:
+ type: tosca.nodes.Component
+ properties:
+ image: xosproject/xos-gui
+ ports: 4000:4000
+
+ gui-to-gw:
+ type: tosca.nodes.ComponentLink
+ properties:
+ container: xos-rest-gateway
+ alias: xos-rest-gw
+ kind: internal
+ requirements:
+ - xos:
+ node: xos-spa-gui
+ relationship: tosca.relationships.LinkOfComponent
\ No newline at end of file
diff --git a/roles/cord-profile/templates/onboard-xos-rest-gw.yaml.j2 b/roles/cord-profile/templates/onboard-xos-rest-gw.yaml.j2
new file mode 100644
index 0000000..04b916c
--- /dev/null
+++ b/roles/cord-profile/templates/onboard-xos-rest-gw.yaml.j2
@@ -0,0 +1,50 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the exampleservice
+
+imports:
+ - custom_types/xos.yaml
+
+topology_template:
+ node_templates:
+
+ # API Gateway
+ xos-rest-gateway:
+ type: tosca.nodes.Component
+ properties:
+ image: xosproject/xos-rest-gw
+ command: npm start -- --config gateway-config.yml
+ ports: 3000:3000
+
+ # API Gateway config file
+ /var/www/src/config/gateway-config.yml:
+ type: tosca.nodes.ComponentVolume
+ properties:
+ host_path: "{{ cord_profile_dir }}/gateway-config.yml"
+ read_only: false
+ requirements:
+ - xos:
+ node: xos-rest-gateway
+ relationship: tosca.relationships.VolumeOfComponent
+
+ gw-to-xos:
+ type: tosca.nodes.ComponentLink
+ properties:
+ container: xos_ui
+ alias: xos
+ kind: internal
+ requirements:
+ - xos:
+ node: xos-rest-gateway
+ relationship: tosca.relationships.LinkOfComponent
+
+ gw-to-redis:
+ type: tosca.nodes.ComponentLink
+ properties:
+ container: cordpodbs_xos_redis_1
+ alias: redis
+ kind: external
+ requirements:
+ - xos:
+ node: xos-rest-gateway
+ relationship: tosca.relationships.LinkOfComponent
\ No newline at end of file
diff --git a/roles/xos-docker-images/tasks/main.yml b/roles/xos-docker-images/tasks/main.yml
index 37c1a6a..ed9670f 100644
--- a/roles/xos-docker-images/tasks/main.yml
+++ b/roles/xos-docker-images/tasks/main.yml
@@ -60,6 +60,20 @@
dockerfile: "Dockerfile.chameleon"
pull: False # use the locally built copy of xosproject/xos
+- name: Build xosproject/xos-rest-gw container image
+ docker_image:
+ name: "xosproject/xos-rest-gw"
+ path: "{{ cord_dir }}/orchestration/xos-rest-gw"
+ dockerfile: "Dockerfile"
+ pull: False # use the locally built copy of xosproject/xos
+
+- name: Build xosproject/xos-gui container image
+ docker_image:
+ name: "xosproject/xos-gui"
+ path: "{{ cord_dir }}/orchestration/xos-gui"
+ dockerfile: "Dockerfile"
+ pull: False # use the locally built copy of xosproject/xos
+
- name: Tag and push xos-base image to docker registry
when: push_xos_base_image
docker_image:
diff --git a/roles/xos-onboarding/defaults/main.yml b/roles/xos-onboarding/defaults/main.yml
index 22d7bdb..76ed617 100644
--- a/roles/xos-onboarding/defaults/main.yml
+++ b/roles/xos-onboarding/defaults/main.yml
@@ -11,6 +11,10 @@
xos_components:
- name: Chameleon
recipe_filename: onboard-chameleon.yaml
+ - name: xos-rest-gw
+ recipe_filename: onboard-xos-rest-gw.yaml
+ - name: xos-gui
+ recipe_filename: onboard-xos-gui.yaml
xos_services: []