Skip to content

Commit c38c658

Browse files
committed
Update README to reflect current working deployment setup
- Document direct access deployment method that actually works - Remove non-working reverse proxy configurations to prevent confusion - Clarify that service URLs (wallet/relay) require explicit configuration - Note that panel routing can be auto-detected but service URLs cannot - Add note that reverse proxy setup still needs proper configuration example TODO: Create working nginx configuration example for reverse proxy deployment
1 parent 8c9876e commit c38c658

1 file changed

Lines changed: 37 additions & 182 deletions

File tree

README.md

Lines changed: 37 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,21 @@ TSC_COMPILE_ON_ERROR=true
167167
```
168168

169169
#### Production Setup
170-
For production, minimal environment configuration is needed thanks to **dynamic URL detection**:
170+
For production deployment, you need explicit service URL configuration:
171171

172-
##### For Production Deployment
173172
Create `.env.production` for production builds:
174173

175174
```env
176175
# Demo mode (set to false for production)
177176
REACT_APP_DEMO_MODE=false
178177
179-
# Router configuration for /panel/ path
180-
REACT_APP_BASENAME=/panel
181-
PUBLIC_URL=/panel
178+
# Explicit service URLs (required)
179+
REACT_APP_WALLET_BASE_URL=http://localhost:9003
180+
REACT_APP_OWN_RELAY_URL=ws://localhost:9001
181+
182+
# Router configuration (empty for direct access)
183+
REACT_APP_BASENAME=
184+
PUBLIC_URL=
182185
183186
# Optional: Custom Nostr relay URLs (comma-separated list)
184187
# REACT_APP_NOSTR_RELAY_URLS=wss://your-relay1.com,wss://your-relay2.com
@@ -188,22 +191,12 @@ ESLINT_NO_DEV_ERRORS=true
188191
TSC_COMPILE_ON_ERROR=true
189192
```
190193

191-
##### For Development with Separate Services
192-
If you're running services on different ports during development:
193194

194-
```env
195-
# Development with separate services
196-
REACT_APP_BASE_URL=http://localhost:9002
197-
REACT_APP_WALLET_BASE_URL=http://localhost:9003
198-
REACT_APP_OWN_RELAY_URL=ws://localhost:9001
199-
REACT_APP_DEMO_MODE=false
200-
```
201-
202-
**🎯 Key Improvement**: The panel now runs **integrated with the relay server**, meaning:
203-
-**Single origin serving** - Panel and API from same host:port
204-
-**No reverse proxy needed** - Go server handles both static files and API
205-
-**Automatic URL detection** - Works on any domain without configuration
206-
-**Simplified deployment** - Build once, deploy anywhere
195+
**🎯 Key Requirements**:
196+
-**Explicit Service URLs Required** - Wallet and relay URLs must be configured in environment variables
197+
-**Panel Routing Auto-Detection** - Panel paths (REACT_APP_BASENAME/PUBLIC_URL) can be auto-detected
198+
-**Build-Time Configuration** - Service URLs are baked into the JavaScript bundle during build
199+
-**Simple Deployment** - No reverse proxy needed for basic functionality
207200

208201
### 4. Start Development Server
209202

@@ -222,7 +215,7 @@ The development server will start on `http://localhost:3000`
222215

223216
## 🚀 Deployment
224217

225-
### Scenario 1: With Reverse Proxy (Recommended)
218+
### Production Deployment
226219

227220
#### Step 1: Build the Application
228221
```bash
@@ -234,183 +227,45 @@ yarn build
234227
yarn build # Linux/macOS
235228
```
236229

237-
#### Step 1.5: Test Production Build Locally (Optional)
238-
Before deploying, you can test the production build locally:
239-
```bash
240-
# Install serve globally if not already installed
241-
npm install -g serve
242-
243-
# Serve the production build
244-
npx serve -s build
245-
```
246-
The production build will be available at `http://localhost:3000`
230+
#### Step 2: Deploy to Relay Server
231+
Copy the built files to your relay server's web directory and start the services:
247232

