oupula/ztncui

By oupula

Updated 11 months ago

ztncui + zerotier-one image

Image
Networking
0

1.3K

oupula/ztncui repository overview

support x86_64 / arm64 machine

create container:

docker run -it \
      --restart=always \
      --device /dev/net/tun \
      -p 9993:9993:udp \
      -p 3000:3000:tcp \
      -p 3443:3443:tcp \
      -e ZT_PORT=9993 \
      -e ZT_ADDR=localhost:9993 \
      -e NODE_ENV=production \
      -e PASSWORD=123456 \
      -e HTTPS_PORT=3443 \
      -e HTTPS_DOMAIN=ztncui.example.com \
      -e HTTP_PORT=3000 \
      -e PLANET_IPV4_LIST="222.217.92.65,222.218.84.200" \
      -e PLANET_IPV6_LIST="240e:950:1:2003:8000::65,240e:a5:4a00:400:3::7d9" \
      -v /opt/docker/data/ztncui:/opt/key-networks/ztncui \
   -v /opt/docker/data/zerotier:/var/lib/zerotier-one \
   --name ztncui -d oupula/ztncui:latest

LISTEN PORT

9993 : zerotier-one listen port (host) must the same with -e ZT_PORT
3000 : ztncui http listen port (host)
3443 : ztncui https listen port (host)

ENVIROMENT VARIABLE

ZT_PORT=9993 : zerotier-one listen port (container) default value:9993 this value use generate planet file , planet path: /var/lib/zerotier-one/planet
ZT_ADDR=localhost:9993 : ztncui connect to zerotier-one address (container) default value:localhost:9993
NODE_ENV=production : ztncui run in production mode, pug template engine will using cache default value:production
PASSWORD=123456 : container first run will set ztncui manager password with this value default value:123456
HTTPS_PORT=3443 : ztncui https listen port default value:3443
HTTPS_DOMAIN=3443 : ztncui https domain default value:ztncui.example.com container first run will use generate ssl cert , ssl save path: /opt/key-networks/ztncui/etc/tls
HTTP_PORT=3000 : ztncui http listen port default value:3000
PLANET_IPV4_LIST : planet public ipv4 address , Multiple IP addresses separated by "," this value use generate planet file , planet path: /var/lib/zerotier-one/planet
PLANET_IPV6_LIST : planet public ipv6 address , Multiple IP addresses separated by "," this value use generate planet file , planet path: /var/lib/zerotier-one/planet

VOLUME PATH

/opt/key-networks/ztncui : ztncui main directory
/var/lib/zerotier-one : zerotier-one data directory

MANAGER URL

ztncui manager url : https://HOST_IP:3443
username : admin
password : 123456 environment variable with PASSWORD,default value:123456

REGENERATE PLANET FILE

host shell:
docker exec -it ztncui bash
container shell:
cd /var/lib/zerotier-one
vi moon.json
mkworld
mv world.bin planet
chown -R zerotier:zerotier ./planet

regenerate moon.json

container shell:
cd /var/lib/zerotier-one
zerotier-idtool initmoon identity.public >> moon.json

example moon.json

{
  "id": "e355d60492",
  "objtype": "world",
  "roots": [
    {
      "identity": "e355d60492:0:38c1362bb0aa69def7d50817a9ba4eb329e2abd76d898647df3a33ad5f0fee0bcd8302337847aa9b01760d663a70dfa03d2e2aa39daaf610aaf331c160ac38c3",
      "stableEndpoints": ["114.114.114.114:9993","223.5.5.5:9993"] // modify this value 
    }
  ],
  "signingKey": "8442808096d6e8cacc80b10c404aef8ce30db231530f86468a43f0baac442d6bd01745449eaa1b46da1ce7dad972c0f5b41358c34021dbed23531501fd19ed1a",
  "signingKey_SECRET": "caf6f27af67ba352c8a88da053a3c6b14070810f04ae8570130c8b8f13c0dd0b4437d10c1f40ce97d60512f685bdf769d3a770630e236cbf7aeca0698d5c4604",
  "updatesMustBeSignedBy": "8442808096d6e8cacc80b10c404aef8ce30db231530f86468a43f0baac442d6bd01745449eaa1b46da1ce7dad972c0f5b41358c34021dbed23531501fd19ed1a",
  "worldType": "moon"
}

multi server node example moon.json

{
  "id": "e355d60492",
  "objtype": "world",
  "roots": [
    {
      "identity": "e355d60492:0:38c1362bb0aa69def7d50817a9ba4eb329e2abd76d898647df3a33ad5f0fee0bcd8302337847aa9b01760d663a70dfa03d2e2aa39daaf610aaf331c160ac38c3", //replace with your node server 1 /var/lib/zerotier-one/identity.public file content
      "stableEndpoints": ["114.114.114.114:9993","223.5.5.5:9993"] // replace with your node server 1 real public ip address list 
    },
    {
      "identity": "595520e908:0:c2a531223c3dfe6902b0c95e29c397b77465a52bdd0f48c8a3896c7d874c9565ba911ea7ffdecbdddf85f12b73285d82b0730cad4bc5ad797a487298612a6577", //replace with your node 2 /var/lib/zerotier-one/identity.public content
      "stableEndpoints": ["114.114.115.115:9993","223.6.6.6:9993"] // replace with your node server 2 real public ip address list 
    },
    { ... },  //node 3 
    { ... } , //node 4
    { ... } //node 5 , end without ","
  ],
  "signingKey": "8442808096d6e8cacc80b10c404aef8ce30db231530f86468a43f0baac442d6bd01745449eaa1b46da1ce7dad972c0f5b41358c34021dbed23531501fd19ed1a",
  "signingKey_SECRET": "caf6f27af67ba352c8a88da053a3c6b14070810f04ae8570130c8b8f13c0dd0b4437d10c1f40ce97d60512f685bdf769d3a770630e236cbf7aeca0698d5c4604",
  "updatesMustBeSignedBy": "8442808096d6e8cacc80b10c404aef8ce30db231530f86468a43f0baac442d6bd01745449eaa1b46da1ce7dad972c0f5b41358c34021dbed23531501fd19ed1a",
  "worldType": "moon"
}

RESET PASSWORD

host shell:
docker exec -it ztncui bash
container shell:
cd /opt/key-networks/ztncui/etc
PASSWORD=123456 ./ztncui passwd
chown -R zerotier:zerotier ./passwd
password will reset to 123456

TRUST SSL CERT

ssl path : /opt/key-networks/ztncui/etc/tls
cert file : fullchain.pem
private key : privkey.pem
container first run will auto gennerate self-sign ssl cert , not trustd
you can use Let's Encrypt to generate trustd ssl cert
container shell:
cd /opt/key-networks/ztncui/etc/tls
chown -R zerotier:zerotier ./*.pem
exit
host shell:
docker restart ztncui

Tag summary

Content type

Image

Digest

sha256:384cf5350

Size

181.5 MB

Last updated

11 months ago

docker pull oupula/ztncui