Skip to content

Commit fdbaf18

Browse files
committed
Add comprehensive setup documentation to README
- Preserve all original content and credits - Add detailed architecture explanation with ASCII diagrams - Document reverse proxy benefits and setup rationale - Provide step-by-step installation and deployment guides - Include both reverse proxy and direct access scenarios - Add environment configuration examples and explanations - Document ngrok tunneling setup with custom domain support - Add comprehensive troubleshooting section - Include security considerations and best practices - Maintain respect for original authors and template credits
1 parent a9b01ec commit fdbaf18

File tree

1 file changed

+346
-4
lines changed

1 file changed

+346
-4
lines changed

README.md

Lines changed: 346 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
![nostr Badge](https://img.shields.io/badge/nostr-8e30eb?style=flat) ![Go Badge](https://img.shields.io/badge/Go-00ADD8?logo=go&logoColor=white) <img src="https://static.wixstatic.com/media/e9326a_3823e7e6a7e14488954bb312d11636da~mv2.png" height="20">
1+
![nostr Badge](https://img.shields.io/badge/nostr-8e30eb?style=flat) ![Go Badge](https://img.shields.io/badge/Go-00ADD8?logo=go&logoColor=white) ![React Badge](https://img.shields.io/badge/React-61DAFB?logo=react&logoColor=black) ![TypeScript Badge](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white) <img src="https://static.wixstatic.com/media/e9326a_3823e7e6a7e14488954bb312d11636da~mv2.png" height="20">
22

33
# Dashboard Panel for H.O.R.N.E.T Storage Nostr Relay
44

5-
This repository is home to the hornet storage panal which is a typescript / react web application designed for managing a hornet storage nostr multimedia relay which can be found here: https://github.com/HORNET-Storage/HORNETS-Nostr-Relay
5+
This repository is home to the hornet storage panel which is a typescript / react web application designed for managing a hornet storage nostr multimedia relay which can be found here: https://github.com/HORNET-Storage/HORNETS-Nostr-Relay
66

77
### Live Demo
88
We have a live demo that can be found at http://hornetstorage.net for anyone that wants to see what the panel looks like.
@@ -24,9 +24,322 @@ We have a live demo that can be found at http://hornetstorage.net for anyone tha
2424

2525
![image](https://github.com/HORNET-Storage/hornet-storage-panel/assets/138120736/ff763518-d399-408b-b0b4-487292ef57d6)
2626

27+
---
28+
29+
# 🏗️ Advanced Setup Guide
30+
31+
## Project Architecture
32+
33+
The HORNETS Relay Panel is built with a microservices architecture comprising:
34+
35+
### Services
36+
- **Frontend (React App)**: Port 3000 (dev) - The admin dashboard interface
37+
- **Panel API**: Port 9002 - Backend service for panel operations
38+
- **Relay Service**: Port 9001 - WebSocket service for Nostr relay functionality
39+
- **Wallet Service**: Port 9003 - Backend service for wallet operations
40+
- **Transcribe API**: Port 8000 - Service for transcription features
41+
42+
### Reverse Proxy Architecture
43+
```
44+
Client Request
45+
46+
Nginx (Port 80/443)
47+
48+
┌─────────────────────────────────────────────────────────────┐
49+
│ Route Distribution: │
50+
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
51+
│ │ / → Relay │ │ /front/ → React │ │ /panel/ → API│ │
52+
│ │ (Port 9001) │ │ (Port 3000) │ │ (Port 9002) │ │
53+
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
54+
│ ┌─────────────────┐ ┌─────────────────┐ │
55+
│ │ /wallet/ → Wallet│ │/transcribe/ → API│ │
56+
│ │ (Port 9003) │ │ (Port 8000) │ │
57+
│ └─────────────────┘ └─────────────────┘ │
58+
└─────────────────────────────────────────────────────────────┘
59+
```
60+
61+
## 🔧 Why Use a Reverse Proxy?
62+
63+
### Benefits of Reverse Proxy Setup (Recommended)
64+
1. **Security**: Single entry point with centralized security headers
65+
2. **SSL/TLS Termination**: Handle HTTPS certificates at the proxy level
66+
3. **Load Balancing**: Distribute traffic across service instances
67+
4. **Clean URLs**: User-friendly paths (`/front/`, `/panel/`) instead of ports
68+
5. **Single Domain**: All services accessible from one domain
69+
6. **WebSocket Support**: Proper handling of WebSocket connections for the relay
70+
7. **Tunnel Compatibility**: Works seamlessly with ngrok and other tunneling services
71+
72+
### Direct Access (Development Only)
73+
While possible, direct port access has limitations:
74+
- Multiple ports to manage
75+
- CORS issues between services
76+
- No unified SSL certificate
77+
- Poor user experience with port numbers in URLs
78+
79+
## 📋 Prerequisites
80+
81+
### Required Software
82+
- [Node.js](https://nodejs.org/en/) version **>=16.0.0**
83+
- [Yarn](https://yarnpkg.com/) package manager
84+
- [Git](https://git-scm.com/) for version control
85+
86+
### Optional (For Production)
87+
- [Nginx](https://nginx.org/) for reverse proxy
88+
- SSL certificate (Let's Encrypt recommended)
89+
- Domain name
90+
91+
## 🛠️ Installation & Setup
92+
93+
### 1. Clone the Repository
94+
```bash
95+
git clone https://github.com/HORNET-Storage/HORNETS-Relay-Panel.git
96+
cd HORNETS-Relay-Panel
97+
```
98+
99+
### 2. Install Dependencies
100+
```bash
101+
yarn install
102+
```
103+
104+
### 3. Environment Configuration
105+
106+
#### Development Setup
107+
For development, you can use the default configuration or create `.env.development`:
108+
```bash
109+
# Optional - defaults work for local development
110+
REACT_APP_BASE_URL=http://localhost:9002
111+
REACT_APP_WALLET_BASE_URL=http://localhost:9003
112+
REACT_APP_DEMO_MODE=false
113+
```
114+
115+
#### Production Setup
116+
Copy the example environment file and customize:
117+
```bash
118+
cp .env.production.example .env.production
119+
```
120+
121+
Edit `.env.production` with your actual values:
122+
```env
123+
# Production Environment Configuration
124+
REACT_APP_BASE_URL=https://your-domain.com/panel
125+
REACT_APP_WALLET_BASE_URL=https://your-domain.com/wallet
126+
REACT_APP_ASSETS_BUCKET=https://your-domain.com
127+
REACT_APP_DEMO_MODE=false
128+
129+
# Router configuration for reverse proxy
130+
REACT_APP_BASENAME=/front
131+
PUBLIC_URL=/front
132+
133+
# Development optimizations
134+
ESLINT_NO_DEV_ERRORS=true
135+
TSC_COMPILE_ON_ERROR=true
136+
```
137+
138+
### 4. Start Development Server
139+
140+
#### Using yarn (standard)
141+
```bash
142+
yarn start
143+
```
144+
145+
#### Using provided script (handles Node.js compatibility)
146+
```bash
147+
./start-app.sh # Linux/macOS
148+
start.bat # Windows
149+
```
150+
151+
The development server will start on `http://localhost:3000`
152+
153+
## 🚀 Deployment
154+
155+
### Scenario 1: With Reverse Proxy (Recommended)
156+
157+
#### Step 1: Build the Application
158+
```bash
159+
# Production build
160+
yarn build
161+
162+
# Using provided script (handles Node.js compatibility)
163+
./build.bat # Windows
164+
yarn build # Linux/macOS
165+
```
166+
167+
#### Step 2: Configure Nginx
168+
Use the provided configuration as a starting point:
169+
```bash
170+
# Copy the configuration file
171+
sudo cp hornet_services_updated.conf /etc/nginx/sites-available/hornets-relay
172+
sudo ln -s /etc/nginx/sites-available/hornets-relay /etc/nginx/sites-enabled/
173+
```
174+
175+
#### Step 3: Serve Built Files
176+
Copy the built files to your web server:
177+
```bash
178+
# Example for nginx
179+
sudo cp -r build/* /var/www/html/front/
180+
```
181+
182+
#### Step 4: Start Services
183+
Ensure all backend services are running:
184+
```bash
185+
# Start in order of dependency
186+
./relay-service & # Port 9001
187+
./panel-api & # Port 9002
188+
./wallet-service & # Port 9003
189+
./transcribe-api & # Port 8000
190+
```
191+
192+
#### Step 5: Start Nginx
193+
```bash
194+
sudo systemctl start nginx
195+
sudo systemctl enable nginx
196+
```
197+
198+
### Scenario 2: Direct Access (Development/Testing)
199+
200+
#### Step 1: Build with Root Path
201+
Update `.env.production`:
202+
```env
203+
REACT_APP_BASENAME=
204+
PUBLIC_URL=
205+
REACT_APP_BASE_URL=http://localhost:9002
206+
REACT_APP_WALLET_BASE_URL=http://localhost:9003
207+
```
208+
209+
#### Step 2: Build and Serve
210+
```bash
211+
yarn build
212+
# Serve the build folder (default port 3000)
213+
serve -s build
214+
```
215+
216+
#### Step 3: Configure CORS
217+
Ensure your backend services accept requests from the frontend origin.
218+
219+
## 🌐 Tunneling & Remote Access
220+
221+
### Using ngrok
222+
```bash
223+
# Install ngrok
224+
npm install -g ngrok
225+
226+
# With reverse proxy setup (random domain)
227+
ngrok http 80
228+
229+
# With reverse proxy setup (custom domain - requires ngrok pro)
230+
ngrok http --url=your-domain.ngrok.io 80
231+
232+
# Direct access to React app (without reverse proxy)
233+
ngrok http 3000
234+
235+
# Example output:
236+
# Forwarding https://abc123.ngrok.io -> http://localhost:80
237+
```
238+
239+
### Environment Variables for Tunneling
240+
When using tunnels, update your `.env.production`:
241+
```env
242+
REACT_APP_BASE_URL=https://your-tunnel-url.com/panel
243+
REACT_APP_WALLET_BASE_URL=https://your-tunnel-url.com/wallet
244+
```
245+
246+
## 🔧 Configuration Options
247+
248+
### REACT_APP_BASENAME
249+
Controls where the React app is served from:
250+
- `/front` - App accessible at `https://domain.com/front/`
251+
- `/admin` - App accessible at `https://domain.com/admin/`
252+
- `` (empty) - App accessible at `https://domain.com/`
253+
254+
### Service URLs
255+
- **REACT_APP_BASE_URL**: Panel API endpoint
256+
- **REACT_APP_WALLET_BASE_URL**: Wallet service endpoint
257+
- **REACT_APP_ASSETS_BUCKET**: Static assets URL
258+
259+
### Demo Mode
260+
Set `REACT_APP_DEMO_MODE=true` to enable demo functionality with mock data.
261+
262+
## 🐛 Troubleshooting
263+
264+
### Common Issues
265+
266+
#### 1. Node.js Compatibility
267+
**Error**: `digital envelope routines::unsupported`
268+
**Solution**: Scripts include `NODE_OPTIONS=--openssl-legacy-provider`
269+
270+
#### 2. Build Memory Issues
271+
**Error**: `JavaScript heap out of memory`
272+
**Solution**: Increase memory allocation:
273+
```bash
274+
export NODE_OPTIONS="--openssl-legacy-provider --max-old-space-size=4096"
275+
```
276+
277+
#### 3. API Connection Issues
278+
**Error**: Network errors or 404s
279+
**Solution**: Verify service URLs in environment variables and ensure backend services are running.
280+
281+
#### 4. Routing Issues with Reverse Proxy
282+
**Error**: 404 on refresh or direct URL access
283+
**Solution**: Configure nginx to handle React Router:
284+
```nginx
285+
location /front/ {
286+
try_files $uri $uri/ /front/index.html;
287+
}
288+
```
289+
290+
#### 5. WebSocket Connection Failures
291+
**Error**: WebSocket connection refused
292+
**Solution**: Ensure proper WebSocket configuration in nginx:
293+
```nginx
294+
proxy_set_header Upgrade $http_upgrade;
295+
proxy_set_header Connection $connection_upgrade;
296+
```
297+
298+
### Service Dependencies
299+
Start services in this order:
300+
1. Relay Service (Port 9001) - Core WebSocket functionality
301+
2. Panel API (Port 9002) - Main backend
302+
3. Wallet Service (Port 9003) - Payment processing
303+
4. Transcribe API (Port 8000) - Additional features
304+
5. Frontend (Port 3000) - User interface
305+
306+
### Health Checks
307+
- Nginx health: `curl http://localhost/health`
308+
- Individual services: `curl http://localhost:PORT/health`
309+
310+
## 📚 Development vs Production
311+
312+
### Development
313+
- Hot reloading enabled
314+
- Source maps included
315+
- Verbose error messages
316+
- Direct API calls to localhost ports
317+
318+
### Production
319+
- Optimized builds with minification
320+
- Source maps excluded
321+
- Error boundaries for user-friendly errors
322+
- Proxied API calls through reverse proxy
323+
324+
## 🔒 Security Considerations
325+
326+
### Production Security
327+
- Use HTTPS in production
328+
- Configure proper CORS policies
329+
- Implement rate limiting
330+
- Regular security headers via nginx
331+
- Keep dependencies updated
332+
333+
### Environment Variables
334+
- Never commit `.env.production` to version control
335+
- Use secure random values for secrets
336+
- Regularly rotate API keys and tokens
337+
338+
---
27339

28340
## Developer Information
29-
- 🐜 This panel relies heavily on the [Ant Design](https://ant.design/) component library with some modifications
341+
342+
### Basic Development Commands
30343

31344
Development mode
32345
```
@@ -38,12 +351,41 @@ Production mode
38351
yarn install && yarn build
39352
```
40353

41-
*.bat and .sh files are included for starting the panel ind dev mode and for creating a production build if needed*
354+
*.bat and .sh files are included for starting the panel in dev mode and for creating a production build if needed*
42355

43356
#### Requirements
44357
- [Node.js](https://nodejs.org/en/) version _>=16.0.0_
45358
- [yarn](https://yarnpkg.com/)
46359
- [git](https://git-scm.com/)
47360

361+
## 🤝 Contributing
362+
363+
1. Fork the repository
364+
2. Create a feature branch
365+
3. Make your changes
366+
4. Test thoroughly
367+
5. Submit a pull request
368+
369+
## 📄 License
370+
371+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
372+
373+
## 🙏 Acknowledgments
374+
375+
- 🐜 This panel relies heavily on the [Ant Design](https://ant.design/) component library with some modifications
376+
- Based on the [Lightence](https://github.com/altence/lightence-ant-design-react-template) template
377+
- Part of the HORNETS Storage ecosystem
378+
48379
### Credit
49380
This panel was created using the lightence template which can be found [here](https://github.com/altence/lightence-ant-design-react-template)
381+
382+
## 📞 Support
383+
384+
For issues and support:
385+
- GitHub Issues: Report bugs and request features
386+
- Community: Join our discussions
387+
- Documentation: Check the wiki for detailed guides
388+
389+
---
390+
391+
**Note**: This panel is designed to work with the [HORNETS Nostr Relay](https://github.com/HORNET-Storage/HORNETS-Nostr-Relay). Ensure you have the relay service running for full functionality.

0 commit comments

Comments
 (0)