OverviewFilesCommitsIssuesDocsReleasesPeers

hyperident-gateway commits / f531002

Add comprehensive deployment guide for Pear and traditional methods
Documents two deployment approaches: 1. Pear deployment - P2P distribution with automatic updates 2. Traditional deployment - Direct bare runtime installation Includes: - Development workflow with pear stage/release/seed - Remote deployment instructions for DigitalOcean droplet - Systemd service configuration for both methods - Update procedures - Troubleshooting guide Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
f531002f07e95d1c00a67df37d2fbbc19a52cfbf
by plankatron <fleeky@gmail.com> · 2026-01-17T21:02:02.000Z

Changed files (1) +248 -0

DEPLOYMENT.md +248 -0
……@@ -0,0 +1,248 @@
1# Hyperident Gateway - Deployment Guide
2
3This document explains how to deploy hyperident-gateway as a Pear application and via traditional methods.
4
5## Pear Deployment (Recommended for P2P Distribution)
6
7Pear allows you to distribute and update the gateway across the P2P network without centralized infrastructure.
8
9### Prerequisites
10
11Install Pear on the deployment machine:
12
13```bash
14npx pear
15```
16
17Follow the instructions to add Pear to your PATH.
18
19### Development Workflow
20
211. **Test locally in dev mode:**
22
23```bash
24cd /path/to/hyperident-gateway
25pear run --dev .
26```
27
28This runs the gateway from your local directory without staging.
29
302. **Stage for development channel:**
31
32```bash
33pear stage dev
34```
35
36This creates a `pear://` link you can share with others for testing. The link is deterministic based on:
37- Channel name (`dev`)
38- App name (from package.json)
39
403. **Test the staged version:**
41
42```bash
43pear run <dev-link>
44```
45
46### Production Deployment
47
481. **Stage for production:**
49
50```bash
51pear stage production
52```
53
54This outputs a production `pear://` link.
55
562. **Mark a release:**
57
58```bash
59pear release production
60```
61
62This creates a versioned release point. Now `pear run <production-link>` will load this stable version by default.
63
643. **Seed the app to the network:**
65
66```bash
67pear seed production
68```
69
70Keep this running to ensure peers can download the app. You can stop it when enough peers are seeding.
71
72### Installing on Remote Machines
73
74On any machine with Pear installed:
75
76```bash
77pear run <production-link> --args="--config /path/to/config.json"
78```
79
80Arguments after `--args=` are passed to the gateway application.
81
82### Deploying to 7rnx.net (DigitalOcean Droplet)
83
841. **Install Pear on the droplet:**
85
86```bash
87ssh fleeky@7rnx.net
88npx pear
89# Add to PATH as instructed
90```
91
922. **Run the gateway:**
93
94```bash
95pear run <production-link> --args="--config /etc/hyperident-gateway/config.json"
96```
97
983. **Create systemd service for persistence:**
99
100Create `/etc/systemd/system/hyperident-gateway.service`:
101
102```ini
103[Unit]
104Description=Hyperident Gateway (Pear)
105After=network-online.target
106Wants=network-online.target
107
108[Service]
109Type=simple
110User=root
111ExecStart=/home/fleeky/.config/pear/bin/pear run <production-link> --args="--config /etc/hyperident-gateway/config.json"
112Restart=always
113RestartSec=10
114StandardOutput=journal
115StandardError=journal
116
117[Install]
118WantedBy=multi-user.target
119```
120
121Replace `<production-link>` with your actual pear:// link.
122
123Enable and start:
124
125```bash
126sudo systemctl daemon-reload
127sudo systemctl enable hyperident-gateway
128sudo systemctl start hyperident-gateway
129```
130
131### Updates
132
133When you update the code:
134
1351. Stage new version:
136 ```bash
137 pear stage production
138 ```
139
1402. Mark new release:
141 ```bash
142 pear release production
143 ```
144
1453. Seed briefly to propagate:
146 ```bash
147 pear seed production
148 ```
149
150All peers running `pear run <link>` will automatically update to the new release on restart (or can be configured for hot-reload with Pear updates API).
151
152## Traditional Deployment (Bare Runtime)
153
154For direct deployment without Pear:
155
156### Prerequisites
157
158- Bare runtime installed
159- Root access (for TUN device creation)
160
161### Local Development
162
163```bash
164sudo bare gateway.js --config ./config/gateway-config.json
165```
166
167### Installing on Remote Machine
168
1691. **Clone the repository:**
170
171Via P2P VPN (if already on network):
172```bash
173git clone git://10.22.0.1/hyperident-gateway.git
174cd hyperident-gateway
175```
176
177Via SSH:
178```bash
179scp -r /path/to/hyperident-gateway fleeky@7rnx.net:/opt/
180```
181
1822. **Install dependencies:**
183
184```bash
185npm install --omit=dev
186```
187
1883. **Create configuration:**
189
190```bash
191sudo mkdir -p /etc/hyperident-gateway
192sudo cp config/gateway-config.json /etc/hyperident-gateway/
193```
194
195Edit `/etc/hyperident-gateway/config.json` for the specific machine.
196
1974. **Create systemd service:**
198
199Use the provided service file at `systemd/hyperident-gateway.service` or follow Pear deployment systemd section above.
200
201## Configuration
202
203The gateway requires a config file with:
204
205```json
206{
207 "version": "1.0.0",
208 "gateway": {
209 "virtualIP": "10.22.0.X",
210 "subnet": "10.22.0.0/16",
211 "tunDevice": "tun0",
212 "mtu": 1500,
213 "networkTopic": "hyperident-network"
214 }
215}
216```
217
218Each gateway should have a unique `virtualIP` within the subnet.
219
220## Troubleshooting
221
222### Pear Issues
223
224**App won't stage:**
225- Check package.json has valid `name` and `pear` fields
226- Run `pear doctor` for diagnostics
227
228**Peers can't download app:**
229- Ensure `pear seed <channel>` is running
230- Check firewall allows UDP traffic
231- Verify the link is correct
232
233### Gateway Issues
234
235**TUN device creation fails:**
236- Ensure running as root
237- Check `utun` module is installed
238
239**Can't ping other gateways:**
240- Verify both gateways use same `networkTopic`
241- Check firewall allows Hyperswarm traffic
242- Review gateway logs for connection status
243
244## Links
245
246- [Pear Documentation](https://docs.pears.com)
247- [Hyperswarm](https://github.com/holepunchto/hyperswarm)
248- [UTUN](https://github.com/holepunchto/utun)