248-
#### Step 2: Configure Nginx
249-
Create an nginx configuration file:
250233
```bash
251-
# Create the configuration file
252-
sudo nano /etc/nginx/sites-available/hornets-relay
253-
```
234+
# Copy build files to relay server web directory
235+
cp -r build/* /path/to/relay/web/
254236

255-
Add this configuration (adjust domains and paths as needed):
256-
```nginx
257-
# WebSocket connection upgrade mapping
258-
map $http_upgrade $connection_upgrade {
259-
default upgrade;
260-
'' close;
261-
}
262-
263-
server {
264-
listen 80;
265-
server_name _; # Accept all hostnames (localhost, ngrok, custom domains, etc.)
266-
267-
# Forward client IP and protocol
268-
proxy_set_header X-Real-IP $remote_addr;
269-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
270-
proxy_set_header X-Forwarded-Proto $scheme;
271-
proxy_set_header Host $host;
272-
273-
# Wallet service proxying
274-
location /wallet/ {
275-
rewrite ^/wallet/(.*)$ /$1 break;
276-
proxy_pass http://127.0.0.1:9003;
277-
}
278-
279-
# Media moderation service (optional)
280-
location /moderate/ {
281-
rewrite ^/moderate/(.*)$ /$1 break;
282-
proxy_pass http://127.0.0.1:8000;
283-
}
284-
285-
# Panel access - Admin dashboard
286-
location /panel/ {
287-
rewrite ^/panel/(.*)$ /$1 break;
288-
proxy_pass http://127.0.0.1:9002;
289-
proxy_set_header Host $host;
290-
proxy_set_header X-Real-IP $remote_addr;
291-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
292-
proxy_set_header X-Forwarded-Proto $scheme;
293-
}
294-
295-
# Default location - Relay service with WebSocket support
296-
location / {
297-
proxy_pass http://127.0.0.1:9001;
298-
299-
# WebSocket headers
300-
proxy_http_version 1.1;
301-
proxy_set_header Upgrade $http_upgrade;
302-
proxy_set_header Connection $connection_upgrade;
303-
proxy_set_header Host $host;
304-
proxy_cache_bypass $http_upgrade;
305-
306-
# Extended timeouts for WebSocket connections
307-
proxy_read_timeout 86400s;
308-
proxy_send_timeout 86400s;
309-
proxy_connect_timeout 60s;
310-
}
311-
312-
# Health check endpoint
313-
location /health {
314-
access_log off;
315-
return 200 "healthy\n";
316-
add_header Content-Type text/plain;
317-
}
318-
}
237+
# Start services (adjust ports as needed)
238+
./relay-websocket-service & # Port 9001
239+
./relay-server-with-panel & # Port 9002 (serves both API and panel)
240+
./wallet-service & # Port 9003
319241
```
320242

321-
Enable the configuration:
322-
```bash
323-
sudo ln -s /etc/nginx/sites-available/hornets-relay /etc/nginx/sites-enabled/
324-
sudo nginx -t # Test configuration
325-
```
243+
#### Step 3: Access the Panel
244+
- **Panel**: `http://localhost:9002/` (or your configured domain)
245+
- **Wallet Service**: `http://localhost:9003/` (direct access)
246+
- **Relay WebSocket**: `ws://localhost:9001/` (WebSocket connection)
326247

327-
#### Step 3: Serve Built Files
328-
Copy the built files to your web server:
329-
```bash
330-
# Example for nginx
331-
sudo cp -r build/* /var/www/html/front/
332-
```
248+
**✅ This setup works without any reverse proxy configuration!**
333249

334-
#### Step 4: Start Services
335-
Ensure all backend services are running:
336-
```bash
337-
# Start in order of dependency
338-
./relay-service & # Port 9001
339-
./panel-api & # Port 9002
340-
./wallet-service & # Port 9003
341-
./media-moderation & # Port 8000 (optional)
342-
```
250+
> **Note**: Reverse proxy setup with nginx is possible but currently requires additional configuration. The direct access method above is the recommended approach for most users.
343251
344-
#### Step 5: Start Nginx
345-
```bash
346-
sudo systemctl start nginx
347-
sudo systemctl enable nginx
348-
```
349-
350-
### Scenario 2: Direct Access (Development/Testing)
351-
352-
#### Step 1: Build with Root Path
353-
Update `.env.production`:
354-
```env
355-
REACT_APP_BASENAME=
356-
PUBLIC_URL=
357-
# Note: API URLs are now auto-detected, no need to specify them!
358-
```
359-
360-
#### Step 2: Build and Serve
361-
```bash
362-
yarn build
363-
# Serve the build folder (default port 3000)
364-
serve -s build
365-
```
366-
367-
#### Step 3: Configure CORS
368-
Ensure your backend services accept requests from the frontend origin.
369-
370-
## 🌐 Tunneling & Remote Access
371-
372-
### Using ngrok
373-
```bash
374-
# Install ngrok
375-
npm install -g ngrok
376-
377-
# With reverse proxy setup (random domain)
378-
ngrok http 80
379-
380-
# With reverse proxy setup (custom domain - requires ngrok pro)
381-
ngrok http --url=your-domain.ngrok.io 80
382-
383-
# Direct access to React app (without reverse proxy)
384-
ngrok http 3000
385-
386-
# Example output:
387-
# Forwarding https://abc123.ngrok.io -> http://localhost:80
388-
```
389-
390-
### Environment Variables for Tunneling
391-
**Great news!** Thanks to dynamic URL detection, **no environment variable changes are needed** when using tunnels. The panel automatically adapts to any domain:
392-
393-
-`ngrok http 80` → Panel works immediately at `https://abc123.ngrok.io/front/`
394-
- ✅ Custom domain tunnel → Panel works immediately
395-
- ✅ Any hosting provider → Panel works immediately
396-
397-
**No rebuilds or environment changes required!**
398252

399253
## 🔧 Configuration Options
400254

401255
> **🚀 Major Improvement**: The panel now uses **dynamic URL detection** instead of hardcoded environment variables. This means **one build works everywhere** - no more environment-specific builds or complex URL configuration!
402256
403257
### REACT_APP_BASENAME
404-
Controls where the React app is served from:
405-
- `/front` - App accessible at `https://domain.com/front/`
406-
- `/admin` - App accessible at `https://domain.com/admin/`
407-
- `` (empty) - App accessible at `https://domain.com/`
258+
Controls the React app's routing base path:
259+
- `` (empty) - App accessible at `https://domain.com/` (recommended for direct access)
260+
- `/panel` - App accessible at `https://domain.com/panel/` (for reverse proxy setups)
261+
262+
**Note**: For the current working setup, leave this empty (`REACT_APP_BASENAME=`) since the panel is served from the root path.
408263

409264
### Service URLs
410-
**🎯 Auto-Detection**: Service URLs are now automatically detected in production:
411-
- **Panel API**: `${window.location.origin}/panel` (auto-detected)
412-
- **Wallet Service**: `${window.location.origin}/wallet` (auto-detected)
413-
- **Relay WebSocket**: `wss://${window.location.host}` (auto-detected)
265+
**🎯 Explicit Configuration Required**: Service URLs must be explicitly configured:
266+
- **Wallet Service**: `REACT_APP_WALLET_BASE_URL=http://localhost:9003` (required)
267+
- **Relay WebSocket**: `REACT_APP_OWN_RELAY_URL=ws://localhost:9001` (required)
268+
- **Panel API**: Auto-detected from current origin (no configuration needed)
414269

415270
**Manual Override** (development only):
416271
- **REACT_APP_BASE_URL**: Panel API endpoint (dev mode only)

0 commit comments

Comments
 (0)