P2POS is a libp2p-based cluster node with:
- membership-oriented cluster control
- periodic update checks
- browser-friendly transports (WebSocket)
- optional official AutoTLS (
libp2p.directviap2p-forge)
curl -fsSL https://raw.githubusercontent.com/ZhongWwwHhh/p2pos/dev/install.sh | sudo bashThe installer is interactive. It supports:
- joining an existing system (provide
system_pubkey) - bootstrapping a new system (generates system/admin/node materials)
- for first bootstrap install, it prints:
- DNS TXT records (
dnsaddr=...) for both node tcp and browser tls/ws - a single
p2pos-admin://...Web Admin bundle
- DNS TXT records (
After install:
- binary:
./p2pos-linuxin install directory - config:
./config.json - service:
p2pos.service
systemctl status p2pos
systemctl restart p2pos
systemctl stop p2pos
journalctl -u p2pos -fgo build ./...
./build.shThe binary provides a keygen subcommand used by installer flow:
./p2pos keygen --new-system --cluster-id default --admin-valid-to 9999-12-31T00:00:00ZOutput uses KEY=VALUE lines and includes:
- node private key + peer ID
- optional system keypair
- optional admin private key + admin proof
Example config.json:
{
"init_connections": [
{ "type": "dns", "address": "init.p2pos.zhongwwwhhh.cc" }
],
"listen": ["0.0.0.0:4100", "[::]:4100"],
"network_mode": "auto",
"auto_tls": {
"mode": "auto",
"user_email": "",
"port": 4101,
"cache_dir": ".autotls-cache",
"forge_auth": ""
},
"update_channel": "stable",
"cluster_id": "default",
"system_pubkey": "",
"admin_proof": {
"cluster_id": "",
"peer_id": "",
"role": "",
"valid_from": "",
"valid_to": "",
"sig": ""
},
"node_private_key": "",
"update_feed_url": "https://api.github.com/repos/ZhongWwwHhh/p2pos/releases/latest"
}update_channel:
stable: 只跟踪正式 Release(不含 pre-release)develop: 允许跟踪 pre-release(优先读取 GitHub releases 列表)
版本号格式:
- 正式版:
YYYYMMDD-HHMM - 开发预发布:
YYYYMMDD-HHMM-dev - 自动更新比较会按时间版本解析;同一时间戳下正式版高于
-dev。
成员存储说明:
config.json不再保存成员列表。sqlite.db的peers表即当前 membership 成员集合(按 snapshot 同步)。
init_connections with "type": "dns" supports multiple TXT records per domain.
You can publish multiple bootstrap addresses for the same peer, e.g.:
; TXT records should be set on _dnsaddr.init.p2pos.zhongwwwhhh.cc
dnsaddr=/ip4/<PUBLIC_IPV4>/tcp/4100/p2p/<PEER_ID>
dnsaddr=/ip4/<PUBLIC_IPV4>/tcp/4101/tls/sni/<ESCAPED_IP>.<PEER_CID36>.libp2p.direct/ws/p2p/<PEER_ID>Resolver behavior:
- parses all TXT records
- supports both raw multiaddr and
dnsaddr=prefix - merges all addresses by peer id
Current implementation uses official p2p-forge/client integration.
When AutoTLS is active (auto_tls.mode resolves to on), node startup will:
- create forge cert manager
- add forge-managed WSS listen addresses
- use forge TLS config for websocket transport
- announce forge-managed addresses through
AddrsFactory
Minimal config:
"auto_tls": {
"mode": "auto",
"user_email": "ops@example.com",
"port": 4101,
"cache_dir": ".autotls-cache",
"forge_auth": ""
}auto_tls.mode values:
auto(default): automatically enable AutoTLS when node is detected as publicon: force enable AutoTLS and attempt cert flow immediately (for first bootstrap node cold-start)off: force disable AutoTLSport: dedicated TLS/WebSocket listen port for browser access (separate fromlistentcp/quic port)
Notes:
forge_authis optional. Set it only if your forge registration endpoint requires access token.- AutoTLS is designed for browser-facing secure websocket connectivity.
- Node must be publicly reachable for certificate/domain registration flow to succeed.
- Cert cache lives under
auto_tls.cache_dir.
Browser libp2p clients can only use browser transports (for example ws/wss/webtransport).
For reliable browser access:
- use AutoTLS (
wsson forge domain) - ensure bootstrap peer is reachable from browser network
Frontend project is under web/ (Vue + Vite + Wrangler).
cd web
npm install
npm run devBuild and deploy:
npm run build
npm run deployMore details: web/README.md
database is lockedon SQLite:- reduce concurrent write pressure
- avoid external file watchers that keep hard locks on DB artifacts
- AutoTLS not becoming active:
- verify public reachability
- check registration/ACME logs in
journalctl -u p2pos -f
- service not auto-restarting:
- verify
Restart=alwaysexists in/etc/systemd/system/p2pos.service - run
systemctl daemon-reload && systemctl restart p2pos
- verify