This commit is contained in:
Tour
2025-12-06 19:36:46 +01:00
parent 48965d4c50
commit 20141ad17b
6 changed files with 22 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
# Server Configuration # Server Configuration
PORT=3000 PORT=3001
API_KEY=your-strong-api-key-here API_KEY=your-strong-api-key-here
# Database & Storage # Database & Storage

View File

@@ -61,10 +61,10 @@ RUN mkdir -p /app/data /app/media /app/.wwebjs_cache /app/.wwebjs_auth && \
USER whatsapp USER whatsapp
EXPOSE 3000 EXPOSE 3001
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));" CMD node -e "require('http').get('http://localhost:3001/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));"
CMD ["node", "server.js"] CMD ["node", "server.js"]

View File

@@ -21,7 +21,7 @@ npm install
npm start npm start
``` ```
Visit `http://localhost:3000/qr` to scan the WhatsApp QR code. Visit `http://localhost:3001/qr` to scan the WhatsApp QR code.
### Docker Deployment ### Docker Deployment
@@ -29,13 +29,13 @@ Visit `http://localhost:3000/qr` to scan the WhatsApp QR code.
docker-compose up -d --build docker-compose up -d --build
``` ```
Visit `http://your-server:3000/qr` to authenticate WhatsApp. Visit `http://your-server:3001/qr` to authenticate WhatsApp.
## QR Code Authentication ## QR Code Authentication
The server provides a web interface for easy WhatsApp authentication: The server provides a web interface for easy WhatsApp authentication:
- **URL**: `http://localhost:3000/qr` - **URL**: `http://localhost:3001/qr`
- **Features**: - **Features**:
- Real-time QR code display - Real-time QR code display
- Live connection status updates - Live connection status updates

View File

@@ -1,16 +1,16 @@
services: services:
whatjs: wapp:
user: "1000:1000" user: "1000:1000"
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: whatjs container_name: wapp
restart: unless-stopped restart: unless-stopped
networks: networks:
- traefik_net - traefik_net
environment: environment:
# Server configuration # Server configuration
- PORT=3000 - PORT=3001
- NODE_ENV=production - NODE_ENV=production
# API Security # API Security
@@ -26,8 +26,8 @@ services:
- REJECT_CALLS=false - REJECT_CALLS=false
# WebSocket URL for QR page (set this to your public URL when using Traefik) # WebSocket URL for QR page (set this to your public URL when using Traefik)
# Example: - WS_URL=https://whatjs.yourdomain.com # Example: - WS_URL=https://wapp.appmodel.nl
- WS_URL= - WS_URL=https://wapp.appmodel.nl
# CORS configuration # CORS configuration
- CORS_ORIGIN=* - CORS_ORIGIN=*
@@ -39,17 +39,17 @@ services:
- whatsapp-cache:/app/.wwebjs_cache - whatsapp-cache:/app/.wwebjs_cache
- whatsapp-auth:/app/.wwebjs_auth - whatsapp-auth:/app/.wwebjs_auth
# Uncomment labels below when ready to use Traefik # Uncomment labels below when ready to use Traefik
# labels: labels:
# - "traefik.enable=true" - "traefik.enable=true"
# - "traefik.http.routers.whatjs.rule=Host(`whatjs.yourdomain.com`)" - "traefik.http.routers.wapp.rule=Host(`wapp.appmodel.nl`)"
# - "traefik.http.routers.whatjs.entrypoints=websecure" - "traefik.http.routers.wapp.entrypoints=websecure"
# - "traefik.http.routers.whatjs.tls=true" - "traefik.http.routers.wapp.tls=true"
# - "traefik.http.routers.whatjs.tls.certresolver=letsencrypt" - "traefik.http.routers.wapp.tls.certresolver=letsencrypt"
# - "traefik.http.services.whatjs.loadbalancer.server.port=3000" - "traefik.http.services.wapp.loadbalancer.server.port=3001"
healthcheck: healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));"] test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3

View File

@@ -1,5 +1,5 @@
{ {
"name": "whatsapp-web-server", "name": "wapp",
"version": "1.0.0", "version": "1.0.0",
"description": "WhatsApp automation server with API and database", "description": "WhatsApp automation server with API and database",
"main": "server.js", "main": "server.js",

View File

@@ -12,7 +12,7 @@ const QRCode = require('qrcode')
// --- CONFIGURATION --- // --- CONFIGURATION ---
const config = { const config = {
port : process.env.PORT || 3000, port : process.env.PORT || 3001,
dbPath : process.env.DB_PATH || path.join(__dirname, 'data', 'whatsapp.db'), dbPath : process.env.DB_PATH || path.join(__dirname, 'data', 'whatsapp.db'),
mediaPath : process.env.MEDIA_PATH || path.join(__dirname, 'media'), mediaPath : process.env.MEDIA_PATH || path.join(__dirname, 'media'),
headless : process.env.HEADLESS !== 'false', headless : process.env.HEADLESS !== 'false',