mapsyncproxy

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

Pritunl logo GCS logo

Simple proxy to synchronize a GCS file with an HAProxy .map file

This small Golang server exposes a route that allows synchronizing a GCS (Google Cloud Storage) file with an HAProxy .map file using the Dataplane API.

Use cases

This proxy can be used for various purposes:

  1. Implement distributed rate limiting across multiple HAProxy instances without the need for an enterprise license.
  2. Apply access rules (allowlisting/denylisting) across all machines in one or more environments.
  3. Ensure the reliable updating of Map files.

Demo

https://github.com/matthisholleville/mapSyncProxy/assets/99146727/b85717b4-f90f-42b2-a7b9-6279caa28f82

Local development

1. Requirements
  • Docker
  • Make
  • Python3
  • Gsutil
  • Go
2. Configuration de HAProxy

To build and run a Docker container with the Dataplane API, execute the following command:

make setup

To verify that the container is running correctly, open a browser and navigate to the following URL: http://127.0.0.1:5555/v2/docs. You should see the Dataplane API documentation.

3. Starting the server

To start the server, execute the following command:

make run

You should see a list of metrics at the following URL: http://localhost:8000/metrics.

4. Pushing the Local File to a GCS Bucket

Before pushing the file to a bucket, ensure that it is accessible from your script execution context. To initiate the file push, execute the following command:

make push
5. Initiating Synchronization

To start synchronization, execute the following command:

make synchronize map_name=rate-limits bucket=$MY_BUCKET_NAME

If everything is successful, you should see the following message:

...
{"status":"synchronization success."}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
gcs

Jump to

Keyboard shortcuts

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