From 4fdb8f63c9d3833e487dd005b8351b5951bea857 Mon Sep 17 00:00:00 2001 From: Umputun Date: Fri, 16 Apr 2021 14:04:54 -0500 Subject: [PATCH] fix site build --- site/Dockerfile => Dockerfile.site | 6 ++++-- Makefile | 6 +++++- site/public/index.html | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) rename site/Dockerfile => Dockerfile.site (58%) diff --git a/site/Dockerfile b/Dockerfile.site similarity index 58% rename from site/Dockerfile rename to Dockerfile.site index 7df8dfc..8b82dc5 100644 --- a/site/Dockerfile +++ b/Dockerfile.site @@ -2,10 +2,12 @@ FROM node:14-alpine WORKDIR build -COPY . /build +COPY site/ /build +COPY README.md /build/src/index.md + RUN yarn --frozen-lockfile && \ yarn build && \ - ls -la /public + ls -la /build/public CMD ["sleep", "100"] diff --git a/Makefile b/Makefile index 28ffc0b..d7567dd 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,11 @@ build: info - cd app && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.revision=$(REV) -s -w" -o ../dist/reproxy build_site: - - cd site && yarn build + @rm -f site/public/* + docker build -f Dockerfile.site -t reproxy.site . + docker run -d --name=reproxy.site reproxy.site + docker cp reproxy.site:/build/public site/ + docker rm -f reproxy.site info: - @echo "revision $(REV)" diff --git a/site/public/index.html b/site/public/index.html index 9dc06da..b656762 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -1,4 +1,4 @@ -Reproxy

Reproxy is a simple edge HTTP(s) server / reverse proxy supporting various providers (docker, static, file).
One or more providers supply information about requested server, requested url, destination url and health check url.
Distributed as a single binary or as a docker container.

  • Automatic SSL termination with Let's Encrypt
  • Support of user-provided SSL certificates
  • Simple but flexible proxy rules
  • Static, command line proxy rules provider
  • Dynamic, file-based proxy rules provider
  • Docker provider with an automatic discovery
  • Optional traffic compression
  • User-defined limits and timeouts
  • Single binary distribution
  • Docker container distribution
  • Built-in static assets server

build Coverage Status Go Report Card Docker Automated build

Server can be set as FQDN, i.e. s.example.com or * (catch all). Requested url can be regex, for example ^/api/(.*) and destination url may have regex matched groups in, i.e. http://d.example.com:8080/$1. For the example above http://s.example.com/api/something?foo=bar will be proxied to http://d.example.com:8080/something?foo=bar.

For convenience, requests with the trailing / and without regex groups expanded to /(.*), and destinations in those cases expanded to /$1. I.e. /api/ -> http://127.0.0.1/service will be translated to ^/api/(.*) -> http://127.0.0.1/service/$1

Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates.
Optional assets server can be used to serve static files.

Starting reproxy requires at least one provider defined. The rest of parameters are strictly optional and have sane default.

Example with a static provider:
reproxy --static.enabled --static.rule="example.com/api/(.*),https://api.example.com/$1"
Example with an automatic docker discovery:
reproxy --docker.enabled --docker.auto

Install

Latest stable version has :vX.Y.Z tag (with :latest alias) and the current master has :master tag.

Providers

User can sets multiple providers at the same time.
See examples of various providers in examples

Static

This is the simplest provider defining all mapping rules directly in the command line (or environment). Multiple rules supported.
Each rule is 3 or 4 comma-separated elements server,sourceurl,destination,[ping-url]. For example:

  • *,^/api/(.*),https://api.example.com/$1, - proxy all request to any host/server with /api prefix to https://api.example.com
  • example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping - proxy all requests to example.com and with /foo/bar url to https://api.example.com/zzz. Uses https://api.example.com/ping for the health check

The last (4th) element defines an optional ping url used for health reporting. I.e.*,^/api/(.*),https://api.example.com/$1,https://api.example.com/ping. See Health check section for more details.

File

reproxy --file.enabled --file.name=config.yml

Example of config.yml:

default: # the same as * (catch-all) server
+Reproxy

Reproxy is a simple edge HTTP(s) server / reverse proxy supporting various providers (docker, static, file).
One or more providers supply information about requested server, requested url, destination url and health check url.
Distributed as a single binary or as a docker container.

  • Automatic SSL termination with Let's Encrypt
  • Support of user-provided SSL certificates
  • Simple but flexible proxy rules
  • Static, command line proxy rules provider
  • Dynamic, file-based proxy rules provider
  • Docker provider with an automatic discovery
  • Optional traffic compression
  • User-defined limits and timeouts
  • Single binary distribution
  • Docker container distribution
  • Built-in static assets server

build Coverage Status Go Report Card Docker Automated build

Server can be set as FQDN, i.e. s.example.com or * (catch all). Requested url can be regex, for example ^/api/(.*) and destination url may have regex matched groups in, i.e. http://d.example.com:8080/$1. For the example above http://s.example.com/api/something?foo=bar will be proxied to http://d.example.com:8080/something?foo=bar.

For convenience, requests with the trailing / and without regex groups expanded to /(.*), and destinations in those cases expanded to /$1. I.e. /api/ -> http://127.0.0.1/service will be translated to ^/api/(.*) -> http://127.0.0.1/service/$1

Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates.
Optional assets server can be used to serve static files.

Starting reproxy requires at least one provider defined. The rest of parameters are strictly optional and have sane default.

Example with a static provider:
reproxy --static.enabled --static.rule="example.com/api/(.*),https://api.example.com/$1"
Example with an automatic docker discovery:
reproxy --docker.enabled --docker.auto

Install

Latest stable version has :vX.Y.Z tag (with :latest alias) and the current master has :master tag.

Providers

User can sets multiple providers at the same time.
See examples of various providers in examples

Static

This is the simplest provider defining all mapping rules directly in the command line (or environment). Multiple rules supported.
Each rule is 3 or 4 comma-separated elements server,sourceurl,destination,[ping-url]. For example:

  • *,^/api/(.*),https://api.example.com/$1, - proxy all request to any host/server with /api prefix to https://api.example.com
  • example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping - proxy all requests to example.com and with /foo/bar url to https://api.example.com/zzz. Uses https://api.example.com/ping for the health check

The last (4th) element defines an optional ping url used for health reporting. I.e.*,^/api/(.*),https://api.example.com/$1,https://api.example.com/ping. See Health check section for more details.

File

reproxy --file.enabled --file.name=config.yml

Example of config.yml:

default: # the same as * (catch-all) server
   - { route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/blah1/$1" }
   - {
       route: "/api/svc3/xyz",
@@ -67,7 +67,7 @@ timeout:
 Help Options:
   -h, --help                        Show this help message
 
-

Status

The project is under active development and may have breaking changes till v1 released.

Updated  Edit