CORD-1033 Pull all XOS containers from registry

Change-Id: Icd2ab199028b7f28750419fb560a5fd79102c9bd
diff --git a/roles/cord-profile/templates/docker-compose.yml.j2 b/roles/cord-profile/templates/docker-compose.yml.j2
new file mode 100644
index 0000000..4939307
--- /dev/null
+++ b/roles/cord-profile/templates/docker-compose.yml.j2
@@ -0,0 +1,243 @@
+version: '2'
+
+# XOS docker compose
+# generated by platform-install/roles/cord-profile
+
+networks:
+{% for network in xos_docker_networks %}
+  {{ network }}:
+    external: true
+{% endfor %}
+
+services:
+  xos_db:
+    image: {{ deploy_docker_registry }}xosproject/xos-postgres:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+      - {{ network }}
+{% endfor %}
+    expose:
+      - "5432"
+    restart: unless-stopped
+
+{% if use_redis %}
+  xos_redis:
+    image: {{ deploy_docker_registry }}redis:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+{% endif %}
+
+  xos-spa-gui:
+    image: {{ deploy_docker_registry }}xosproject/xos-gui:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    ports:
+      - "4000:4000"
+    links:
+      - xos-rest-gateway:xos-rest-gw
+      - xos_chameleon:xos-chameleon
+    depends_on:
+      - xos-rest-gateway
+      - xos_chameleon
+    volumes:
+      - {{ cord_profile_dir }}/style.config.js:/var/www/dist/style.config.js
+      - {{ cord_profile_dir }}/app.config.js:/var/www/dist/app.config.js
+    volumes_from:
+      - gui-extensions-store
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+  xos_chameleon:
+    image: {{ deploy_docker_registry }}xosproject/chameleon:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: python chameleon/chameleon/main.py -R 9101 -G xos-core:50055
+    ports:
+      - "9101:9101"
+    links:
+      - xos_core:xos-core
+    depends_on:
+      - xos_core
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+  gui-extensions-store:
+    image: {{ deploy_docker_registry }}node:argon
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: /bin/true
+    volumes:
+      - /var/www/dist/extensions
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+
+  xos-rest-gateway:
+    image: {{ deploy_docker_registry }}xosproject/xos-rest-gw:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: npm start -- --config gateway-config.yml
+    ports:
+      - "3000:3000"
+    links:
+      - xos_ui:xos
+{% if use_redis %}
+      - xos_redis:redis
+{% endif %}
+    depends_on:
+      - xos_ui
+{% if use_redis %}
+      - xos_redis
+{% endif %}
+    volumes:
+      - {{ cord_profile_dir }}/gateway-config.yml:/var/www/src/config/gateway-config.yml
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+  xos_ui:
+    image: {{ deploy_docker_registry }}xosproject/xos-ui:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: python /opt/xos/manage.py runserver 0.0.0.0:9000 --insecure --makemigrations
+    ports:
+      - "9000:9000"
+    links:
+      - xos_db:xos_db
+{% if use_redis %}
+      - xos_redis:redis
+{% endif %}
+    depends_on:
+      - xos_db
+{% if use_redis %}
+      - xos_redis
+{% endif %}
+    volumes:
+      - {{ cord_profile_dir }}/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+      - {{ cord_profile_dir }}:/opt/cord_profile:ro
+      - {{ cord_dir }}/orchestration/xos_libraries/ng-xos-lib:/opt/xos_libraries/ng-xos-lib:ro
+      - {{ cord_profile_dir }}/im_cert_chain.pem:/usr/local/share/ca-certificates/local_certs.crt:ro
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+  xos_core:
+    image: {{ deploy_docker_registry }}xosproject/xos-ui:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: bash -c "cd coreapi; bash ./start_coreapi.sh"
+    ports:
+      - "50051:50051"
+      - "50055:50055"
+    links:
+      - xos_db:xos_db
+{% if use_redis %}
+      - xos_redis:redis
+{% endif %}
+    depends_on:
+      - xos_db
+{% if use_redis %}
+      - xos_redis
+{% endif %}
+    volumes:
+      - {{ cord_profile_dir }}/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+      - {{ cord_profile_dir }}:/opt/cord_profile:ro
+      - {{ cord_dir }}/orchestration/xos_libraries/ng-xos-lib:/opt/xos_libraries/ng-xos-lib:ro
+      - {{ cord_profile_dir }}/im_cert_chain.pem:/usr/local/share/ca-certificates/local_certs.crt:ro
+      - /var/run/docker.sock:/var/run/docker.sock
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+{% for ext in enabled_gui_extensions %}
+  gui-extension-{{ ext.name }}:
+    image: {{ deploy_docker_registry }}xosproject/gui-extension-{{ ext.name }}:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+    command: npm run build
+    volumes_from:
+      - gui-extensions-store
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+
+{% endfor %}
+
+{% if not frontend_only %}
+{% for svc in xos_services %}
+{% if svc.synchronizer is defined and svc.synchronizer %}
+  {{ svc.name }}-synchronizer:
+    image: {{ deploy_docker_registry }}xosproject/{{ svc.name }}-synchronizer:{{ deploy_docker_tag }}
+    networks:
+{% for network in xos_docker_networks %}
+     - {{ network }}
+{% endfor %}
+{% if use_redis %}
+    links:
+      - xos_redis:redis
+    depends_on:
+      - xos_redis
+{% endif %}
+    volumes:
+      - {{ cord_profile_dir }}/node_key:/opt/cord_profile/node_key:ro
+      - {{ cord_dir }}/build/platform-install/credentials/xosadmin@opencord.org:/opt/xos/services/{{ svc.name }}/credentials/xosadmin@opencord.org:ro
+      - {{ cord_profile_dir }}/im_cert_chain.pem:/usr/local/share/ca-certificates/local_certs.crt:ro
+{% if svc.keypair is defined %}
+      - {{ cord_profile_dir }}/key_import/{{ svc.keypair }}:/opt/xos/services/{{ svc.name }}/keys/{{ svc.keypair }}:ro
+{% endif %}
+{% if svc.name == "openstack" %}
+      - {{ cord_profile_dir }}/images:/opt/xos/images:ro
+{% endif %}
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
+    restart: unless-stopped
+
+{% endif %}
+{% endfor %}
+{% endif %}