Add VPN stuff to it's own container and configuration
diff --git a/containers/vpn/Dockerfile b/containers/vpn/Dockerfile
new file mode 100644
index 0000000..8ae8484
--- /dev/null
+++ b/containers/vpn/Dockerfile
@@ -0,0 +1,12 @@
+FROM xosproject/xos-synchronizer-openstack
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
+ openvpn
+
+# for OpenVPN
+RUN mkdir -p /opt/openvpn
+RUN chmod 777 /opt/openvpn
+RUN git clone https://github.com/OpenVPN/easy-rsa.git /opt/openvpn
+RUN git -C /opt/openvpn pull origin master
+RUN echo 'set_var EASYRSA "/opt/openvpn/easyrsa3"' | tee /opt/openvpn/vars
+RUN echo 'set_var EASYRSA_BATCH "true"' | tee -a /opt/openvpn/vars
diff --git a/containers/vpn/Makefile b/containers/vpn/Makefile
new file mode 100644
index 0000000..6004e76
--- /dev/null
+++ b/containers/vpn/Makefile
@@ -0,0 +1,18 @@
+IMAGE_NAME:=xosproject/xos-vpn
+CONTAINER_NAME:=xos-synchronizer
+NO_DOCKER_CACHE?=true
+
+.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}
+
+.PHONY: rmi
+rmi: ; docker rmi ${IMAGE_NAME}
diff --git a/containers/vpn/conf/ansible-hosts b/containers/vpn/conf/ansible-hosts
new file mode 100644
index 0000000..0dd74f1
--- /dev/null
+++ b/containers/vpn/conf/ansible-hosts
@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1
diff --git a/containers/vpn/conf/synchronizer.conf b/containers/vpn/conf/synchronizer.conf
new file mode 100644
index 0000000..2131a25
--- /dev/null
+++ b/containers/vpn/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
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index 5c81aa8..780e900 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -94,11 +94,3 @@
# Define default command.
CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
-
-# for OpenVPN
-RUN mkdir -p /opt/openvpn
-RUN chmod 777 /opt/openvpn
-RUN git clone https://github.com/OpenVPN/easy-rsa.git /opt/openvpn
-RUN git -C /opt/openvpn pull origin master
-RUN echo 'set_var EASYRSA "/opt/openvpn/easyrsa3"' | tee /opt/openvpn/vars
-RUN echo 'set_var EASYRSA_BATCH "true"' | tee -a /opt/openvpn/vars
diff --git a/containers/xos/Dockerfile.devel b/containers/xos/Dockerfile.devel
index 094e0a3..7bed082 100644
--- a/containers/xos/Dockerfile.devel
+++ b/containers/xos/Dockerfile.devel
@@ -23,7 +23,6 @@
pkg-config \
python-dev \
python-httplib2 \
- python-jinja2 \
python-pip \
python-psycopg2 \
python-pycurl \
@@ -35,8 +34,7 @@
python-novaclient \
python-neutronclient \
python-glanceclient \
- python-ceilometerclient \
- openvpn
+ python-ceilometerclient
RUN pip install \
django==1.7 \
@@ -94,11 +92,3 @@
# Define default command.
CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
-
-# for OpenVPN
-RUN mkdir -p /opt/openvpn
-RUN chmod 777 /opt/openvpn
-RUN git clone https://github.com/OpenVPN/easy-rsa.git /opt/openvpn
-RUN git -C /opt/openvpn pull origin master
-RUN echo 'set_var EASYRSA "/opt/openvpn/easyrsa3"' | tee /opt/openvpn/vars
-RUN echo 'set_var EASYRSA_BATCH "true"' | tee -a /opt/openvpn/vars
diff --git a/xos/configurations/devel/Makefile b/xos/configurations/devel/Makefile
index 590b838..1e650f3 100644
--- a/xos/configurations/devel/Makefile
+++ b/xos/configurations/devel/Makefile
@@ -46,10 +46,3 @@
rebuild_synchronizer:
make -C ../../../containers/synchronizer
-
-cleanup_docker: rm
- sudo docker rm -v $(docker ps -a -q -f status=exited) || true
- docker rm -v $(docker ps -a -q -f status=exited) || true
- sudo docker rmi $(docker images -qf "dangling=true") || true
- socker rmi $(docker images -qf "dangling=true") || true
- sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes || true
diff --git a/xos/configurations/devel/docker-compose.yml b/xos/configurations/devel/docker-compose.yml
index 60989f9..9ef6fc7 100644
--- a/xos/configurations/devel/docker-compose.yml
+++ b/xos/configurations/devel/docker-compose.yml
@@ -17,33 +17,6 @@
- ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
- ./images:/opt/xos/images:ro
-xos_synchronizer_vpn:
- image: xosproject/xos-synchronizer-openstack
- command: bash -c "sleep 120 ; python /opt/xos/synchronizers/vpn/vpn-synchronizer.py -C /opt/xos/synchronizers/vpn/vpn_config"
- labels:
- org.xosproject.kind: synchronizer
- org.xosproject.target: vpn
- links:
- - xos_db
- extra_hosts:
- - ctl:${MYIP}
- volumes:
- - ../setup/id_rsa:/opt/xos/synchronizers/vpn/vpn_private_key:ro # private key
- volumes_from:
- - xos_synchronizer_vpn_data:rw
-
-xos_synchronizer_vpn_data:
- image: xosproject/xos-synchronizer-openstack
- labels:
- org.xosproject.kind: synchronizer
- org.xosproject.target: vpn
- links:
- - xos_db
- extra_hosts:
- - ctl:${MYIP}
- volumes:
- - /opt/openvpn
-
# FUTURE
#xos_swarm_synchronizer:
# image: xosproject/xos-swarm-synchronizer
@@ -61,5 +34,3 @@
volumes:
- ../setup:/root/setup:ro
- ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
- volumes_from:
- - xos_synchronizer_vpn_data:rw
diff --git a/xos/configurations/vpn/Makefile b/xos/configurations/vpn/Makefile
new file mode 100644
index 0000000..0ec4a35
--- /dev/null
+++ b/xos/configurations/vpn/Makefile
@@ -0,0 +1,56 @@
+MYIP:=$(shell hostname -i)
+
+cloudlab: common_cloudlab xos
+
+devstack: upgrade_pkgs common_devstack xos
+
+xos:
+ sudo MYIP=$(MYIP) docker-compose up -d
+ bash ../common/wait_for_xos.sh
+ sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/base.yaml
+ sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
+
+containers:
+ cd ../../../containers/xos; make devel
+ cd ../../../containers/synchronizer; make
+ cd ../../../containers/vpn; make
+
+common_cloudlab:
+ make -C ../common -f Makefile.cloudlab
+
+common_devstack:
+ make -C ../common -f Makefile.devstack
+
+stop:
+ sudo MYIP=$(MYIP) docker-compose stop
+
+showlogs:
+ sudo MYIP=$(MYIP) docker-compose logs
+
+rm: stop
+ sudo MYIP=$(MYIP) docker-compose rm
+
+ps:
+ sudo MYIP=$(MYIP) docker-compose ps
+
+enter-xos:
+ sudo docker exec -it devel_xos_1 bash
+
+enter-synchronizer:
+ sudo docker exec -it devel_xos_synchronizer_openstack_1 bash
+
+upgrade_pkgs:
+ sudo pip install httpie --upgrade
+
+rebuild_xos:
+ make -C ../../../containers/xos devel
+
+rebuild_synchronizer:
+ make -C ../../../containers/synchronizer
+
+cleanup_docker: rm
+ sudo docker rm -v $(docker ps -a -q -f status=exited) || true
+ docker rm -v $(docker ps -a -q -f status=exited) || true
+ sudo docker rmi $(docker images -qf "dangling=true") || true
+ socker rmi $(docker images -qf "dangling=true") || true
+ sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes || true
diff --git a/xos/configurations/vpn/docker-compose.yml b/xos/configurations/vpn/docker-compose.yml
new file mode 100644
index 0000000..273e8c6
--- /dev/null
+++ b/xos/configurations/vpn/docker-compose.yml
@@ -0,0 +1,62 @@
+xos_db:
+ image: xosproject/xos-postgres
+ expose:
+ - "5432"
+
+xos_synchronizer_openstack:
+ image: xosproject/xos-synchronizer-openstack
+ command: bash -c "sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
+ labels:
+ org.xosproject.kind: synchronizer
+ org.xosproject.target: openstack
+ links:
+ - xos_db
+ extra_hosts:
+ - ctl:${MYIP}
+ volumes:
+ - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+ - ./images:/opt/xos/images:ro
+
+xos_synchronizer_vpn:
+ image: xosproject/xos-vpn
+ command: bash -c "sleep 120 ; python /opt/xos/synchronizers/vpn/vpn-synchronizer.py -C /opt/xos/synchronizers/vpn/vpn_config"
+ labels:
+ org.xosproject.kind: synchronizer
+ org.xosproject.target: vpn
+ links:
+ - xos_db
+ extra_hosts:
+ - ctl:${MYIP}
+ volumes:
+ - ../setup/id_rsa:/opt/xos/synchronizers/vpn/vpn_private_key:ro # private key
+ volumes_from:
+ - xos_synchronizer_vpn_data:rw
+
+xos_synchronizer_vpn_data:
+ image: xosproject/xos-vpn
+ links:
+ - xos_db
+ extra_hosts:
+ - ctl:${MYIP}
+ volumes:
+ - /opt/openvpn
+
+# FUTURE
+#xos_swarm_synchronizer:
+# image: xosproject/xos-swarm-synchronizer
+# labels:
+# org.xosproject.kind: synchronizer
+# org.xosproject.target: swarm
+
+xos:
+ image: xosproject/xos-vpn
+ command: python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
+ ports:
+ - "9999:8000"
+ links:
+ - xos_db
+ volumes:
+ - ../setup:/root/setup:ro
+ - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+ volumes_from:
+ - xos_synchronizer_vpn_data:rw