voltproxy

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

README ΒΆ

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
    build:
      context: .
    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 to another Docker container, ensure the containers are on this same network.
      # This is optional if you are not proxying another Docker container.
      - 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.

Documentation ΒΆ

Overview ΒΆ

Package main provides a way to proxy services.

Directories ΒΆ

Path Synopsis
Package config provides a way to parse a YAML configuration file into a list of services.
Package config provides a way to parse a YAML configuration file into a list of services.
Package dockerapi provides a way to interact with the Docker API using an adapter pattern.
Package dockerapi provides a way to interact with the Docker API using an adapter pattern.
Package integration provides an interface to write integration tests for the reverse proxy.
Package integration provides an interface to write integration tests for the reverse proxy.
Package logging provides a simple wrapper around slog to initialize the logger with the given configuration.
Package logging provides a simple wrapper around slog to initialize the logger with the given configuration.
Package middlewares provides an interface for middlewares and the middlewares themselves.
Package middlewares provides an interface for middlewares and the middlewares themselves.
Package services provides a way to define services that can be proxied.
Package services provides a way to define services that can be proxied.
health
Package health provides utilitis to check the health of a service at a regular interval.
Package health provides utilitis to check the health of a service at a regular interval.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL