refactor: update default port from 3000 to 5172 across configuration files and documentation

This commit is contained in:
Tudor Stanciu 2025-10-04 00:27:05 +03:00
parent f63ee472c8
commit 900a6e05a4
7 changed files with 26 additions and 25 deletions

View File

@ -11,7 +11,7 @@ EXTERNAL_API_KEYS=your-secure-external-api-key-1,your-secure-external-api-key-2
FRONTEND_ALLOWED_ORIGINS=https://your-domain.com,https://www.your-domain.com
# Server Configuration
PORT=3000
PORT=5172
BASE_PATH=/
NODE_ENV=production
@ -34,6 +34,6 @@ DEBOUNCE_MS=2000 # Debounce delay for frontend input
# SEQ_API_KEY=your-seq-api-key
# Development Overrides (used in docker-compose.dev.yml)
# VITE_API_URL=http://localhost:3000/api
# VITE_API_URL=http://localhost:5172/api
# VITE_API_KEY=frontend-dev-key
# VITE_DEBOUNCE_MS=1000

View File

@ -89,11 +89,11 @@ RUN chown -R bitip:nodejs /app
USER bitip
# Expose port
EXPOSE 3000
EXPOSE 5172
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => { process.exit(1) })"
CMD node -e "require('http').get('http://localhost:5172/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => { process.exit(1) })"
# Start the application
ENTRYPOINT ["dumb-init", "--"]

View File

@ -47,7 +47,7 @@ FRONTEND_API_KEY=frontend-dev-key
EXTERNAL_API_KEYS=external-dev-key-1,external-dev-key-2
# Server Configuration
PORT=3000
PORT=5172
BASE_PATH=/
NODE_ENV=development
@ -78,15 +78,15 @@ npm run dev
This will start:
- Backend API server on http://localhost:3000
- Backend API server on http://localhost:5172
- Frontend dev server on http://localhost:5173 (or next available port)
- Frontend proxies API requests to backend
#### 5. Access the Application
- **Web Interface**: http://localhost:5173 (or the port shown in console)
- **API Endpoint**: http://localhost:3000/api
- **Health Check**: http://localhost:3000/api/health
- **API Endpoint**: http://localhost:5172/api
- **Health Check**: http://localhost:5172/api/health
### Production Deployment (Docker)
@ -114,9 +114,9 @@ docker-compose up -d
#### 3. Access the Service
- **Web Interface**: http://localhost:3000
- **API Endpoint**: http://localhost:3000/api
- **Health Check**: http://localhost:3000/api/health
- **Web Interface**: http://localhost:5172
- **API Endpoint**: http://localhost:5172/api
- **Health Check**: http://localhost:5172/api/health
## 📖 API Documentation
@ -126,10 +126,10 @@ All API requests require an API key sent via header or query parameter:
```bash
# Via Header (recommended)
curl -H "X-API-Key: your-api-key" http://localhost:3000/api/lookup?ip=8.8.8.8
curl -H "X-API-Key: your-api-key" http://localhost:5172/api/lookup?ip=8.8.8.8
# Via Query Parameter
curl "http://localhost:3000/api/lookup?ip=8.8.8.8&apikey=your-api-key"
curl "http://localhost:5172/api/lookup?ip=8.8.8.8&apikey=your-api-key"
```
### Endpoints
@ -324,7 +324,7 @@ npm run install:all # Install all dependencies (root + backend + frontend)
| Variable | Default | Description |
| ------------------------- | ---------------------- | -------------------------------------------- |
| `PORT` | `3000` | Server port |
| `PORT` | `5172` | Server port |
| `BASE_PATH` | `/` | Application base path |
| `NODE_ENV` | `development` | Environment mode (development/production) |
| `MAXMIND_DB_PATH` | `/usr/share/GeoIP` | MaxMind database directory |
@ -481,6 +481,7 @@ For licensing inquiries, commercial use, or approval requests:
**Email**: tudor.stanciu94@gmail.com
Please include:
- Intended use case
- Organization name and size
- Expected deployment scale

View File

@ -90,7 +90,7 @@
"title": "Configuration",
"items": [
"**Environment-based Configuration** - All settings via `.env` file",
"**Flexible Port Configuration** - Configurable API port (default: 3000)",
"**Flexible Port Configuration** - Configurable API port (default: 5172)",
"**Base Path Support** - Deploy under custom URL paths (e.g., `/geoip-ui`)",
"**Database Path Configuration** - Custom MaxMind database locations",
"**Rate Limit Tuning** - Separate limits for frontend and external consumers",
@ -139,4 +139,4 @@
]
}
]
}
}

View File

@ -20,10 +20,10 @@ services:
build: .
restart: unless-stopped
ports:
- '3000:3000'
- '5172:5172'
environment:
# Server Configuration
- PORT=3000
- PORT=5172
- BASE_PATH=/
- NODE_ENV=production
@ -61,7 +61,7 @@ services:
'--no-verbose',
'--tries=1',
'--spider',
'http://localhost:3000/api/health',
'http://localhost:5172/api/health',
]
interval: 30s
timeout: 10s

View File

@ -91,9 +91,9 @@ NODE_ENV=development
- **Purpose**: Port number on which the backend API server listens
- **Format**: Integer (1-65535)
- **Required**: Yes
- **Default**: 3000 (if not set)
- **Default**: 5172 (if not set)
- **Development**: 5172
- **Production**: Typically 3000 or 8080
- **Production**: Typically 5172 or 8080
- **Example**: `5172`
**`BASE_PATH`**
@ -103,8 +103,8 @@ NODE_ENV=development
- **Required**: Yes
- **Default**: `/`
- **Use Cases**:
- `/` - Application at root (e.g., `http://localhost:3000/api/health`)
- `/geoip-ui` - Application under subpath (e.g., `http://localhost:3000/geoip-ui/api/health`)
- `/` - Application at root (e.g., `http://localhost:5172/api/health`)
- `/geoip-ui` - Application under subpath (e.g., `http://localhost:5172/geoip-ui/api/health`)
- Useful for reverse proxy scenarios or hosting multiple apps on same domain
- **Example**: `/geoip-ui`
- **Note**: All API routes are prefixed with this path automatically
@ -345,7 +345,7 @@ VITE_DEBOUNCE_MS=2000
FRONTEND_API_KEY=<secure-random-key>
EXTERNAL_API_KEYS=<key1>,<key2>,<key3>
FRONTEND_ALLOWED_ORIGINS=https://your-domain.com,https://www.your-domain.com
PORT=3000
PORT=5172
BASE_PATH=/
NODE_ENV=production
MAXMIND_DB_PATH=/usr/share/GeoIP

View File

@ -11,7 +11,7 @@ const __dirname = dirname(__filename);
dotenvConfig({ path: path.join(__dirname, '../../../.env') });
export const config: Config = {
port: parseInt(process.env.PORT || '3000', 10),
port: parseInt(process.env.PORT || '5172', 10),
basePath: process.env.BASE_PATH || '/',
maxmindDbPath: process.env.MAXMIND_DB_PATH || '/usr/share/GeoIP',
seqUrl: process.env.SEQ_URL,