CORD-1008 Add dockerfile and docker-compose for vrouter synchronizer
Change-Id: Ib673f0f7be15faff7e145dee17f4bb3a7fe54de0
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..dd61c31
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,9 @@
+FROM xosproject/xos-synchronizer-base
+
+ADD . /opt/xos/synchronizers/vrouter
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/vrouter"
+
+CMD bash -c "cd /opt/xos/synchronizers/vrouter; ./run-from-api.sh"
diff --git a/xos/synchronizer/Makefile b/xos/synchronizer/Makefile
new file mode 100644
index 0000000..6f2f127
--- /dev/null
+++ b/xos/synchronizer/Makefile
@@ -0,0 +1,5 @@
+synchronizer:
+ sudo docker build --rm -f Dockerfile.synchronizer -t xosproject/vrouter-synchronizer .
+
+up:
+ docker-compose -p vrouter up -d
diff --git a/xos/synchronizer/docker-compose.yml b/xos/synchronizer/docker-compose.yml
new file mode 100644
index 0000000..7d6b59c
--- /dev/null
+++ b/xos/synchronizer/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '2'
+
+networks:
+ xos:
+ external: true
+
+services:
+ synchronizer:
+ image: xosproject/vrouter-synchronizer
+ networks:
+ - xos
+ #command: bash -c "sleep 86400"
+ volumes:
+ - /opt/cord_profile/key_import/vrouter_rsa:/opt/xos/services/vrouter/keys/vrouter_rsa:ro
+ - /opt/cord_profile/node_key:/opt/cord_profile/node_key:ro
+ - /opt/cord/build/platform-install/credentials/xosadmin@opencord.org:/opt/xos/services/vrouter/credentials/xosadmin@opencord.org
+ external_links:
+ - rcordbs_xos_redis_1:redis
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "1000k"
+ max-file: "5"
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
new file mode 100755
index 0000000..27f18ff
--- /dev/null
+++ b/xos/synchronizer/run-from-api.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python vrouter-synchronizer.py -C $XOS_DIR/synchronizers/vrouter/vrouter_from_api_config
diff --git a/xos/synchronizer/vrouter_from_api_config b/xos/synchronizer/vrouter_from_api_config
new file mode 100644
index 0000000..c3f1403
--- /dev/null
+++ b/xos/synchronizer/vrouter_from_api_config
@@ -0,0 +1,20 @@
+# Sets options for the synchronizer
+[observer]
+name=vrouter
+dependency_graph=/opt/xos/synchronizers/vrouter/model_deps
+steps_dir=/opt/xos/synchronizers/vrouter/steps
+sys_dir=/opt/xos/synchronizers/vrouter/sys
+#logfile=/var/log/xos_backend.log
+log_file=console
+log_level=debug
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+proxy_ssh=True
+proxy_ssh_key=/opt/cord_profile/node_key
+proxy_ssh_user=root
+accessor_kind=api
+accessor_password=@/opt/xos/services/vrouter/credentials/xosadmin@opencord.org
+
+[networking]
+use_vtn=True