Merge branch 'master' into feature/syndicate
diff --git a/containers/syndicate-ms/Dockerfile b/containers/syndicate-ms/Dockerfile
index e74db92..7585b8a 100644
--- a/containers/syndicate-ms/Dockerfile
+++ b/containers/syndicate-ms/Dockerfile
@@ -7,7 +7,7 @@
 # vars
 ENV APT_KEY butler_opencloud_cs_arizona_edu_pub.gpg
 ENV MS_PORT 8080
-ENV GAE_SDK google_appengine_1.9.35.zip
+ENV GAE_SDK google_appengine_1.9.36.zip
 
 # Prep apt to be able to download over https
 RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes\
diff --git a/xos/configurations/syndicate/MS.mk b/xos/configurations/syndicate/MS.mk
deleted file mode 100644
index dc65237..0000000
--- a/xos/configurations/syndicate/MS.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-# MS build parameters
-
-MS_APP_ADMIN_EMAIL        ?= sites@opencloud.us
-MS_APP_PUBLIC_HOST				?= localhost
-MS_APP_ADMIN_PUBLIC_KEY   ?= ms/admin.pub
-MS_APP_ADMIN_PRIVATE_KEY  ?= ms/admin.pem
-
-MS_APP_NAME               ?= syndicate-ms
-MS_APP_PUBLIC_KEY         ?= ms/syndicate.pub
-MS_APP_PRIVATE_KEY        ?= ms/syndicate.pem
-
-MS_DEVEL                  ?= true
-
-$(MS_APP_ADMIN_PRIVATE_KEY):
-	openssl genrsa 4096 > "$@"
-
-$(MS_APP_ADMIN_PUBLIC_KEY): $(MS_APP_ADMIN_PRIVATE_KEY)
-	openssl rsa -in "$<" -pubout > "$@"
-
-$(MS_APP_PRIVATE_KEY):
-	openssl genrsa 4096 > "$@"
-
-$(MS_APP_PUBLIC_KEY): $(MS_APP_PRIVATE_KEY)
-	openssl rsa -in "$<" -pubout > "$@"
-
-ms/admin_info.py: ms/admin_info.pyin $(MS_APP_ADMIN_PUBLIC_KEY) $(MS_APP_PUBLIC_KEY) $(MS_APP_PRIVATE_KEY)
-	mkdir -p "$(@D)"
-	cat "$<" | \
-		sed -e 's~@MS_APP_NAME@~$(MS_APP_NAME)~g;' | \
-		sed -e 's~@MS_APP_ADMIN_EMAIL@~$(MS_APP_ADMIN_EMAIL)~g;' | \
-		sed -e 's~@MS_DEVEL@~$(MS_DEVEL)~g;' | \
-		sed -e 's~@MS_APP_ADMIN_PUBLIC_KEY@~$(shell cat $(MS_APP_ADMIN_PUBLIC_KEY) | tr "\n" "@" | sed 's/@/\\n/g')~g;' | \
-		sed -e 's~@MS_APP_PRIVATE_KEY@~$(shell cat $(MS_APP_PRIVATE_KEY) | tr "\n" "@" | sed 's/@/\\n/g')~g;' | \
-		sed -e 's~@MS_APP_PUBLIC_KEY@~$(shell cat $(MS_APP_PUBLIC_KEY) | tr "\n" "@" | sed 's/@/\\n/g')~g;' > "$@"
-
-ms/app.yaml: ms/app.yamlin
-	mkdir -p "$(@D)"
-	cat "$<" | \
-		sed -e 's~@MS_APP_NAME@~$(MS_APP_NAME)~g;' | \
-		sed -e 's~@MS_APP_PUBLIC_HOST@~$(MS_APP_PUBLIC_HOST)~g;' > "$@"
-
-clean: 
-	rm -f ms/admin_info.py ms/app.yaml
-
-clean_certs:
-	rm -f $(MS_APP_ADMIN_PUBLIC_KEY) $(MS_APP_ADMIN_PRIVATE_KEY) $(MS_APP_PUBLIC_KEY) $(MS_APP_PRIVATE_KEY)
-
diff --git a/xos/configurations/syndicate/Makefile b/xos/configurations/syndicate/Makefile
index 3b29ee5..a09c38b 100644
--- a/xos/configurations/syndicate/Makefile
+++ b/xos/configurations/syndicate/Makefile
@@ -17,9 +17,13 @@
 	cd ../../../containers/synchronizer; make
 	cd ../../../containers/syndicate-ms; make
 
