Skip to content

Commit

Permalink
Merge branch 'main' into feature/redis_cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Abel Andrés <[email protected]>
  • Loading branch information
abel296 committed Nov 20, 2023
2 parents 8f3f2f0 + 9b1fa5b commit 5025f50
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 97 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ I really want to make this project better and become super cool 🚀
Two commercial versions have been planned: [PRO and PREMIUM](https://kodebeat.com/goproxycache.html).

The development of the COMMUNITY version will continue, but priority will be given to the [COMMERCIAL versions](https://kodebeat.com/goproxycache.html).
- If you'd like to support this open-source project I'll appreciate any kind of [contribution](https://github.com/sponsors/fabiocicerchia).
- If you'd like to sponsor the commercial version, please [get in touch with me](mail:[email protected]).
- If you'd like to support this open-source project I'll appreciate any kind of [contribution](https://github.com/sponsors/fabiocicerchia).
- If you'd like to sponsor the commercial version, please [get in touch with me](mail:[email protected]).

---

Expand Down
8 changes: 4 additions & 4 deletions bin/build-multiarch.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/bin/bash

mkdir dist 2>&1 > /dev/null || true
mkdir dist > /dev/null 2>&1 || true

package_name=go-proxy-cache
platforms=("freebsd/amd64" "linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64")

export CGO_CFLAGS="-march=native -O3"

for platform in "${platforms[@]}"; do
platform_split=(${platform//\// })
declare -a "platform_split=(${platform//\// })"
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
echo -n "Building $output_name..."
if [ $GOOS = "windows" ]; then
if [ "$GOOS" = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o dist/$output_name main.go
env GOOS="$GOOS" GOARCH="$GOARCH" go build -o dist/$output_name main.go
if [ $? -ne 0 ]; then
echo "An error has occurred! Aborting..."
exit 1
Expand Down
36 changes: 13 additions & 23 deletions docs/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@
## Setup

```console
$ docker build -t fabiocicerchia/go-proxy-cache-test:nginx -f test/full-setup/docker/Dockerfile.nginx test/full-setup
$ docker build -t fabiocicerchia/go-proxy-cache-test:node -f test/full-setup/docker/Dockerfile.node test/full-setup
$ echo "127.0.0.1 testing.local www.testing.local" | sudo tee -a /etc/hosts
$ cd test/full-setup
$ cd certs
$ ./gen-selfsigned-cert.sh
$ ./gen-selfsigned-cert.sh www.w3.org
$ cd ..
$ docker-compose up
docker build -t fabiocicerchia/go-proxy-cache-test:nginx -f test/full-setup/docker/Dockerfile.nginx test/full-setup
docker build -t fabiocicerchia/go-proxy-cache-test:node -f test/full-setup/docker/Dockerfile.node test/full-setup
echo "127.0.0.1 testing.local www.testing.local" | sudo tee -a /etc/hosts
cd test/full-setup/certs
./gen-selfsigned-cert.sh
./gen-selfsigned-cert.sh www.w3.org
cd ..
docker-compose up
```

## Tracing

Jaeger is available by using the `test/full-setup` demo and browsing to `http://127.0.0.1:16686/`.
Jaeger is available by using the `test/full-setup` demo and browsing to http://127.0.0.1:16686/.

Prometheus endpoint is available at `http://127.0.0.1:52021/metrics`, it could be queried via `http://127.0.0.1:9090`.
Its metrics are collected and available via Grafana at `http://localhost:3001`.
Prometheus endpoint is available at http://127.0.0.1:52021/metrics, it could be queried via http://127.0.0.1:9090.
Its metrics are collected and available via Grafana at http://localhost:3001.

There is a JSON export of the dashboard stored in `test/full-setup/grafana/gpc-dashboard.json`.

![GPC Grafana Dashboard](grafana.png)

Note: the Data Source must be configured in Grafana to point to `http://prometheus:9090`.
Note: the Data Source must be configured in Grafana to point to http://prometheus:9090.

## Logging

Expand All @@ -44,24 +43,15 @@ In case of testing Sentry, follow this steps:
- `docker run --network full-setup_default -it --rm -e SENTRY_REDIS_HOST=redis -e SENTRY_POSTGRES_HOST=postgres -e SENTRY_SECRET_KEY=$SENTRY_SECRET_KEY -e SENTRY_DB_USER=sentry -e SENTRY_DB_PASSWORD=secret --link full-setup_postgres_1:postgres --link full-setup_redis_1:redis sentry run worker`
- Configure new accounts in the [admin panel](http://127.0.0.1:9000/).
- Retrieve the Sentry DSN [here](http://127.0.0.1:9000/sentry/internal/getting-started/).
- Replace `127.0.0.1:9000` with `sentry:9000`.
- Change the setting `sentry_dsn` in the `config.yml` file.
- Stop docker-compose and start again.

## Test

**NOTE:** In order to have a fully working environment you need to put in the host file `127.0.0.1 nginx`.

```console
$ make test
[...]
$ cd test/full-setup && node ws_client.js
launched plain
launched secure
Sending plain message
Server received from client: {}
Sending secure message
Server received from client: {}
^C
```

## Monitor file descriptors
Expand Down
16 changes: 8 additions & 8 deletions docs/HTTP2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
The functionality is deprecated since not really supported in the browsers.

More details:
- [Current implementation](https://www.w3.org/TR/preload/)
- [What it was supposed to be like](https://medium.com/@mena.meseha/http-2-server-push-tutorial-d8714154ef9a)
- HTTP/2 Push is dead:
- [Chrome to remove HTTP/2 Push](https://www.ctrl.blog/entry/http2-push-chromium-deprecation.html)
- [Google Developers intent to remove HTTP/2 Push](https://community.cloudflare.com/t/google-developers-intent-to-remove-http-2-push/261338)
- [Intent to Remove: HTTP/2 and gQUIC server push](https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ)
- [HTTP/2 Push is dead](https://evertpot.com/http-2-push-is-dead/)
- Alternative: [103 Early Hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103)
- [Current implementation](https://www.w3.org/TR/preload/)
- [What it was supposed to be like](https://medium.com/@mena.meseha/http-2-server-push-tutorial-d8714154ef9a)
- HTTP/2 Push is dead:
- [Chrome to remove HTTP/2 Push](https://www.ctrl.blog/entry/http2-push-chromium-deprecation.html)
- [Google Developers intent to remove HTTP/2 Push](https://community.cloudflare.com/t/google-developers-intent-to-remove-http-2-push/261338)
- [Intent to Remove: HTTP/2 and gQUIC server push](https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ)
- [HTTP/2 Push is dead](https://evertpot.com/http-2-push-is-dead/)
- Alternative: [103 Early Hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103)

### Upstream

Expand Down
3 changes: 2 additions & 1 deletion docs/examples/cache/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ kind: Kustomization
resources:
- configmap.yaml
- deployment.yaml
- service.yaml
- service.yaml

3 changes: 2 additions & 1 deletion docs/examples/proxy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ kind: Kustomization
resources:
- configmap.yaml
- deployment.yaml
- service.yaml
- service.yaml

Binary file modified docs/grafana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 25 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ require (
github.com/go-http-utils/fresh v0.0.0-20161124030543-7231e26a4b27
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a
github.com/go-redis/redis/v8 v8.11.5
github.com/go-redsync/redsync/v4 v4.7.1
github.com/go-redsync/redsync/v4 v4.10.0
github.com/gorilla/websocket v1.5.0
github.com/jinzhu/copier v0.3.5
github.com/jinzhu/copier v0.4.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417
github.com/rs/xid v1.4.0
github.com/sirupsen/logrus v1.9.0
github.com/prometheus/client_golang v1.17.0
github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529
github.com/rs/xid v1.5.0
github.com/sirupsen/logrus v1.9.3
github.com/sony/gobreaker v0.5.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/ugorji/go/codec v1.2.8
github.com/ugorji/go/codec v1.2.11
github.com/yhat/wsutil v0.0.0-20170731153501-1d66fa95c997
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0
go.opentelemetry.io/otel v1.11.2
golang.org/x/crypto v0.5.0
golang.org/x/net v0.5.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0
go.opentelemetry.io/otel v1.19.0
golang.org/x/crypto v0.14.0
golang.org/x/net v0.10.0
gopkg.in/yaml.v2 v2.4.0
)

Expand All @@ -38,24 +38,25 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/getsentry/raven-go v0.2.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.opentelemetry.io/otel/metric v0.34.0 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 5025f50

Please sign in to comment.