mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Fix make central-controller-docker
This commit is contained in:
parent
91b16310ea
commit
ca89695270
19
ext/central-controller-docker/Dockerfile
Normal file
19
ext/central-controller-docker/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
# 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 bash postgresql10 libpqxx-devel
|
||||
|
||||
RUN yum -y install epel-release && yum -y update && yum clean all
|
||||
RUN yum -y install clang jemalloc jemalloc-devel
|
||||
|
||||
|
||||
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
|
80
ext/central-controller-docker/main.sh
Executable file
80
ext/central-controller-docker/main.sh
Executable file
@ -0,0 +1,80 @@
|
||||
#!/bin/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_NAME" ]; then
|
||||
echo '*** FAILED: ZT_DB_NAME 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
|
||||
|
||||
RMQ=""
|
||||
if [ "$ZT_USE_RABBITMQ" == "true" ]; then
|
||||
if [ -z "$RABBITMQ_HOST" ]; then
|
||||
echo '*** FAILED: RABBITMQ_HOST environment variable not defined'
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$RABBITMQ_PORT" ]; then
|
||||
echo '*** FAILED: RABBITMQ_PORT environment variable not defined'
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$RABBITMQ_USERNAME" ]; then
|
||||
echo '*** FAILED: RABBITMQ_USERNAME environment variable not defined'
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$RABBITMQ_PASSWORD" ]; then
|
||||
echo '*** FAILED: RABBITMQ_PASSWORD environment variable not defined'
|
||||
exit 1
|
||||
fi
|
||||
RMQ=", \"rabbitmq\": {
|
||||
\"host\": \"${RABBITMQ_HOST}\",
|
||||
\"port\": ${RABBITMQ_PORT},
|
||||
\"username\": \"${RABBITMQ_USERNAME}\",
|
||||
\"password\": \"${RABBITMQ_PASSWORD}\"
|
||||
}"
|
||||
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
|
||||
|
||||
DEFAULT_PORT=9993
|
||||
|
||||
echo "{
|
||||
\"settings\": {
|
||||
\"portMappingEnabled\": true,
|
||||
\"softwareUpdate\": \"disable\",
|
||||
\"interfacePrefixBlacklist\": [
|
||||
\"inot\",
|
||||
\"nat64\"
|
||||
],
|
||||
\"controllerDbPath\": \"postgres:host=${ZT_DB_HOST} port=${ZT_DB_PORT} dbname=${ZT_DB_NAME} user=${ZT_DB_USER} password=${ZT_DB_PASSWORD} sslmode=prefer sslcert=${DB_CLIENT_CERT} sslkey=${DB_CLIENT_KEY} sslrootcert=${DB_SERVER_CA}\"
|
||||
${RMQ}
|
||||
}
|
||||
}
|
||||
" > /var/lib/zerotier-one/local.conf
|
||||
|
||||
export GLIBCXX_FORCE_NEW=1
|
||||
export GLIBCPP_FORCE_NEW=1
|
||||
export LD_PRELOAD="/usr/lib64/libjemalloc.so"
|
||||
exec /usr/local/bin/zerotier-one -p${ZT_CONTROLLER_PORT:-$DEFAULT_PORT} /var/lib/zerotier-one
|
@ -339,7 +339,7 @@ central-controller: FORCE
|
||||
make -j4 LDLIBS="-L/usr/pgsql-10/lib/ -lpq -Lext/librabbitmq/centos_x64/lib/ -lrabbitmq" CXXFLAGS="-I/usr/pgsql-10/include -I./ext/librabbitmq/centos_x64/include -fPIC" DEFS="-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER" ZT_OFFICIAL=1 ZT_USE_X64_ASM_ED25519=1 one
|
||||
|
||||
central-controller-docker: central-controller
|
||||
docker build -t docker.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f docker/Dockerfile .
|
||||
docker build -t docker.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f ext/central-controller-docker/Dockerfile .
|
||||
|
||||
debug: FORCE
|
||||
make ZT_DEBUG=1 one
|
||||
|
Loading…
Reference in New Issue
Block a user