hhftechnology/middleware-manager

By hhftechnology

Updated 3 months ago

Middleware Manager is a microservice that seamlessly integrates with your existing Pangolin.

Image
Networking
Integration & delivery
Web servers
0

100K+

hhftechnology/middleware-manager repository overview

Pangolin Middleware Manager

Prerequisites

Before installing the Middleware Manager, ensure you have the following:

  • A working Pangolin deployment.
  • Network connectivity between the Middleware Manager and Pangolin's API
  • A directory for configuration and data persistence
  • Proper permissions to create files in the Traefik configuration directory
Installation Methods

The simplest way to deploy the Middleware Manager is by adding it to your existing Pangolin docker-compose.yml file:

middleware-manager:
  image: hhftechnology/middleware-manager:latest
  container_name: middleware-manager
  restart: unless-stopped
  volumes:
    - ./data:/data                                     # For database persistence
    - ./config/traefik/rules:/conf                     # Where Traefik config will be written
    - ./config/middleware-manager/templates.yaml:/app/config/templates.yaml  # Optional for custom templates
  environment:
    - PANGOLIN_API_URL=http://pangolin:3001/api/v1     # URL to your Pangolin API
    - TRAEFIK_CONF_DIR=/conf                           # Directory to write Traefik configurations
    - DB_PATH=/data/middleware.db                      # Path to SQLite database
    - PORT=3456                                        # Port for web UI and API
  ports:
    - "3456:3456"
  networks:
    - pangolin                                         # Must be on same network as Pangolin

After adding this configuration to your docker-compose.yml file, run:

docker compose up -d middleware-manager
Manual Installation

For development or custom deployment scenarios, you can also install the Middleware Manager manually:

  1. Clone the repository:

    git clone https://github.com/hhftechnology/middleware-manager.git
    cd middleware-manager
    
  2. Configure environment:

    cp .env.example .env
    # Edit .env with your specific configuration
    
  3. Build and start the service:

    make build
    ./middleware-manager
    

Note that manual installation requires Go 1.19+ and Node.js 16+ for building the application.

Configuration Options
Environment Variables

The Middleware Manager can be configured using the following environment variables:

VariableDescriptionDefault
PANGOLIN_API_URLURL to your Pangolin APIhttp://pangolin:3001/api/v1
TRAEFIK_CONF_DIRDirectory to write Traefik configurations/conf
DB_PATHPath to SQLite database/data/middleware.db
PORTPort for web UI and API3456
CHECK_INTERVAL_SECONDSHow often to check for new resources (seconds)30
GENERATE_INTERVAL_SECONDSHow often to update configuration files (seconds)10
DEBUGEnable debug loggingfalse
ALLOW_CORSEnable CORS for APIfalse
CORS_ORIGINAllowed CORS origin"" (all)
Custom Middleware Templates

You can create custom middleware templates by mounting a templates.yaml file to the container. This file defines default middlewares that will be available in your installation:

# Example templates.yaml
middlewares:
  - id: "security-headers"
    name: "Strong Security Headers"
    type: "headers"
    config:
      customResponseHeaders:
        Server: ""
        X-Powered-By: ""
      browserXSSFilter: true
      contentTypeNosniff: true
      customFrameOptionsValue: "SAMEORIGIN"
      forceSTSHeader: true
      stsIncludeSubdomains: true
      stsSeconds: 63072000
      
  - id: "rate-limit"
    name: "Standard Rate Limiting"
    type: "rateLimit"
    config:
      average: 100
      burst: 50
Initial Setup and Verification

After installation, follow these steps to verify everything is working correctly:

  1. Access the Web UI: Open your browser and navigate to http://your-server:3456 You should see the Middleware Manager dashboard.

  2. Check Resource Synchronization: The Middleware Manager should automatically start fetching resources from Pangolin. Navigate to the "Resources" tab to see if your resources are being listed.

  3. Verify Traefik Configuration: After the service has been running for a minute, check the configured TRAEFIK_CONF_DIR for a file named resource-overrides.yml. This file will contain the Traefik configuration generated by the Middleware Manager.

  4. Test Integration:

    • Create a simple middleware (like a basic header)
    • Assign it to a resource
    • Check if the configuration file is updated
    • Verify that Traefik has loaded the configuration without errors by checking Traefik logs
Troubleshooting Initial Setup

If you encounter issues during setup:

  • Check connectivity between the Middleware Manager and Pangolin
  • Ensure permissions are correct for writing to the Traefik configuration directory
  • Verify the Traefik configuration is being loaded properly by Traefik
  • Check the logs of the Middleware Manager container for any error messages:
    docker compose logs middleware-manager
    
  • Make sure Pangolin and the Middleware Manager are on the same network in Docker

Tag summary

Content type

Image

Digest

sha256:d9fa857c2

Size

14.1 MB

Last updated

3 months ago

docker pull hhftechnology/middleware-manager:20260421