mirror of
https://github.com/xubiaolin/docker-zerotier-planet.git
synced 2025-03-14 16:28:14 -04:00
support multi planet in deployment
This commit is contained in:
parent
bbbe9ea4d3
commit
c8d4ce75a4
10
Dockerfile
10
Dockerfile
@ -11,7 +11,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/re
|
|||||||
&& apk update\
|
&& apk update\
|
||||||
&& mkdir -p /usr/include/nlohmann/ && cd /usr/include/nlohmann/ && wget https://ghself.markxu.online/https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp \
|
&& mkdir -p /usr/include/nlohmann/ && cd /usr/include/nlohmann/ && wget https://ghself.markxu.online/https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp \
|
||||||
&& apk add --no-cache git python3 npm make g++ zerotier-one linux-headers\
|
&& apk add --no-cache git python3 npm make g++ zerotier-one linux-headers\
|
||||||
&& mkdir /app -p && cd /app && git clone --progress https://ghself.markxu.online/https://github.com/key-networks/ztncui.git\
|
&& mkdir /app /var/lib -p && cd /app && git clone --progress https://ghself.markxu.online/https://github.com/key-networks/ztncui.git\
|
||||||
&& cd /app/ztncui/src \
|
&& cd /app/ztncui/src \
|
||||||
&& cp /app/patch/binding.gyp .\
|
&& cp /app/patch/binding.gyp .\
|
||||||
&& echo "开始配置npm环境"\
|
&& echo "开始配置npm环境"\
|
||||||
@ -24,11 +24,15 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/re
|
|||||||
&& echo "${ZT_PORT}" >/app/zerotier-one.port \
|
&& echo "${ZT_PORT}" >/app/zerotier-one.port \
|
||||||
&& cp -v etc/default.passwd etc/passwd
|
&& cp -v etc/default.passwd etc/passwd
|
||||||
|
|
||||||
|
#ADD ./pztier/zerotier-one* /var/lib/
|
||||||
|
RUN cp -r /app/pztier/zerotier-one /var/lib/ || true
|
||||||
|
|
||||||
|
#RUN ls -al /var/lib/ /var/lib/zerotier-one/ |grep -v zerotier && sleep 20
|
||||||
RUN cd /app && git clone --progress https://ghself.markxu.online/https://github.com/zerotier/ZeroTierOne.git --depth 1\
|
RUN cd /app && git clone --progress https://ghself.markxu.online/https://github.com/zerotier/ZeroTierOne.git --depth 1\
|
||||||
&& zerotier-one -d && sleep 5s && ps -ef |grep zerotier-one |grep -v grep |awk '{print $1}' |xargs kill -9 \
|
&& zerotier-one -d && sleep 5s && ps -ef |grep zerotier-one |grep -v grep |awk '{print $1}' |xargs kill -9 \
|
||||||
&& cd /var/lib/zerotier-one && zerotier-idtool initmoon identity.public >moon.json\
|
&& cd /var/lib/zerotier-one && ( [ -f ./moon.json ] || zerotier-idtool initmoon identity.public >moon.json ) \
|
||||||
&& cd /app/patch && python3 patch.py \
|
&& cd /app/patch && python3 patch.py \
|
||||||
&& cd /var/lib/zerotier-one && zerotier-idtool genmoon moon.json && mkdir moons.d && cp ./*.moon ./moons.d \
|
&& cd /var/lib/zerotier-one && zerotier-idtool genmoon moon.json && mkdir -p moons.d && cp ./*.moon ./moons.d \
|
||||||
&& cd /app/ZeroTierOne/attic/world/ && sh build.sh \
|
&& cd /app/ZeroTierOne/attic/world/ && sh build.sh \
|
||||||
&& sleep 5s \
|
&& sleep 5s \
|
||||||
&& cd /app/ZeroTierOne/attic/world/ && ./mkworld \
|
&& cd /app/ZeroTierOne/attic/world/ && ./mkworld \
|
||||||
|
10
deploy.sh
10
deploy.sh
@ -37,10 +37,11 @@ function install() {
|
|||||||
if [[ -n "$ipv6" ]]; then
|
if [[ -n "$ipv6" ]]; then
|
||||||
ipv6_entry="${ipv6}/${port}"
|
ipv6_entry="${ipv6}/${port}"
|
||||||
endpoints="[\"$ipv4_entry\",\"$ipv6_entry\"]"
|
endpoints="[\"$ipv4_entry\",\"$ipv6_entry\"]"
|
||||||
else
|
echo "[{\"stableEndpoints\":$endpoints}]" > ./patch/patch.json
|
||||||
|
elif [[ -n "$ipv4" ]]; then
|
||||||
endpoints="[\"$ipv4_entry\"]"
|
endpoints="[\"$ipv4_entry\"]"
|
||||||
|
echo "[{\"stableEndpoints\":$endpoints}]" > ./patch/patch.json
|
||||||
fi
|
fi
|
||||||
echo "{\"stableEndpoints\":$endpoints}" > ./patch/patch.json
|
|
||||||
|
|
||||||
echo "配置内容为:"
|
echo "配置内容为:"
|
||||||
echo "`cat ./patch/patch.json`"
|
echo "`cat ./patch/patch.json`"
|
||||||
@ -92,9 +93,12 @@ case "$choice" in
|
|||||||
1)
|
1)
|
||||||
echo "您选择了安装功能"
|
echo "您选择了安装功能"
|
||||||
install
|
install
|
||||||
|
docker cp zerotier-planet:/var/lib/zerotier-one/ ./pztier/
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo "您选择了更新功能"
|
echo "您选择了更新功能"
|
||||||
|
[ -f ./pztier/zerotier-one/moon.json ] && docker cp ./pztier/zerotier-one/moon.json zerotier-planet:/var/lib/zerotier-one/moon.json
|
||||||
|
[ -f ./pztier/zerotier-one/planet ] && docker cp ./pztier/zerotier-one/planet zerotier-planet:/var/lib/zerotier-one/planet
|
||||||
upgrade
|
upgrade
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
@ -102,7 +106,7 @@ case "$choice" in
|
|||||||
docker cp zerotier-planet:/app/bin/planet .
|
docker cp zerotier-planet:/app/bin/planet .
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "谢谢使用!"
|
echo "多planet:各planet执行完1之后,将各planet的stableendpoint合并到moon.json中,编辑好patch.json,planet0上重新执行1,将moon.json planet放到其他各planet中,重新执行2.谢谢使用!"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user