diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 73f69e0..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
-# Editor-based HTTP Client requests
-/httpRequests/
diff --git a/.idea/docker-zerotier-planet.iml b/.idea/docker-zerotier-planet.iml
deleted file mode 100644
index d0876a7..0000000
--- a/.idea/docker-zerotier-planet.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index d1e22ec..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index afea342..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 2f9945e..9ab69da 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,54 +1,39 @@
-FROM centos:7
+FROM alpine:latest
-WORKDIR /var/lib/zerotier-one/
-COPY . /var/lib/zerotier-one/
-VOLUME ["/opt","/var/lib/zerotier-one"]
-EXPOSE 9993
+ADD ./run.sh /app/
+ADD ./patch /opt/patch/
-RUN curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo && \
- yum update -y && \
- yum install git make gcc gcc-c++ python3 wget -y && \
- yum install centos-release-scl -y &&\
- yum install devtoolset-8 -y &&\
+VOLUME ["/var/lib/zerotier-one/"]
- # 编译服务
+
+
+RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
+ apk update &&\
+ apk add git python3 nodejs npm make g++ linux-headers zerotier-one &&\
+ npm config set registry http://registry.npm.taobao.org &&\
+
+ # 安装ztncui
+ cd /opt && git clone https://github.com.cnpmjs.org/key-networks/ztncui.git &&\
+ cd ztncui/src && npm install -g node-gyp && npm install &&\
+ echo 'HTTP_PORT=3443' > .env&&\
+ echo 'NODE_ENV=production' >> .env &&\
+ echo 'HTTP_ALL_INTERFACES=true' >> .env &&\
+
+ # 添加补丁
cd /opt && \
git clone https://github.com.cnpmjs.org/zerotier/ZeroTierOne.git && \
- cd ZeroTierOne && \
- make && \
- make install && \
- # 配置moon
cd /var/lib/zerotier-one && \
zerotier-idtool generate identity.public identity.secret &&\
zerotier-idtool initmoon identity.public >> moon.json &&\
- #配置ztncui
- cd /opt &&\
- curl -sL https://rpm.nodesource.com/setup_10.x | bash - &&\
- yum install nodejs -y &&\
- rm -rf ztncui/ &&\
- git clone https://github.com.cnpmjs.org/key-networks/ztncui.git &&\
- cd ztncui/src &&\
- npm install -g node-gyp &&\
- npm install &&\
- sh -c "echo 'HTTP_PORT=3443' > .env"&&\
- sh -c "echo 'NODE_ENV=production' >> .env"&&\
-
- # 配置补丁
- cd /var/lib/zerotier-one && \
- python3 patch.py && \
- zerotier-idtool genmoon moon.json && \
- mkdir moons.d && cp ./*.moon ./moons.d &&\
- rm -rf planet &&\
-
- # 编译新的plane
+ cp /opt/patch/* . &&\
+ python3 patch.py &&\
+ rm /opt/ZeroTierOne/attic/world/mkworld.cpp &&\
+ cp mkworld.cpp /opt/ZeroTierOne/attic/world/ &&\
cd /opt/ZeroTierOne/attic/world/ && \
sh build.sh &&\
- mv world.bin /var/lib/zerotier-one/planet
-
-CMD [ "bash","run.sh" ]
-
-
-
+ cp ./world.bin /var/lib/zerotier-one/planet
+WORKDIR /app/
+CMD ["sh","./run.sh"]
diff --git a/README.md b/README.md
index 49205fd..189fcf7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,80 @@
-# docker-zerotier-planet
-私有部署zerotier-planet服务
+# Docker-zerotier-planet
+私有部署zeroteir-planet服务
-2021年11月21日之前更新使用教程
+zerotier是一个非常好用的私有组网的软件,但是官方提供的服务器离我们比较远,搭建卫星服务器虽然也能优化部分速度,但是远没有自己行星服务器高效.
+
+
+# 准备条件
+- 具有公网ip的服务器
+- 安装docker
+
+# 开始
+## 1.下载项目源码
+```
+git clone
+```
+## 2.修改项目中的patch/patch.json
+
+将其中的ip地址修改为你服务器的ip地址,端口保留不变即可
+
+
+## 3.在包含Dockerfile的目录下打包镜像
+```
+docker build -t zerotier-planet .
+```
+打包预计需要2-5分钟,具体需要看网络与机型
+
+
+# 启动项目
+```
+docker run -d --name zerotier-planet -p 3443:3443 -p 9993:9993 -p 9993:9993/udp -v /var/lib/zerotier-one:/var/lib/zerotier-one --restart unless-stopped zerotier-planet
+```
+
+
+# 创建网络
+服务器需要开放3443端口
+然后访问http://ip:3443 即可进入管理后台
+
+![ui](webui.png)
+
+
+使用默认账号为admin
+
+默认密码为 password
+
+进入后创建一个网络,可以得到一个网络ID
+
+# 客户端配置
+首先将服务器/var/lib/zerotier-one 目录下的planet文件下载到本地以备用
+
+## linux 客户端配置
+安装zerotier-one客户端
+```
+curl -s https://install.zerotier.com | sudo bash
+```
+进入/var/lib/zerotier-one目录下,
+删除目录下的planet文件,然后把从服务器下载的planet文件替换过来
+
+然后执行zerotier-cli join 网络ID
+
+成功后可以在管理后台上面看到一个新增的members,此时我们需要授权,否则将无法访问。
+
+![auth](auth.png)
+
+其他客户端加入也是一样要进行授权操作操作
+
+## windows 客户端配置
+windows
+将planet文件覆盖粘贴到C:\ProgramData\ZeroTier\One中
+
+windows搜索服务,并重启zeroiter-one
+
+powershell(admin)中执行zerotier-cli listpeers查看planet是否生效
+
+## 安卓客户端配置
+[Zerotier 非官方安卓客户端发布:支持自建 Moon 节点 - V2EX](https://www.v2ex.com/t/768628)
+
+# 参考链接
+[zerotier-虚拟局域网详解](https://www.glimmer.ltd/2021/3299983056/)
+
+[五分钟自建 ZeroTier 的 Planet/Controller](https://v2ex.com/t/799623)
\ No newline at end of file
diff --git a/auth.png b/auth.png
new file mode 100644
index 0000000..04b6875
Binary files /dev/null and b/auth.png differ
diff --git a/mkworld.cpp b/patch/mkworld.cpp
similarity index 100%
rename from mkworld.cpp
rename to patch/mkworld.cpp
diff --git a/patch.json b/patch/patch.json
similarity index 53%
rename from patch.json
rename to patch/patch.json
index b7baa14..dcb4c65 100644
--- a/patch.json
+++ b/patch/patch.json
@@ -1,5 +1,5 @@
{
"stableEndpoints": [
- "1.2.3.4/9993"
+ "81.70.255.9/9993"
]
-}
\ No newline at end of file
+}
diff --git a/patch.py b/patch/patch.py
similarity index 100%
rename from patch.py
rename to patch/patch.py
diff --git a/run.sh b/run.sh
index ea65a2e..0060a73 100644
--- a/run.sh
+++ b/run.sh
@@ -1,2 +1,6 @@
-#!/bin/bash
-cd /opt/ztncui/src && npm start
\ No newline at end of file
+#!/bin/sh
+echo "开始执行"
+zerotier-one -d
+
+cd /opt/ztncui/src
+npm start
diff --git a/webui.png b/webui.png
new file mode 100644
index 0000000..97346a6
Binary files /dev/null and b/webui.png differ