Skip to content

plamorg/voltproxy

Repository files navigation

voltproxy Logo

⚡ voltproxy

voltproxy is a reverse proxy designed to simplify the process of proxying Docker containers and other services. With voltproxy, you can easily manage and redirect traffic to different services using a single YAML configuration file.

Features:

  • Single configuration for all your services with YAML.
  • Streamlined Docker integration.
    • Simply provide a Docker container's name and network and voltproxy will do the rest.
    • No need to define per-container labels.
  • Automatic HTTPS with support for ACME-based certificates.
  • Load Balancing to enhance service scalability.
    • Customize service selection strategy.
    • Optionally persist client sessions through cookies.
  • Health Checking functionality to facilitate failover schemes.
  • Middlewares to attach additional functionality to existing services.
  • Customized structured logging options to provide detailed logs for monitoring.

🔧 Configuration

Here is a simple configuration to get started:

# config.yml
services:
  foo:
    host: foo.plam.dev
    redirect: "http://192.168.0.1:3000"
  bar:
    host: bar.plam.dev
    tls: true
    container:
      name: "/bar"
      network: "bar_default"
      port: 8080

This configuration instructs voltproxy to proxy incoming requests with the URL http://foo.plam.dev to http://192.168.0.1:3000 and proxy incoming requests with the URL https://bar.plam.dev to the specified Docker container.

See the documentation for more details.

Examples

These examples can be found in integration/examples.

Middleware Configuration

📝 Usage

You can either run voltproxy locally or deploy with Docker.

Local Installation

Ensure you have Go 1.21 or newer.

  1. Clone the repository:
$ git clone "https://github.com/plamorg/voltproxy.git"
  1. Build voltproxy:
$ cd voltproxy/
$ go build

Deploying with Docker

  1. Create voltproxy configuration config.yml.

  2. Create Docker Compose file docker-compose.yml. Example:

# docker-compose.yml
version: "3.3"

services:
  voltproxy:
    container_name: voltproxy
    image: claby2/voltproxy:latest
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - "./_certs:/usr/src/voltproxy/_certs"
      - "./config.yml:/usr/src/voltproxy/config.yml"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      # If proxying a Docker container, ensure the containers are connected to the same network.
      - service_net
networks:
  service_net:
    external: true
  1. Run container with Docker Compose:
$ docker compose up -d --force-recreate

🌟 Future Improvements

  • Additional load balancing selection strategies.
  • More middlewares.