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 FRONTEND_ALLOWED_ORIGINS=https://your-domain.com,https://www.your-domain.com
# Server Configuration # Server Configuration
PORT=3000 PORT=5172
BASE_PATH=/ BASE_PATH=/
NODE_ENV=production NODE_ENV=production
@ -34,6 +34,6 @@ DEBOUNCE_MS=2000 # Debounce delay for frontend input
# SEQ_API_KEY=your-seq-api-key # SEQ_API_KEY=your-seq-api-key
# Development Overrides (used in docker-compose.dev.yml) # 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_API_KEY=frontend-dev-key
# VITE_DEBOUNCE_MS=1000 # VITE_DEBOUNCE_MS=1000

View File

@ -89,11 +89,11 @@ RUN chown -R bitip:nodejs /app
USER bitip USER bitip
# Expose port # Expose port
EXPOSE 3000 EXPOSE 5172
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ 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 # Start the application
ENTRYPOINT ["dumb-init", "--"] 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 EXTERNAL_API_KEYS=external-dev-key-1,external-dev-key-2
# Server Configuration # Server Configuration
PORT=3000 PORT=5172
BASE_PATH=/ BASE_PATH=/
NODE_ENV=development NODE_ENV=development
@ -78,15 +78,15 @@ npm run dev
This will start: 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 dev server on http://localhost:5173 (or next available port)
- Frontend proxies API requests to backend - Frontend proxies API requests to backend
#### 5. Access the Application #### 5. Access the Application
- **Web Interface**: http://localhost:5173 (or the port shown in console) - **Web Interface**: http://localhost:5173 (or the port shown in console)
- **API Endpoint**: http://localhost:3000/api - **API Endpoint**: http://localhost:5172/api
- **Health Check**: http://localhost:3000/api/health - **Health Check**: http://localhost:5172/api/health
### Production Deployment (Docker) ### Production Deployment (Docker)
@ -114,9 +114,9 @@ docker-compose up -d
#### 3. Access the Service #### 3. Access the Service
- **Web Interface**: http://localhost:3000 - **Web Interface**: http://localhost:5172
- **API Endpoint**: http://localhost:3000/api - **API Endpoint**: http://localhost:5172/api
- **Health Check**: http://localhost:3000/api/health - **Health Check**: http://localhost:5172/api/health
## 📖 API Documentation ## 📖 API Documentation
@ -126,10 +126,10 @@ All API requests require an API key sent via header or query parameter:
```bash ```bash
# Via Header (recommended) # 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 # 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 ### Endpoints
@ -324,7 +324,7 @@ npm run install:all # Install all dependencies (root + backend + frontend)
| Variable | Default | Description | | Variable | Default | Description |
| ------------------------- | ---------------------- | -------------------------------------------- | | ------------------------- | ---------------------- | -------------------------------------------- |
| `PORT` | `3000` | Server port | | `PORT` | `5172` | Server port |
| `BASE_PATH` | `/` | Application base path | | `BASE_PATH` | `/` | Application base path |
| `NODE_ENV` | `development` | Environment mode (development/production) | | `NODE_ENV` | `development` | Environment mode (development/production) |
| `MAXMIND_DB_PATH` | `/usr/share/GeoIP` | MaxMind database directory | | `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 **Email**: tudor.stanciu94@gmail.com
Please include: Please include:
- Intended use case - Intended use case
- Organization name and size - Organization name and size
- Expected deployment scale - Expected deployment scale

View File

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

View File

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

View File

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

View File

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