refator m-cord from configurations to service-profile
Change-Id: I4d490bea16903015cee7e30400a097ec46fadc67
diff --git a/mcord/synchronizer/Dockerfile b/mcord/synchronizer/Dockerfile
new file mode 100644
index 0000000..011e8dd
--- /dev/null
+++ b/mcord/synchronizer/Dockerfile
@@ -0,0 +1,48 @@
+FROM xosproject/xos
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
+ openssh-client \
+ python-crypto \
+ python-jinja2 \
+ python-paramiko \
+ python-yaml \
+ python-httplib2 \
+ rsync \
+ supervisor
+
+RUN pip install -U \
+ jinja2
+
+# Install custom Ansible
+RUN \
+ git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible && \
+ git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras && \
+ git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras && \
+ git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core && \
+ git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core && \
+ # git clone uses cached copy, doesn't pick up latest
+ git -C /opt/ansible pull && \
+ git -C /opt/ansible/lib/ansible/modules/core pull && \
+ git -C /opt/ansible/v2/ansible/modules/core pull
+
+
+# For Observer
+RUN mkdir -p /usr/local/share /bin /etc/ansible
+
+COPY conf/ansible-hosts /etc/ansible/hosts
+
+ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
+
+RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum && \
+ cd /tmp/fofum; python setup.py install && \
+ rm -rf /tmp/fofum && \
+ tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/ && \
+ rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 && \
+ ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs && \
+ ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
+
+
+# Supervisor
+COPY conf/synchronizer.conf /etc/supervisor/conf.d/
+
+CMD update-ca-certificates && /usr/bin/supervisord -c /etc/supervisor/conf.d/synchronizer.conf
diff --git a/mcord/synchronizer/Makefile b/mcord/synchronizer/Makefile
new file mode 100644
index 0000000..352616a
--- /dev/null
+++ b/mcord/synchronizer/Makefile
@@ -0,0 +1,15 @@
+IMAGE_NAME:=xosproject/xos-synchronizer-openstack
+CONTAINER_NAME:=xos-synchronizer
+NO_DOCKER_CACHE?=false
+
+.PHONY: build
+build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+
+.PHONY: run
+run: ; sudo docker run -d --name ${CONTAINER_NAME} -v /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro ${IMAGE_NAME}
+
+.PHONY: stop
+stop: ; sudo docker stop ${CONTAINER_NAME}
+
+.PHONY: rm
+rm: ; sudo docker rm ${CONTAINER_NAME}
diff --git a/mcord/synchronizer/conf/ansible-hosts b/mcord/synchronizer/conf/ansible-hosts
new file mode 100644
index 0000000..0dd74f1
--- /dev/null
+++ b/mcord/synchronizer/conf/ansible-hosts
@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1
diff --git a/mcord/synchronizer/conf/synchronizer.conf b/mcord/synchronizer/conf/synchronizer.conf
new file mode 100644
index 0000000..2131a25
--- /dev/null
+++ b/mcord/synchronizer/conf/synchronizer.conf
@@ -0,0 +1,9 @@
+[supervisord]
+logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
+pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
+nodaemon=true
+
+[program:synchronizer]
+command=python /opt/xos/synchronizers/openstack/xos-synchronizer.py
+stderr_logfile=/var/log/supervisor/synchronizer.err.log
+stdout_logfile=/var/log/supervisor/synchronizer.out.log