Merge branch 'master' of https://github.com/open-cloud/xos
diff --git a/containers/Makefile b/containers/Makefile
new file mode 100644
index 0000000..0215b63
--- /dev/null
+++ b/containers/Makefile
@@ -0,0 +1,19 @@
+.PHONY: xos
+xos: nodes.yaml images.yaml
+	sudo docker-compose up -d
+	../xos/configurations/common/wait_for_xos_port.sh 9999
+	sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/setup.yaml
+	sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
+	sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/images.yaml
+
+nodes.yaml:
+	export SETUPDIR=.; bash ../xos/configurations/common/make-nodes-yaml.sh
+
+images.yaml:
+	export SETUPDIR=.; bash ../xos/configurations/common/make-images-yaml.sh
+
+.PHONY: local_containers
+local_containers:
+	cd containers/xos; make devel
+	cd containers/synchronizer; make
+
diff --git a/containers/README.md b/containers/README.md
index 46f970e..46b53e4 100644
--- a/containers/README.md
+++ b/containers/README.md
@@ -14,53 +14,33 @@
 
 #### Database Container
 
-To build and run the database container:
+To build the database container:
 
 ```
-$ cd postgresql; make build && make run
+$ cd postgresql; make build
 ```
 
 #### XOS Container
 
-To build and run the xos webserver container:
+To build the XOS webserver container:
 
 ```
-$ cd xos; make build && make run
-```
-
-You should now be able to access the login page by visiting
-`http://localhost:8000` and log in using the default `padmin@vicci.org` account
-with password `letmein`. It may be helpful to bootstrap xos with some sample
-data; deployment, controllers, sites, slices, etc. You can get started by
-loading tosca configuration for the opencloud demo dataset:
-
-```
-$ cd xos; make runtosca
-```
-
-Or you can create you own tosca configuraton file and customize the dataset
-however you want. You can all load your own tosca configuration by setting the
-`TOSCA_CONFIG_PATH` environment variable before executing the make command:
-
-```
-$ cd xos; TOSCA_CONFIG_PATH=/path/to/tosca/config.yaml make runtosca
+$ cd xos; make build
 ```
 
 #### Synchronizer Container
 
-The Synchronizer shares many of the same dependencies as the xos container. The
+The Synchronizer shares many of the same dependencies as the XOS container. The
 synchronizer container takes advantage of this by building itself on top of the
-xos image. This means you must build the xos image before building the
-synchronizer image. The XOS and synchronizer containers can run on separate
-hosts, but you must build the xos image on the host that you plan to run the
-synchronizer container. Assuming you have already built the xos container,
-executing the following will build and run the synchronizer container:
+XOS image. This means you must build the XOS image before building the
+synchronizer image.  Assuming you have already built the XOS container,
+executing the following will build the Synchronizer container:
 
 ```
-$ cd synchronizer; make build && make run
+$ cd synchronizer; make build
 ```
 
-#### Solution Compose File ![](https://img.shields.io/badge/compose-beta-red.svg)
+#### Solution Compose File
 
 [Docker Compose](https://docs.docker.com/compose/) is a tool for defining and
 running multi-container Docker applications. With Compose, you use a Compose
@@ -69,9 +49,27 @@
 
 Included is a compose file in *YAML* format with content defined by the [Docker
 Compose Format](https://docs.docker.com/compose/compose-file/). With the compose
-file a complete XOS solution based on docker containers can be instantiated
+file a complete XOS solution based on Docker containers can be instantiated
 using a single command. To start the instance you can use the command:
 
 ```
 $ docker-compose up -d
 ```
+
+You should now be able to access the login page by visiting
+`http://localhost:8000` and log in using the default `padmin@vicci.org` account
+with password `letmein`.
+
+If you have your own OpenStack cluster, and you would like to configure XOS to
+control it, copy the `admin-openrc.sh` credentials file for your cluster to
+this directory.  Make sure that OpenStack commands work from the local machine
+using the credentials, e.g., `source ./admin-openrc.sh; nova list`.  Then run:
+
+```
+$ make
+```
+
+XOS will be launched (the Makefile will run the `docker-compose up -d` command
+for you) and configured with the nodes and images available in your
+OpenStack cloud.  You can then log in to XOS as described above and start creating
+slices and instances.
diff --git a/containers/admin-openrc.sh b/containers/admin-openrc.sh
new file mode 100644
index 0000000..f27fdac
--- /dev/null
+++ b/containers/admin-openrc.sh
@@ -0,0 +1,6 @@
+# Replace with the OpenStack admin credentials for your cluster
+export OS_TENANT_NAME=admin
+export OS_USERNAME=admin
+export OS_PASSWORD=admin
+export OS_AUTH_URL=http://localhost:35357/v2.0
+
diff --git a/containers/docker-compose.yml b/containers/docker-compose.yml
index 464b560..a38040a 100644
--- a/containers/docker-compose.yml
+++ b/containers/docker-compose.yml
@@ -4,10 +4,17 @@
         - "5432"
 
 xos_synchronizer_openstack:
+    command: bash -c "sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
+    extra_hosts:
+        - ctl:128.110.96.49
     image: xosproject/xos-synchronizer-openstack
     labels:
         org.xosproject.kind: synchronizer
         org.xosproject.target: openstack
+    links:
+        - xos_db
+    volumes:
+        - .:/root/setup:ro
 
 # FUTURE
 #xos_swarm_synchronizer:
@@ -17,9 +24,11 @@
 #        org.xosproject.target: swarm
 
 xos:
-    image: xosproject/xos
     command: python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
-    ports:
-        - "8000:8000"
+    image: xosproject/xos
     links:
         - xos_db
+    ports:
+        - "9999:8000"
+    volumes:
+        - .:/root/setup:ro
diff --git a/containers/setup.yaml b/containers/setup.yaml
new file mode 100644
index 0000000..c13f0eb
--- /dev/null
+++ b/containers/setup.yaml
@@ -0,0 +1,61 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >
+    * Adds OpenCloud Sites, Deployments, and Controllers.
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      properties:
+          flavors: m1.large, m1.medium, m1.small
+
+    MyOpenStack:
+      type: tosca.nodes.Controller
+      requirements:
+          - deployment:
+              node: MyDeployment
+              relationship: tosca.relationships.ControllerDeployment
+      properties:
+          backend_type: OpenStack
+          version: Kilo
+          auth_url: { get_script_env: [ SELF, adminrc, OS_AUTH_URL, LOCAL_FILE] }
+          admin_user: { get_script_env: [ SELF, adminrc, OS_USERNAME, LOCAL_FILE] }
+          admin_password: { get_script_env: [ SELF, adminrc, OS_PASSWORD, LOCAL_FILE] }
+          admin_tenant: { get_script_env: [ SELF, adminrc, OS_TENANT_NAME, LOCAL_FILE] }
+          domain: Default
+      artifacts:
+          adminrc: /root/setup/admin-openrc.sh
+
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+          display_name: MySite
+          site_url: http://xosproject.org/
+      requirements:
+          - deployment:
+               node: MyDeployment
+               relationship: tosca.relationships.SiteDeployment
+               requirements:
+                   - controller:
+                       node: MyOpenStack
+                       relationship: tosca.relationships.UsesController
+
+    # This user already exists in XOS with this password
+    # It's an example of how to create new users
+    padmin@vicci.org:
+      type: tosca.nodes.User
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+      properties:
+          is_admin: true
+          is_active: true
+          firstname: XOS
+          lastname: admin
+          password: letmein