-# see Makefiles on this project: https://github.com/syndicate-storage/syndicate-core
-include MS.mk
-syndicate_config: ms/admin_info.py ms/app.yaml
+# see Makefiles on this project:
+# https://github.com/syndicate-storage/syndicate-core
+# specifically the ms subdirectory
+CONFIG_DIR=ms
+BUILD_MS=ms
+include configure_ms.mk
+syndicate_config: ms/app.yaml
 
 common_cloudlab:
 	make -C ../common -f Makefile.cloudlab
diff --git a/xos/configurations/syndicate/configure_ms.mk b/xos/configurations/syndicate/configure_ms.mk
new file mode 100644
index 0000000..d72a1df
--- /dev/null
+++ b/xos/configurations/syndicate/configure_ms.mk
@@ -0,0 +1,50 @@
+# MS configuration parameters
+
+# Where app.yamlin can be found
+CONFIG_DIR ?= .
+
+# Output directory for app.yaml
+BUILD_MS ?=
+
+# Where to put generated pub/priv keys
+KEY_FILES ?= $(CONFIG_DIR)
+
+MS_APP_NAME			?= syndicate-ms
+MS_APP_PUBLIC_HOST	?= localhost
+MS_APP_ADMIN_EMAIL	?= syndicate-ms@example.com
+
+MS_APP_ADMIN_PUBLIC_KEY		?= $(KEY_FILES)/admin.pub
+MS_APP_ADMIN_PRIVATE_KEY	?= $(KEY_FILES)/admin.pem
+
+MS_APP_PUBLIC_KEY	?= $(KEY_FILES)/syndicate.pub
+MS_APP_PRIVATE_KEY	?= $(KEY_FILES)/syndicate.pem
+
+$(MS_APP_ADMIN_PRIVATE_KEY):
+	openssl genrsa 4096 > "$@"
+
+$(MS_APP_ADMIN_PUBLIC_KEY): $(MS_APP_ADMIN_PRIVATE_KEY)
+	openssl rsa -in "$<" -pubout > "$@"
+
+$(MS_APP_PRIVATE_KEY):
+	openssl genrsa 4096 > "$@"
+
+$(MS_APP_PUBLIC_KEY): $(MS_APP_PRIVATE_KEY)
+	openssl rsa -in "$<" -pubout > "$@"
+
+$(BUILD_MS)/app.yaml: $(CONFIG_DIR)/app.yamlin $(MS_APP_ADMIN_PUBLIC_KEY) $(MS_APP_PUBLIC_KEY) $(MS_APP_PRIVATE_KEY)
+	mkdir -p "$(@D)"
+	cat "$<" | \
+		sed -e 's~@MS_APP_NAME@~$(MS_APP_NAME)~g;' \
+			-e 's~@MS_APP_PUBLIC_HOST@~$(MS_APP_PUBLIC_HOST)~g;' \
+			-e 's~@MS_APP_ADMIN_EMAIL@~$(MS_APP_ADMIN_EMAIL)~g;' \
+			-e 's~@MS_APP_ADMIN_PUBLIC_KEY@~$(shell cat "$(MS_APP_ADMIN_PUBLIC_KEY)" | tr "\n" "@  " | sed 's/@/\\n    /g')~g;' \
+			-e 's~@MS_APP_PUBLIC_KEY@~$(shell cat "$(MS_APP_PUBLIC_KEY)" | tr "\n" "@" | sed 's/@/\\n    /g')~g;' \
+			-e 's~@MS_APP_PRIVATE_KEY@~$(shell cat "$(MS_APP_PRIVATE_KEY)" | tr "\n" "@" | sed 's/@/\\n    /g')~g;' \
+		> "$@"
+
+clean_ms:
+	rm -f $(BUILD_MS)/ms/app.yaml
+
+clean_certs: clean_ms
+	rm -f $(MS_APP_ADMIN_PUBLIC_KEY) $(MS_APP_ADMIN_PRIVATE_KEY) $(MS_APP_PUBLIC_KEY) $(MS_APP_PRIVATE_KEY)
+
diff --git a/xos/configurations/syndicate/docker-compose.yml b/xos/configurations/syndicate/docker-compose.yml
index d2d3dbb..39d85f7 100644
--- a/xos/configurations/syndicate/docker-compose.yml
+++ b/xos/configurations/syndicate/docker-compose.yml
@@ -9,7 +9,6 @@
         - "8080"
     volumes:
       - ./ms/app.yaml:/usr/src/syndicate/ms/app.yaml
