yakmesh 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -5
- package/README.md +1 -1
- package/announcements/discord-v1.4.0.md +86 -0
- package/announcements/discord-v1.5.0.md +45 -0
- package/announcements/telegram-v1.4.0.md +43 -0
- package/announcements/telegram-v1.5.0.md +13 -0
- package/announcements/x-v1.4.0.md +58 -0
- package/announcements/x-v1.5.0.md +17 -0
- package/deploy-packages/yakmesh-full/start.sh +207 -0
- package/deploy-packages/yakmesh-full/stop.sh +30 -0
- package/deploy-packages/yakmesh-minimal/start.sh +161 -0
- package/deploy-packages/yakmesh-minimal/stop.sh +29 -0
- package/discord.md +3 -3
- package/ecosystem.config.json +16 -0
- package/hostinger/node.php +65 -0
- package/identity/node-key.js +161 -41
- package/mesh/network.js +47 -15
- package/package.json +4 -4
- package/scripts/start.sh +143 -0
- package/server/index.js +59 -20
- package/start-yakmesh.bat +25 -0
- package/yakbot/.env.example +22 -0
- package/yakbot/README.md +166 -0
- package/yakbot/index.js +713 -0
- package/yakbot/package-lock.json +433 -0
- package/yakbot/package.json +23 -0
- package/yakbot/register-commands.js +101 -0
- package/yakmesh.config.production.js +37 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to YAKMESH will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.5.0] - 2026-01-17
|
|
6
|
+
|
|
7
|
+
### 🔧 Critical Fix: Network Identity Unification
|
|
8
|
+
|
|
9
|
+
This release fixes a fundamental issue where nodes running identical code were generating different node IDs, preventing them from recognizing each other as peers on the same network.
|
|
10
|
+
|
|
11
|
+
#### The Problem (v1.4.0 and earlier)
|
|
12
|
+
- Node IDs were derived from **random public key** entropy
|
|
13
|
+
- Each node got a unique ID regardless of codebase
|
|
14
|
+
- Nodes couldn't verify they were on the same network by comparing node IDs
|
|
15
|
+
|
|
16
|
+
#### The Solution (v1.5.0)
|
|
17
|
+
- Node IDs now composed of TWO parts:
|
|
18
|
+
1. **Network Name** - Derived from codebase hash (SAME for all nodes on network)
|
|
19
|
+
2. **Instance ID** - Derived from public key (UNIQUE per node)
|
|
20
|
+
- Format: `node-[network-name]-[instance-id]`
|
|
21
|
+
- Example: `node-qubit-lattice-prism-pq-a7x9`
|
|
22
|
+
|
|
23
|
+
#### Human Verification
|
|
24
|
+
- All nodes on the same network share the same **network name** and **verification phrase**
|
|
25
|
+
- Users can verbally verify: "Are you on qubit-lattice-prism?"
|
|
26
|
+
- If network names match = same code = can peer
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- `identity/node-key.js` - Node ID generation now uses codebase hash for network name
|
|
30
|
+
- `server/index.js` - Oracle initialized BEFORE identity (provides codebase hash)
|
|
31
|
+
- `node-key.json` now stores `networkName`, `verificationPhrase`, and `codebaseHash`
|
|
32
|
+
- Identity automatically regenerates if codebase changes
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- `setCodebaseHash()` / `getCodebaseHash()` exports from identity module
|
|
36
|
+
- `getNetworkIdentity()` method on NodeIdentity class
|
|
37
|
+
- Codebase change detection - warns and regenerates identity on code updates
|
|
38
|
+
|
|
39
|
+
### Breaking Changes
|
|
40
|
+
- Existing `node-key.json` files will trigger identity regeneration
|
|
41
|
+
- Old node IDs are no longer compatible with v1.5.0 network naming
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## [1.4.0] - 2026-01-16
|
|
46
|
+
|
|
47
|
+
### 🔐 Yakmesh Annex - Post-Quantum Encrypted P2P Channels
|
|
48
|
+
|
|
49
|
+
#### Annex: Autonomous Network Negotiated Encrypted eXchange
|
|
50
|
+
- ML-KEM-768 (Kyber) key encapsulation for quantum-resistant key exchange
|
|
51
|
+
- AES-256-GCM authenticated encryption for message confidentiality
|
|
52
|
+
- Perfect Forward Secrecy - session keys rotate every 5 minutes or 10,000 messages
|
|
53
|
+
- Replay protection via sequence numbers in AAD
|
|
54
|
+
- Three-message handshake: INIT → ACCEPT → CONFIRM
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
- `mesh/annex.js` - Complete Annex implementation (744 lines)
|
|
58
|
+
- AnnexEnvelope class for encrypted message wrapping
|
|
59
|
+
- AnnexSession class for per-peer session management
|
|
60
|
+
- Annex main class for channel orchestration
|
|
61
|
+
- Documentation at `website/docs/annex.html`
|
|
62
|
+
- Whitepaper section 3.4 for Yakmesh Annex
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
5
66
|
## [1.3.2] - 2026-01-17
|
|
6
67
|
|
|
7
68
|
### Added
|
|
@@ -44,26 +105,26 @@ All notable changes to YAKMESH will be documented in this file.
|
|
|
44
105
|
|
|
45
106
|
### 🌟 Major New Systems - "A Beacon in the Darkness"
|
|
46
107
|
|
|
47
|
-
#### ECHO
|
|
108
|
+
#### ECHO - Encrypted Coordinate Heuristic Oracle
|
|
48
109
|
- Privacy-preserving network topology discovery
|
|
49
110
|
- Virtual coordinate system for latency estimation
|
|
50
111
|
- Encrypted timing probes (AES-256-GCM)
|
|
51
112
|
- Route optimization through coordinate-based pathfinding
|
|
52
113
|
|
|
53
|
-
#### PULSE
|
|
114
|
+
#### PULSE - Precision Universal Latency Sync Engine
|
|
54
115
|
- Mesh heartbeat system with cryptographic proofs
|
|
55
116
|
- Node liveness detection (alive/suspect/dead states)
|
|
56
117
|
- Network partition detection with confidence scoring
|
|
57
118
|
- Raft-inspired leader election using heartbeat chains
|
|
58
119
|
|
|
59
|
-
#### PHANTOM
|
|
120
|
+
#### PHANTOM - Post-quantum Hidden Anonymous Network Transmission
|
|
60
121
|
- **First-ever post-quantum onion routing implementation**
|
|
61
122
|
- ML-KEM-768 (Kyber) key encapsulation per layer
|
|
62
123
|
- Multi-layer encryption with temporal padding
|
|
63
124
|
- Decoy traffic injection (10% probability)
|
|
64
125
|
- Fixed packet sizing to prevent length analysis
|
|
65
126
|
|
|
66
|
-
#### BEACON
|
|
127
|
+
#### BEACON - Broadcast Emergency Alert Channel Over Network
|
|
67
128
|
- Priority message propagation (ROUTINE → CRITICAL)
|
|
68
129
|
- Flood-based protocol with intelligent deduplication
|
|
69
130
|
- Proof-of-receipt for delivery confirmation
|
|
@@ -96,7 +157,7 @@ All notable changes to YAKMESH will be documented in this file.
|
|
|
96
157
|
## [1.2.0] - 2026-01-15
|
|
97
158
|
|
|
98
159
|
### Added
|
|
99
|
-
- **TME
|
|
160
|
+
- **TME (Temporal Mesh Encoding)** - Novel packet resilience system
|
|
100
161
|
- Encodes data across TIME, not space
|
|
101
162
|
- Temporal slicing with cryptographic chaining
|
|
102
163
|
- Predictive reconstruction from timing proofs
|
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ See [TRADEMARK.md](TRADEMARK.md) for trademark usage policy.
|
|
|
180
180
|
<strong><a href="https://yakmesh.dev">yakmesh.dev</a></strong>
|
|
181
181
|
<br><br>
|
|
182
182
|
<p>
|
|
183
|
-
<a href="https://discord.gg/
|
|
183
|
+
<a href="https://discord.gg/8mSPfbJB8N">💬 Discord</a> •
|
|
184
184
|
<a href="https://t.me/yakmesh">📱 Telegram</a> •
|
|
185
185
|
<a href="https://x.com/yakmesh_dev">𝕏 Twitter</a>
|
|
186
186
|
</p>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 🦬 YAKMESH™ v1.4.0 — Annex Encrypted P2P + Trademark Cleanup!
|
|
2
|
+
|
|
3
|
+
Hey everyone! Fresh release just dropped:
|
|
4
|
+
|
|
5
|
+
## ✅ What's New
|
|
6
|
+
|
|
7
|
+
### 🔐 Yakmesh Annex - Encrypted Point-to-Point Messaging
|
|
8
|
+
**A**utonomous **N**etwork **N**egotiated **E**ncrypted e**X**change
|
|
9
|
+
|
|
10
|
+
Finally! Secure direct messaging between peers with:
|
|
11
|
+
- **ML-KEM768 (Kyber)** - Quantum-resistant key exchange
|
|
12
|
+
- **AES-256-GCM** - Authenticated symmetric encryption
|
|
13
|
+
- **Perfect Forward Secrecy** - Auto re-keys every 5 minutes
|
|
14
|
+
- **Replay Protection** - Sequence numbers + authenticated data
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
// Send encrypted message to peer
|
|
18
|
+
await node.annex.send(peerId, {
|
|
19
|
+
type: 'private',
|
|
20
|
+
data: 'Only you can read this!'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Receive encrypted messages
|
|
24
|
+
node.annex.onMessage(({ from, payload }) => {
|
|
25
|
+
console.log(`Secret from ${from}:`, payload);
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Use cases:**
|
|
30
|
+
- 🔔 Beacon acknowledgments with encryption
|
|
31
|
+
- 📦 Authenticated content delivery
|
|
32
|
+
- 💬 Private peer-to-peer chat
|
|
33
|
+
- 🔑 App-specific secure payloads
|
|
34
|
+
|
|
35
|
+
### ⚖️ Trademark Cleanup
|
|
36
|
+
We did a legal sweep and removed ™ claims from protocol names that conflict with existing trademarks:
|
|
37
|
+
- Yakmesh Phantom (was PHANTOM)
|
|
38
|
+
- Yakmesh Beacon (was BEACON)
|
|
39
|
+
- Yakmesh Echo (was ECHO)
|
|
40
|
+
- Yakmesh Pulse (was PULSE)
|
|
41
|
+
- Yakmesh Annex (new!)
|
|
42
|
+
|
|
43
|
+
**YAKMESH™ remains our registered trademark** - we own the patent! 🎉
|
|
44
|
+
|
|
45
|
+
### 🐛 Bug Fixes
|
|
46
|
+
- Fixed gossip propagation for content distribution
|
|
47
|
+
- Messages now properly wrapped with type field for routing
|
|
48
|
+
- Multi-node content sync working reliably
|
|
49
|
+
|
|
50
|
+
## 📊 Protocol Stack
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
┌─────────────────────────────────────────┐
|
|
54
|
+
│ HTTP API │ Public CDN layer │
|
|
55
|
+
├─────────────────┼───────────────────────┤
|
|
56
|
+
│ Annex │ ML-KEM768 + AES-256 │ ← NEW!
|
|
57
|
+
├─────────────────┼───────────────────────┤
|
|
58
|
+
│ Gossip │ ML-DSA-65 signed │
|
|
59
|
+
├─────────────────┼───────────────────────┤
|
|
60
|
+
│ Beacon │ Flood + signed │
|
|
61
|
+
├─────────────────┼───────────────────────┤
|
|
62
|
+
│ Phantom │ Onion + multi-KEM │
|
|
63
|
+
├─────────────────┼───────────────────────┤
|
|
64
|
+
│ Mesh │ ML-DSA-65 + Code Proof│
|
|
65
|
+
└─────────────────┴───────────────────────┘
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 📦 Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install yakmesh@1.4.0
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 🔗 Links
|
|
75
|
+
- 🌐 Website: https://yakmesh.dev
|
|
76
|
+
- 📖 GitHub: https://github.com/yakmesh/yakmesh
|
|
77
|
+
- 📦 npm: https://npmjs.com/package/yakmesh
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
**What's next?**
|
|
82
|
+
- Test Annex with multi-node encrypted messaging
|
|
83
|
+
- Deployment packages for easy self-hosting
|
|
84
|
+
- More protocol integrations
|
|
85
|
+
|
|
86
|
+
Questions? Drop them here! 🦬
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Yakmesh v1.5.0 - Network Identity Unification
|
|
2
|
+
|
|
3
|
+
**🦬 Yakmesh v1.5.0 is here!**
|
|
4
|
+
|
|
5
|
+
This release introduces **Network Identity Unification** - a fundamental improvement to how nodes identify themselves and verify they're running the same code.
|
|
6
|
+
|
|
7
|
+
## 🔑 What's New
|
|
8
|
+
|
|
9
|
+
### Network Identity Unification
|
|
10
|
+
Node IDs now contain TWO components:
|
|
11
|
+
- **Network Name** - Derived from codebase hash (SAME for all nodes on network)
|
|
12
|
+
- **Instance ID** - Derived from public key (UNIQUE per node)
|
|
13
|
+
|
|
14
|
+
Format: `node-[network-name]-[instance-id]`
|
|
15
|
+
Example: `node-grid-carbide-reveal-pq-QHZx`
|
|
16
|
+
|
|
17
|
+
**Why this matters:**
|
|
18
|
+
✅ Nodes running identical code share the same network name
|
|
19
|
+
✅ Visual verification: same network name = same code = can trust peer
|
|
20
|
+
✅ Each node still has a unique instance identifier
|
|
21
|
+
✅ Human-readable verification phrases for extra confirmation
|
|
22
|
+
|
|
23
|
+
### Automatic Port Fallback
|
|
24
|
+
No more "port in use" crashes! If default ports (3000, 9001) are occupied, the node automatically finds the next available port.
|
|
25
|
+
|
|
26
|
+
### Process Management Script
|
|
27
|
+
New `scripts/start.sh` for proper background process management:
|
|
28
|
+
```bash
|
|
29
|
+
./scripts/start.sh start # Start in background
|
|
30
|
+
./scripts/start.sh stop # Clean shutdown
|
|
31
|
+
./scripts/start.sh restart # Stop + start
|
|
32
|
+
./scripts/start.sh status # Check if running
|
|
33
|
+
./scripts/start.sh logs # View logs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## ⚠️ Breaking Change
|
|
37
|
+
Existing `node-key.json` files will trigger identity regeneration on first v1.5.0 startup. This is expected - the new format ensures network name derivation from codebase hash.
|
|
38
|
+
|
|
39
|
+
## 📦 Install/Upgrade
|
|
40
|
+
```bash
|
|
41
|
+
npm install yakmesh@1.5.0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
🔗 https://yakmesh.dev | 💬 Discord: https://discord.gg/8mSPfbJB8N
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Telegram Post for v1.4.0
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
🦬 **YAKMESH™ v1.4.0 Released!**
|
|
6
|
+
|
|
7
|
+
**🔐 NEW: Yakmesh Annex**
|
|
8
|
+
Encrypted point-to-point messaging between mesh peers!
|
|
9
|
+
|
|
10
|
+
**A**utonomous **N**etwork **N**egotiated **E**ncrypted e**X**change
|
|
11
|
+
|
|
12
|
+
✨ **Features:**
|
|
13
|
+
• ML-KEM768 (Kyber) quantum-resistant key exchange
|
|
14
|
+
• AES-256-GCM authenticated encryption
|
|
15
|
+
• Perfect forward secrecy (auto re-key)
|
|
16
|
+
• Replay protection
|
|
17
|
+
• Integrated into server startup
|
|
18
|
+
|
|
19
|
+
**💡 Use Cases:**
|
|
20
|
+
• Private peer-to-peer messaging
|
|
21
|
+
• Encrypted beacon acknowledgments
|
|
22
|
+
• Authenticated content delivery
|
|
23
|
+
• App-specific secure payloads
|
|
24
|
+
|
|
25
|
+
**🐛 Also Fixed:**
|
|
26
|
+
• Gossip content propagation
|
|
27
|
+
• Multi-node sync reliability
|
|
28
|
+
|
|
29
|
+
**📦 Install:**
|
|
30
|
+
```
|
|
31
|
+
npm install yakmesh@1.4.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**🔗 Links:**
|
|
35
|
+
• GitHub: github.com/yakmesh/yakmesh
|
|
36
|
+
• npm: npmjs.com/package/yakmesh
|
|
37
|
+
• Website: yakmesh.dev
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
*"Changes pass through math alone"* 🔐
|
|
42
|
+
|
|
43
|
+
#YAKMESH #PostQuantum #P2P #Cryptography
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
🦬 Yakmesh v1.5.0 Released
|
|
2
|
+
|
|
3
|
+
Network Identity Unification - nodes now share network names when running identical code.
|
|
4
|
+
|
|
5
|
+
New ID format: node-[network-name]-[instance-id]
|
|
6
|
+
|
|
7
|
+
• Same network name = same codebase = can peer
|
|
8
|
+
• Automatic port fallback
|
|
9
|
+
• Process management script
|
|
10
|
+
|
|
11
|
+
npm install yakmesh@1.5.0
|
|
12
|
+
|
|
13
|
+
https://yakmesh.dev
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# X (Twitter) Post for v1.4.0
|
|
2
|
+
|
|
3
|
+
## Main Tweet
|
|
4
|
+
|
|
5
|
+
🦬 YAKMESH™ v1.4.0 is live!
|
|
6
|
+
|
|
7
|
+
🔐 NEW: Yakmesh Annex - Encrypted P2P messaging
|
|
8
|
+
• ML-KEM768 quantum-resistant key exchange
|
|
9
|
+
• AES-256-GCM authenticated encryption
|
|
10
|
+
• Perfect forward secrecy
|
|
11
|
+
• "Changes pass through math alone"
|
|
12
|
+
|
|
13
|
+
npm install yakmesh@1.4.0
|
|
14
|
+
|
|
15
|
+
🧵👇
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Thread
|
|
20
|
+
|
|
21
|
+
### Tweet 2
|
|
22
|
+
What is Annex?
|
|
23
|
+
|
|
24
|
+
**A**utonomous **N**etwork **N**egotiated **E**ncrypted e**X**change
|
|
25
|
+
|
|
26
|
+
Point-to-point encrypted channels between mesh peers. No plaintext on the wire - only quantum-resistant ciphertext.
|
|
27
|
+
|
|
28
|
+
### Tweet 3
|
|
29
|
+
Use cases for Annex:
|
|
30
|
+
🔔 Encrypted beacon acknowledgments
|
|
31
|
+
📦 Authenticated content delivery
|
|
32
|
+
💬 Private peer-to-peer messaging
|
|
33
|
+
🔑 App-specific secure payloads
|
|
34
|
+
|
|
35
|
+
All while maintaining mesh topology!
|
|
36
|
+
|
|
37
|
+
### Tweet 4
|
|
38
|
+
Also in v1.4.0:
|
|
39
|
+
✅ Fixed gossip content propagation
|
|
40
|
+
✅ Multi-node sync now reliable
|
|
41
|
+
⚖️ Trademark cleanup (legal housekeeping)
|
|
42
|
+
|
|
43
|
+
YAKMESH™ is our only trademark - protocol names are descriptive.
|
|
44
|
+
|
|
45
|
+
### Tweet 5
|
|
46
|
+
The full protocol stack:
|
|
47
|
+
|
|
48
|
+
HTTP → Annex → Gossip → Beacon → Phantom → Mesh
|
|
49
|
+
|
|
50
|
+
Each layer adds security. Annex gives you encrypted P2P on top of our post-quantum signed mesh.
|
|
51
|
+
|
|
52
|
+
📖 https://github.com/yakmesh/yakmesh
|
|
53
|
+
📦 https://npmjs.com/package/yakmesh
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Hashtags
|
|
58
|
+
#PostQuantum #Cryptography #P2P #DecentralizedWeb #WebDev #NodeJS #OpenSource #Kyber #MLKEM
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
🦬 Yakmesh v1.5.0: Network Identity Unification
|
|
2
|
+
|
|
3
|
+
Node IDs now tell you if peers run the same code:
|
|
4
|
+
|
|
5
|
+
node-grid-carbide-reveal-pq-QHZx
|
|
6
|
+
^^^^^^^^^^^^^^^^^ unique
|
|
7
|
+
network name instance
|
|
8
|
+
|
|
9
|
+
✅ Same network name = same codebase = trustable peer
|
|
10
|
+
✅ Auto port fallback when ports busy
|
|
11
|
+
✅ Process management script included
|
|
12
|
+
|
|
13
|
+
Breaking: Nodes regenerate identity on first run (expected)
|
|
14
|
+
|
|
15
|
+
npm install yakmesh@1.5.0
|
|
16
|
+
|
|
17
|
+
#PostQuantum #P2P #DecentralizedWeb #OpenSource
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# YAKMESH Self-Contained Node - Start Script
|
|
4
|
+
# Complete stack with bundled binaries (Node.js, Caddy, PHP)
|
|
5
|
+
# No external dependencies required.
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
cd "$SCRIPT_DIR"
|
|
12
|
+
|
|
13
|
+
echo ""
|
|
14
|
+
echo " ====================================="
|
|
15
|
+
echo " YAKMESH SELF-CONTAINED"
|
|
16
|
+
echo " Complete Stack - All Bundled"
|
|
17
|
+
echo " ====================================="
|
|
18
|
+
echo ""
|
|
19
|
+
|
|
20
|
+
# Detect OS
|
|
21
|
+
OS="$(uname -s)"
|
|
22
|
+
ARCH="$(uname -m)"
|
|
23
|
+
|
|
24
|
+
case "$OS" in
|
|
25
|
+
Linux*) PLATFORM="linux" ;;
|
|
26
|
+
Darwin*) PLATFORM="darwin" ;;
|
|
27
|
+
*) echo "[ERROR] Unsupported OS: $OS"; exit 1 ;;
|
|
28
|
+
esac
|
|
29
|
+
|
|
30
|
+
case "$ARCH" in
|
|
31
|
+
x86_64) ARCH_NAME="x64" ;;
|
|
32
|
+
aarch64|arm64) ARCH_NAME="arm64" ;;
|
|
33
|
+
*) echo "[ERROR] Unsupported architecture: $ARCH"; exit 1 ;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
# Paths to bundled binaries
|
|
37
|
+
NODE_BIN="$SCRIPT_DIR/bin/node/bin/node"
|
|
38
|
+
CADDY_BIN="$SCRIPT_DIR/bin/caddy"
|
|
39
|
+
PHP_BIN="$SCRIPT_DIR/bin/php/php-cgi"
|
|
40
|
+
PHP_INI="$SCRIPT_DIR/bin/php/php.ini"
|
|
41
|
+
|
|
42
|
+
# Check for bundled binaries
|
|
43
|
+
MISSING=()
|
|
44
|
+
[ ! -f "$NODE_BIN" ] && MISSING+=("Node.js (bin/node/bin/node)")
|
|
45
|
+
[ ! -f "$CADDY_BIN" ] && MISSING+=("Caddy (bin/caddy)")
|
|
46
|
+
[ ! -f "$PHP_BIN" ] && MISSING+=("PHP (bin/php/php-cgi)")
|
|
47
|
+
|
|
48
|
+
if [ ${#MISSING[@]} -gt 0 ]; then
|
|
49
|
+
echo "[ERROR] Missing bundled binaries:"
|
|
50
|
+
for item in "${MISSING[@]}"; do
|
|
51
|
+
echo " - $item"
|
|
52
|
+
done
|
|
53
|
+
echo ""
|
|
54
|
+
echo "This is a self-contained package. Binaries should be included."
|
|
55
|
+
echo "Please re-download the full package from yakmesh.dev"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Show versions
|
|
60
|
+
NODE_VERSION=$("$NODE_BIN" --version)
|
|
61
|
+
echo "[OK] Node.js $NODE_VERSION (bundled)"
|
|
62
|
+
|
|
63
|
+
PHP_VERSION=$("$PHP_BIN" -v 2>/dev/null | head -1 | grep -oP 'PHP \K[\d.]+')
|
|
64
|
+
echo "[OK] PHP $PHP_VERSION (bundled)"
|
|
65
|
+
|
|
66
|
+
CADDY_VERSION=$("$CADDY_BIN" version 2>/dev/null | head -1)
|
|
67
|
+
echo "[OK] Caddy $CADDY_VERSION (bundled)"
|
|
68
|
+
|
|
69
|
+
# Create directories
|
|
70
|
+
mkdir -p "$SCRIPT_DIR/htdocs"
|
|
71
|
+
mkdir -p "$SCRIPT_DIR/data/content"
|
|
72
|
+
mkdir -p "$SCRIPT_DIR/logs"
|
|
73
|
+
|
|
74
|
+
# Create default index.html if not exists
|
|
75
|
+
INDEX_PATH="$SCRIPT_DIR/htdocs/index.html"
|
|
76
|
+
if [ ! -f "$INDEX_PATH" ]; then
|
|
77
|
+
cat > "$INDEX_PATH" << 'EOF'
|
|
78
|
+
<!DOCTYPE html>
|
|
79
|
+
<html>
|
|
80
|
+
<head>
|
|
81
|
+
<title>YAKMESH Node</title>
|
|
82
|
+
<style>
|
|
83
|
+
body { font-family: system-ui; max-width: 800px; margin: 50px auto; padding: 20px; background: #f8f9fa; }
|
|
84
|
+
h1 { color: #2d5016; }
|
|
85
|
+
code { background: #e9ecef; padding: 2px 6px; border-radius: 4px; font-family: 'Consolas', monospace; }
|
|
86
|
+
.status { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
|
|
87
|
+
.online { background: #28a745; }
|
|
88
|
+
.card { background: white; padding: 20px; border-radius: 8px; margin: 20px 0; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
|
89
|
+
</style>
|
|
90
|
+
</head>
|
|
91
|
+
<body>
|
|
92
|
+
<h1>🦬 YAKMESH Self-Contained Node</h1>
|
|
93
|
+
<p>Your complete Yakmesh stack is running.</p>
|
|
94
|
+
|
|
95
|
+
<div class="card">
|
|
96
|
+
<h2>Services</h2>
|
|
97
|
+
<p><span class="status online"></span><strong>Web Server:</strong> <a href="http://localhost:8080">http://localhost:8080</a></p>
|
|
98
|
+
<p><span class="status online"></span><strong>Content API:</strong> <a href="http://localhost:3000/content">http://localhost:3000/content</a></p>
|
|
99
|
+
<p><span class="status online"></span><strong>PHP:</strong> <a href="http://localhost:8080/info.php">http://localhost:8080/info.php</a></p>
|
|
100
|
+
<p><span class="status online"></span><strong>Mesh P2P:</strong> <code>ws://localhost:9001</code></p>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="card">
|
|
104
|
+
<h2>Content API</h2>
|
|
105
|
+
<ul>
|
|
106
|
+
<li><code>GET /content</code> - List all content</li>
|
|
107
|
+
<li><code>GET /content/:hash</code> - Get content by hash</li>
|
|
108
|
+
<li><code>POST /content</code> - Store new content</li>
|
|
109
|
+
</ul>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="card">
|
|
113
|
+
<h2>Bundled Software</h2>
|
|
114
|
+
<ul>
|
|
115
|
+
<li>Node.js 20 LTS</li>
|
|
116
|
+
<li>PHP 8.3</li>
|
|
117
|
+
<li>Caddy 2.8</li>
|
|
118
|
+
</ul>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<p><a href="https://yakmesh.dev">yakmesh.dev</a> | <a href="https://github.com/yakmesh/yakmesh">GitHub</a></p>
|
|
122
|
+
</body>
|
|
123
|
+
</html>
|
|
124
|
+
EOF
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
# Create PHP info file
|
|
128
|
+
PHP_INFO_PATH="$SCRIPT_DIR/htdocs/info.php"
|
|
129
|
+
if [ ! -f "$PHP_INFO_PATH" ]; then
|
|
130
|
+
echo "<?php phpinfo();" > "$PHP_INFO_PATH"
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# Install node_modules using bundled Node if needed
|
|
134
|
+
if [ ! -d "node_modules" ]; then
|
|
135
|
+
echo "[INFO] Installing Node.js dependencies..."
|
|
136
|
+
export PATH="$(dirname "$NODE_BIN"):$PATH"
|
|
137
|
+
"$NODE_BIN" "$(dirname "$NODE_BIN")/npm" install 2>&1 || true
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
echo ""
|
|
141
|
+
echo "[INFO] Starting services..."
|
|
142
|
+
echo ""
|
|
143
|
+
|
|
144
|
+
# PID file
|
|
145
|
+
PID_FILE="$SCRIPT_DIR/data/.pids"
|
|
146
|
+
|
|
147
|
+
# Cleanup function
|
|
148
|
+
cleanup() {
|
|
149
|
+
echo ""
|
|
150
|
+
echo "[INFO] Shutting down..."
|
|
151
|
+
|
|
152
|
+
if [ -f "$PID_FILE" ]; then
|
|
153
|
+
while read -r pid; do
|
|
154
|
+
kill "$pid" 2>/dev/null || true
|
|
155
|
+
done < "$PID_FILE"
|
|
156
|
+
rm -f "$PID_FILE"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# Kill any orphan processes
|
|
160
|
+
pkill -f "yakmesh.*node" 2>/dev/null || true
|
|
161
|
+
pkill -f "php-cgi" 2>/dev/null || true
|
|
162
|
+
pkill -f "caddy.*yakmesh" 2>/dev/null || true
|
|
163
|
+
|
|
164
|
+
echo "[OK] All services stopped"
|
|
165
|
+
exit 0
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
trap cleanup SIGINT SIGTERM
|
|
169
|
+
|
|
170
|
+
# Start PHP FastCGI
|
|
171
|
+
"$PHP_BIN" -b 127.0.0.1:9000 -c "$PHP_INI" > "$SCRIPT_DIR/logs/php.log" 2>&1 &
|
|
172
|
+
PHP_PID=$!
|
|
173
|
+
echo "$PHP_PID" > "$PID_FILE"
|
|
174
|
+
echo " ✓ PHP FastCGI started (PID: $PHP_PID)"
|
|
175
|
+
|
|
176
|
+
# Start Yakmesh node
|
|
177
|
+
export YAKMESH_CONFIG="$SCRIPT_DIR/config/yakmesh.config.js"
|
|
178
|
+
"$NODE_BIN" server/index.js > "$SCRIPT_DIR/logs/mesh.log" 2>&1 &
|
|
179
|
+
MESH_PID=$!
|
|
180
|
+
echo "$MESH_PID" >> "$PID_FILE"
|
|
181
|
+
echo " ✓ Mesh Node started (PID: $MESH_PID)"
|
|
182
|
+
|
|
183
|
+
sleep 2
|
|
184
|
+
|
|
185
|
+
# Start Caddy
|
|
186
|
+
"$CADDY_BIN" run --config "$SCRIPT_DIR/config/Caddyfile" > "$SCRIPT_DIR/logs/caddy.log" 2>&1 &
|
|
187
|
+
CADDY_PID=$!
|
|
188
|
+
echo "$CADDY_PID" >> "$PID_FILE"
|
|
189
|
+
echo " ✓ Caddy started (PID: $CADDY_PID)"
|
|
190
|
+
|
|
191
|
+
echo ""
|
|
192
|
+
echo " ========================================"
|
|
193
|
+
echo " All services running!"
|
|
194
|
+
echo " ========================================"
|
|
195
|
+
echo ""
|
|
196
|
+
echo " Web Server: http://localhost:8080"
|
|
197
|
+
echo " PHP Info: http://localhost:8080/info.php"
|
|
198
|
+
echo " Content API: http://localhost:3000/content"
|
|
199
|
+
echo " Mesh P2P: ws://localhost:9001"
|
|
200
|
+
echo ""
|
|
201
|
+
echo " Logs: $SCRIPT_DIR/logs/"
|
|
202
|
+
echo ""
|
|
203
|
+
echo " Press Ctrl+C to stop all services"
|
|
204
|
+
echo ""
|
|
205
|
+
|
|
206
|
+
# Wait for processes
|
|
207
|
+
wait
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# YAKMESH Self-Contained Node - Stop Script
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
PID_FILE="$SCRIPT_DIR/data/.pids"
|
|
8
|
+
|
|
9
|
+
echo ""
|
|
10
|
+
echo "[INFO] Stopping YAKMESH services..."
|
|
11
|
+
|
|
12
|
+
# Stop processes from PID file
|
|
13
|
+
if [ -f "$PID_FILE" ]; then
|
|
14
|
+
while read -r pid; do
|
|
15
|
+
if kill -0 "$pid" 2>/dev/null; then
|
|
16
|
+
kill "$pid" 2>/dev/null
|
|
17
|
+
echo "[OK] Stopped process $pid"
|
|
18
|
+
fi
|
|
19
|
+
done < "$PID_FILE"
|
|
20
|
+
rm -f "$PID_FILE"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Kill any remaining processes
|
|
24
|
+
pkill -f "php-cgi" 2>/dev/null && echo "[OK] PHP stopped" || true
|
|
25
|
+
pkill -f "yakmesh.*node" 2>/dev/null && echo "[OK] Node processes stopped" || true
|
|
26
|
+
pkill -f "caddy" 2>/dev/null && echo "[OK] Caddy stopped" || true
|
|
27
|
+
|
|
28
|
+
echo ""
|
|
29
|
+
echo "[OK] All services stopped"
|
|
30
|
+
echo ""
|