Docker Deployment (Recommended)

Production deployments should use Docker for consistency and ease of management.
Build Production Image
Terminal
# Build the image
docker build -t quick-search:latest .

# Tag for registry
docker tag quick-search:latest registry.example.com/quick-search:latest

# Push to registry
docker push registry.example.com/quick-search:latest
Run with Docker Compose
docker-compose.yml
version: '3.8'

services:
  quicksearch:
    image: quick-search:latest
    container_name: quicksearch-app
    ports:
      - "3000:3000"
    environment:
      - JWT_SECRET=${JWT_SECRET}
      - MEILISEARCH_HOST=http://meilisearch:7700
      - MEILISEARCH_API_KEY=${MEILISEARCH_API_KEY}
      - NUXT_PUBLIC_APP_URL=https://logs.example.com
    depends_on:
      - meilisearch
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/api/buffer-status"]
      interval: 30s
      timeout: 10s
      retries: 3

  meilisearch:
    image: getmeili/meilisearch:latest
    container_name: quicksearch-meilisearch
    ports:
      - "7700:7700"
    environment:
      - MEILI_MASTER_KEY=${MEILISEARCH_API_KEY}
    volumes:
      - meilisearch_data:/meili_data
    restart: unless-stopped

volumes:
  meilisearch_data:
Start Services
Terminal
# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Check status
docker-compose ps

Production Configuration

Security Warning: Always use strong, unique secrets in production. Never use default values.
Essential Environment Variables
Variable Production Value Notes
JWT_SECRET Random 64+ char Use openssl rand -base64 64
DEFAULT_ADMIN_PASSWORD Strong password Min 16 characters, mixed case
MEILISEARCH_API_KEY Random 64+ char Master key for search engine
NUXT_PUBLIC_APP_URL https://your-domain.com Public-facing URL
PORT 3000 Internal container port
Performance Tuning
.env (Production)
# Enable multi-threading for high throughput
MEILISEARCH_ENABLE_MULTI_THREADING=true
MEILISEARCH_MAX_WORKERS=0

# Batch settings (adjust based on load)
MEILISEARCH_BATCH_SIZE=1000
MEILISEARCH_SYSLOG_DELAY=60000
MEILISEARCH_API_DELAY=15000

Reverse Proxy Setup

Use nginx as a reverse proxy for SSL termination and better performance.

Nginx Configuration
/etc/nginx/sites-available/quicksearch
server {
    listen 80;
    server_name logs.example.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name logs.example.com;

    ssl_certificate /etc/letsencrypt/live/logs.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/logs.example.com/privkey.pem;

    # Security headers
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;

    # Proxy settings
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }

    # WebSocket support
    location /_nuxt/ {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
Enable Configuration
Terminal
# Create symlink
sudo ln -s /etc/nginx/sites-available/quicksearch /etc/nginx/sites-enabled/

# Test configuration
sudo nginx -t

# Restart nginx
sudo systemctl restart nginx
SSL Certificate with Let's Encrypt
Terminal
# Install certbot
sudo apt install certbot python3-certbot-nginx

# Obtain certificate
sudo certbot --nginx -d logs.example.com

# Auto-renewal is configured automatically
sudo certbot renew --dry-run

CI/CD Pipeline

Automated builds and deployments with GitLab CI.

GitLab CI Configuration
.gitlab-ci.yml
stages:
  - build
  - deploy

variables:
  DOCKER_IMAGE: registry.example.com/quick-search:$CI_COMMIT_SHORT_SHA

build:
  stage: build
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD registry.example.com
    - docker build -t $DOCKER_IMAGE -t registry.example.com/quick-search:latest .
    - docker push $DOCKER_IMAGE
    - docker push registry.example.com/quick-search:latest
  only:
    - main

deploy:
  stage: deploy
  image: alpine:latest
  script:
    - apk add --no-cache openssh-client
    - |
      ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST << 'ENDSSH'
        docker-compose -f /opt/quicksearch/docker-compose.yml pull
        docker-compose -f /opt/quicksearch/docker-compose.yml up -d
      ENDSSH
  only:
    - main
  when: manual

Monitoring & Health Checks

Health Endpoint
GET /api/buffer-status

Returns buffer status and worker information

Search Test
GET /api/events?limit=1

Verify search functionality

Prometheus Metrics (Optional)
docker-compose.yml
# Add to quicksearch service
labels:
  - "prometheus.io/scrape=true"
  - "prometheus.io/port=3000"
  - "prometheus.io/path=/metrics"
Log Aggregation
# View application logs
docker-compose logs -f quicksearch

# View last 100 lines
docker-compose logs --tail=100 quicksearch

# Export logs
docker-compose logs > quicksearch.log