-      - ./ms/admin_info.py:/usr/src/syndicate/ms/common/admin_info.py
 
 xos_synchronizer_openstack:
     image: xosproject/xos-synchronizer-openstack
@@ -25,19 +24,19 @@
         - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
         - ./images:/opt/xos/images:ro
 
-xos_synchronizer_exampleservice:
+xos_synchronizer_syndicate:
     image: xosproject/xos-synchronizer-openstack
-    command: bash -c "sleep 120; python /opt/xos/synchronizers/exampleservice/exampleservice-synchronizer.py -C /opt/xos/synchronizers/exampleservice/exampleservice_config"
+    command: bash -c "sleep 120; python /opt/xos/synchronizers/syndicate/syndicate-synchronizer.py -C /opt/xos/synchronizers/syndicate/syndicate_config"
     labels:
         org.xosproject.kind: synchronizer
-        org.xosproject.target: exampleservice
+        org.xosproject.target: syndicate
     links:
         - xos_db
     extra_hosts:
         - ctl:${MYIP}
     volumes:
         - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
-        - ../setup/id_rsa:/opt/xos/synchronizers/exampleservice/exampleservice_private_key:ro
+        - ../setup/id_rsa:/opt/xos/synchronizers/syndicate/syndicate_private_key:ro
 
 xos:
     image: xosproject/xos
diff --git a/xos/configurations/syndicate/ms/.gitignore b/xos/configurations/syndicate/ms/.gitignore
new file mode 100644
index 0000000..3ac37b2
--- /dev/null
+++ b/xos/configurations/syndicate/ms/.gitignore
@@ -0,0 +1,5 @@
+admin.pem
+admin.pub
+app.yaml
+syndicate.pem
+syndicate.pub
diff --git a/xos/configurations/syndicate/ms/admin_info.pyin b/xos/configurations/syndicate/ms/admin_info.pyin
deleted file mode 100644
index 9dee928..0000000
--- a/xos/configurations/syndicate/ms/admin_info.pyin
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/python
-
-# AUTO-GENERATED FILE
-
-ADMIN_PUBLIC_KEY = """@MS_APP_ADMIN_PUBLIC_KEY@""".strip()
-ADMIN_EMAIL = "@MS_APP_ADMIN_EMAIL@".strip()
-ADMIN_ID = 0
-
-SYNDICATE_NAME = "@MS_APP_NAME@".strip()
-SYNDICATE_PUBKEY = """@MS_APP_PUBLIC_KEY@""".strip()
-SYNDICATE_PRIVKEY = """@MS_APP_PRIVATE_KEY@""".strip()
-
diff --git a/xos/configurations/syndicate/ms/app.yamlin b/xos/configurations/syndicate/ms/app.yamlin
index ea8080b..2d4751f 100644
--- a/xos/configurations/syndicate/ms/app.yamlin
+++ b/xos/configurations/syndicate/ms/app.yamlin
@@ -45,3 +45,11 @@
 
 env_variables:
   MS_APP_PUBLIC_HOST: '@MS_APP_PUBLIC_HOST@'
