Comments (8)
我已经内嵌planet&moon,生成工具,就是不知道docker exec -it (容器名) build planet,使用这个命令
from docker-zerotier-planet.
麻烦xubiaolin大佬说一下,谢谢了
from docker-zerotier-planet.
你看代码改改就行
from docker-zerotier-planet.
谢谢大佬的回复:代码如下我已经会AUTOGEN_PLANET添加moon。就是不知道怎么改使用命令!!!docker exec -it (容器名) build planet,使用这个命令,我已经会添加moon
#!/bin/bash
# debugging purpose
if [ ! -z $DEBUG_ENV ]; then
echo "Debugging: Print EnvVar:"
printenv
fi
# create dest folder
mkdir -p /etc/zt-mkworld
# make sure we've got it chowned
chown -R zerotier-one:zerotier-one /opt/key-networks/ztncui
chown -R zerotier-one:zerotier-one /var/lib/zerotier-one
# detect if identity folder exists
if [ ! -d /var/lib/zerotier-one ]; then
mkdir -p /var/lib/zerotier-one
fi
# detect if identity private key exists
if [ ! -f /var/lib/zerotier-one/identity.secret ]; then
cd /var/lib/zerotier-one
/usr/sbin/zerotier-idtool generate identity.secret identity.public
fi
# always make httpfs folder
mkdir -p /opt/key-networks/ztncui/etc/httpfs
# detect public ip
if [ -z $MYADDR ]; then
echo "Set Your IP Address to continue."
echo "If you don't do that, I will automatically detect."
MYEXTADDR=$(curl --connect-timeout 5 ip.sb)
if [ -z $MYEXTADDR ]; then
MYINTADDR=$(ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
MYADDR=${MYINTADDR}
else
MYADDR=${MYEXTADDR}
fi
fi
MYDOMAIN=${MYDOMAIN:-ztncui.docker.test} # Used for planet comment
echo "YOUR IP: ${MYADDR}"
echo "YOUR DOMAIN: ${MYDOMAIN}"
cd /etc/zt-mkworld
# detect if ALREADY_INITED
if [ -f /etc/zt-mkworld/ALREADY_INITED ]; then
echo "ALREADY_INITED detected."
exit 0
# if not exist, goto planet file generate.
else
# if set to 0, won't do anything.
if [[ $AUTOGEN_PLANET -eq 0 ]]; then
# finally create ALREADY_INITED flag file
echo "AUTOGEN_PLANET is 0. Set to inited and exit."
touch /etc/zt-mkworld/ALREADY_INITED
exit 0
fi
# AUTOGEN_PLANET is not 0, backup now.
if [[ -f /var/lib/zerotier-one/planet ]]; then
cp /var/lib/zerotier-one/planet /var/lib/zerotier-one/planet.bak.$(date +%s)
fi
# if AUTOGEN_PLANET is set to 1, check if identity.public exists,
# then generate mkworld.config.json on the fly
if [[ $AUTOGEN_PLANET -eq 1 ]]; then
# check if identity.public exists
if [ -f /var/lib/zerotier-one/identity.public ]; then
# generate json config file
rm -f /etc/zt-mkworld/mkworld.config.json
# now heredoc
cat << EOF > /etc/zt-mkworld/mkworld.config.json
{
"rootNodes": [
{
"comments": "custom planet - ${MYDOMAIN} - ${MYADDR}",
"identity": "$(cat /var/lib/zerotier-one/identity.public)",
"endpoints": [
"${MYADDR}/9993"
]
}
],
"signing": ["previous.c25519", "current.c25519"],
"output": "planet.custom",
"plID": 0,
"plBirth": 0,
"plRecommend": true
}
EOF
# run program under corresponding workdir, check exit code is 0.
cd /etc/zt-mkworld
/usr/local/bin/ztmkworld -c /etc/zt-mkworld/mkworld.config.json
# copy custom planet to /var/lib/zerotier-one and httpfs
if [[ $? -eq 0 ]]; then
cp -f ./planet.custom /var/lib/zerotier-one/planet
cp -f ./planet.custom /opt/key-networks/ztncui/etc/httpfs
chown -R zerotier-one:zerotier-one /var/lib/zerotier-one
echo "planet successfully generated."
else
echo "planet generator failed. exit now."
/run/s6/basedir/bin/halt
exit 1
fi
# finally create ALREADY_INITED flag file
echo "mkworld successfully ran."
touch /etc/zt-mkworld/ALREADY_INITED
exit 0
else
echo "identity.public does NOT exit, cannot generate planet file."
/run/s6/basedir/bin/halt
exit 1
fi
fi
# if set to 2, only use mkworld.config.json provided
# check if mkworld.config.json exists
if [[ $AUTOGEN_PLANET -eq 2 ]]; then
cd /etc/zt-mkworld
if [ ! -f /etc/zt-mkworld/mkworld.config.json ]; then
echo "/etc/zt-mkworld/mkworld.config.json not exists. exit now."
/run/s6/basedir/bin/halt
exit 1
fi
/usr/local/bin/ztmkworld -c /etc/zt-mkworld/mkworld.config.json
# check if successfully exit
# copy custom planet to /var/lib/zerotier-one and httpfs
if [[ $? -eq 0 ]]; then
cp -f ./planet.custom /var/lib/zerotier-one/planet
cp -f ./planet.custom /opt/key-networks/ztncui/etc/httpfs
chown -R zerotier-one:zerotier-one /var/lib/zerotier-one
echo "planet successfully generated."
else
echo "planet generator failed. exit now."
/run/s6/basedir/bin/halt
exit 1
fi
# finally create ALREADY_INITED flag file
echo "mkworld successfully ran."
touch /etc/zt-mkworld/ALREADY_INITED
exit 0
fi
# after generate, copy to httpfs folder, do not directly expose the mkworld config folder.
# the config folder contains secret keys!
fi
from docker-zerotier-planet.
他这个脚本文件是用于docker-compose.yml配置,添加变量的,也就是容器启动前必须设置好。AUTOGEN_PLANET=0~1
我的意思是增加,在容器启动后也能用命令
使用这个命令
docker exec -it (容器名) build planet
# 构建 moon
docker exec -it (容器名) build moon
# 构建 planet
docker exec -it (容器名) build planet
# 查询客户端配置moon方法
docker exec -it zerotier-planet build moonid
from docker-zerotier-planet.
麻烦xubiaolin大佬说一下,谢谢了
怎么添加命令 docker exec -it (容器名) 添加命令
from docker-zerotier-planet.
这个是docker基础语法,看文档就行
from docker-zerotier-planet.
谢谢
from docker-zerotier-planet.
Related Issues (20)
- docker部署成功无报错,planet文件也替换了,重启服务,没有自建的planet HOT 1
- centOS无法生成planet HOT 3
- 遇到这个问题怎么解决,重启容器倒是好了,但是时不时又出现
- 已删除
- 是否考虑集成 zero-ui HOT 4
- authtoken.secret不正确 HOT 4
- 怎么在armbian上用 HOT 2
- planet为啥连接了公网zeroiter的地址呢? HOT 7
- 防火墙后部署服务时的端口映射问题
- 项目生成的Moon文件作为moon节点使用后无法连接 HOT 3
- 关于更加完美全能的planet建议 HOT 2
- 公网轻量yun搭建成功,本地内网服务都可以访问,唯独路由器openwrt网页拒绝访问 HOT 3
- 1.14.0 最新版本,希望大大抽空更新 HOT 2
- 大佬能不能做个不用docker的项目,我的小鸡装不上docker HOT 3
- 偶尔会超时,应该怎么查?
- 可以给客户端限速吗? HOT 1
- 这个bridge的功能具体怎么使用?
- 更新功能报错 HOT 2
- 关于自定义Planet和官方Planet的关系的疑问
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-zerotier-planet.