summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2018-09-28 10:55:39 -0700
committerGrant Limberg <grant.limberg@zerotier.com>2018-09-28 10:55:39 -0700
commit417aa9547b4f3abb9009a3dbb66ecf93d3d686f7 (patch)
tree78e86f1a63027323ef4eaa4c67cd2a4c449b4919 /docker
parent0510f85a8fe6cba7e6258d534fa49d47f9f8e2a2 (diff)
downloadinfinitytier-417aa9547b4f3abb9009a3dbb66ecf93d3d686f7.tar.gz
infinitytier-417aa9547b4f3abb9009a3dbb66ecf93d3d686f7.zip
Working controller & docker container for GKE
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile15
-rw-r--r--docker/main.sh44
2 files changed, 59 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 00000000..3b01b2ad
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,15 @@
+# Dockerfile for ZeroTier Central Controllers
+FROM centos:7
+MAINTAINER Adam Ierymekno <adam.ierymenko@zerotier.com>, Grant Limberg <grant.limberg@zerotier.com>
+
+RUN yum update -y
+RUN yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
+RUN yum install -y postgresql10
+
+ADD zerotier-one /usr/local/bin/zerotier-one
+RUN chmod a+x /usr/local/bin/zerotier-one
+
+ADD docker/main.sh /
+RUN chmod a+x /main.sh
+
+ENTRYPOINT /main.sh
diff --git a/docker/main.sh b/docker/main.sh
new file mode 100644
index 00000000..f0054a94
--- /dev/null
+++ b/docker/main.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+if [ -z "$ZT_IDENTITY_PATH" ]; then
+ echo '*** FAILED: ZT_IDENTITY_PATH environment variable is not defined'
+ exit 1
+fi
+if [ -z "$ZT_DB_HOST" ]; then
+ echo '*** FAILED: ZT_DB_HOST environment variable not defined'
+ exit 1
+fi
+if [ -z "$ZT_DB_PORT" ]; then
+ echo '*** FAILED: ZT_DB_PORT environment variable not defined'
+ exit 1
+fi
+if [ -z "$ZT_DB_USER" ]; then
+ echo '*** FAILED: ZT_DB_USER environment variable not defined'
+ exit 1
+fi
+if [ -z "$ZT_DB_PASSWORD" ]; then
+ echo '*** FAILED: ZT_DB_PASSWORD environment variable not defined'
+ exit 1
+fi
+
+mkdir -p /var/lib/zerotier-one
+
+pushd /var/lib/zerotier-one
+ln -s $ZT_IDENTITY_PATH/identity.public identity.public
+ln -s $ZT_IDENTITY_PATH/identity.secret identity.secret
+popd
+
+echo "{
+ \"settings\": {
+ \"portMappingEnabled\": true,
+ \"softwareUpdate\": \"disable\",
+ \"interfadePrefixBlacklist\": [
+ \"inot\",
+ \"nat64\"
+ ],
+ \"controllerDbPath\": \"postgres:host=${ZT_DB_HOST} port=${ZT_DB_PORT} dbname=ztc user=${ZT_DB_USER} password=${ZT_DB_PASSWORD}\"
+ }
+}
+" > /var/lib/zerotier-one/local.conf
+
+exec /usr/local/bin/zerotier-one /var/lib/zerotier-one