+  MS_APP_ADMIN_EMAIL: '@MS_APP_ADMIN_EMAIL@'
+  MS_APP_ADMIN_PUBLIC_KEY: |
+    @MS_APP_ADMIN_PUBLIC_KEY@
+  MS_APP_PUBLIC_KEY: |
+    @MS_APP_PUBLIC_KEY@
+  MS_APP_PRIVATE_KEY: |
+    @MS_APP_PRIVATE_KEY@
+
diff --git a/xos/services/syndicate/README.md b/xos/services/syndicate/README.md
new file mode 100644
index 0000000..e33dd3b
--- /dev/null
+++ b/xos/services/syndicate/README.md
@@ -0,0 +1,6 @@
+# Syndicate Service
+
+Syndicate is a Scalable Software-define Storage System.
+
+Code/Info: https://github.com/syndicate-storage
+
diff --git a/xos/services/syndicate/__init__.py b/xos/services/syndicate/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xos/services/syndicate/__init__.py
diff --git a/xos/services/syndicate/admin.py b/xos/services/syndicate/admin.py
new file mode 100644
index 0000000..cb7420c
--- /dev/null
+++ b/xos/services/syndicate/admin.py
@@ -0,0 +1,21 @@
+from core.admin import ReadOnlyAwareAdmin, SliceInline
+from core.middleware import get_request
+from core.models import User
+
+from django import forms
+from django.contrib import admin
+
+from services.syndicate.models import *
+
+
+class SyndicateServiceForm(forms.ModelForm):
+
+    class Meta:
+        model = SyndicateService
+
+
+class VolumeForm(forms.ModelForm):
+
+    class Meta:
+        model = Volume
+
diff --git a/xos/services/syndicate/models.py b/xos/services/syndicate/models.py
new file mode 100644
index 0000000..680188c
--- /dev/null
+++ b/xos/services/syndicate/models.py
@@ -0,0 +1,26 @@
+# Syndicate service models.py
+
+from core.models import Service
+from django.db import models, transaction
+
+SERVICE_NAME = 'syndicateservice'
+SERVICE_NAME_VERBOSE = 'Syndicate Service'
+
+class SyndicateService(Service):
+
+    KIND = SERVICE_NAME
+
+    class Meta:
+        app_label = SERVICE_NAME
+        verbose_name = SERVICE_NAME_VERBOSE
+
+
+class Volume(PLCoreBase):
+
+    KIND = SERVICE_NAME
+
+    class Meta:
+        app_label = SERVICE_NAME
+        verbose_name = SERVICE_NAME_VERBOSE
+
+
diff --git a/xos/synchronizers/syndicate/syndicate_config b/xos/synchronizers/syndicate/syndicate_config
new file mode 100644
index 0000000..6b3a746
--- /dev/null
+++ b/xos/synchronizers/syndicate/syndicate_config
@@ -0,0 +1,24 @@
+# Required by XOS
+[db]
+name=xos
+user=postgres
+password=password
+host=localhost
+port=5432
+
+# Required by XOS
+[api]
+nova_enabled=True
+
+# Sets options for the synchronizer
+[observer]
+name=syndicate
+dependency_graph=/opt/xos/synchronizers/syndicate/model-deps
+steps_dir=/opt/xos/synchronizers/syndicate/steps
+sys_dir=/opt/xos/synchronizers/syndicate/sys
+logfile=/var/log/xos_syndicate.log
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+proxy_ssh=False
+