Skip to content

Commit

Permalink
feat(multi): beego, nutsdb, fixes (#220)
Browse files Browse the repository at this point in the history
* feat(plugins): Introduce beego as supported plugin

* feat(provider): Introduce nutsdb storage

* Fix race issue

* Setup the traefik docker image build on tagged version

* Fix tests/lint

* Setup key generation override

* Fix Tyk & bump golangci-lint

* Fix tests, bump olric to the latest version

* Update tests

* Set the coalescing storage in the usagepool in caddy to handle the configuration reload that cause memory leak

* Bump to v1.6.9

* Setup manual docker deploy
  • Loading branch information
darkweak authored Jun 16, 2022
1 parent b99e358 commit 602a4e1
Show file tree
Hide file tree
Showing 274 changed files with 20,796 additions and 963 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/non-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ jobs:
go-version: 1.16
- name: Build the stack
run: docker network create your_network || true
- name: Prepare the stack
run: cp Dockerfile-dev Dockerfile && cp docker-compose.yml.test docker-compose.yml
- name: Build the stack
run: docker-compose up -d --build --force-recreate --remove-orphans
run: docker-compose -f docker-compose.yml.test up -d --build --force-recreate --remove-orphans
- name: Test
run: docker-compose exec -T souin go test -v ./...
run: docker-compose -f docker-compose.yml.test exec -T souin go test -v -race ./...
validate-prod-container-building:
needs: checkout-code-and-validate
name: Validate that the container build for prod
Expand All @@ -47,12 +45,9 @@ jobs:
-
name: Build the stack
run: docker network create your_network || true
-
name: Prepare the stack
run: cp Dockerfile-prod Dockerfile && cp docker-compose.yml.prod docker-compose.yml
-
name: Build the stack
run: docker-compose up -d --build --force-recreate --remove-orphans
run: docker-compose -f docker-compose.yml.prod up -d --build --force-recreate --remove-orphans
-
name: Souin container healthceck
run: docker-compose exec -T souin ls
run: docker-compose -f docker-compose.yml.prod exec -T souin ls
44 changes: 43 additions & 1 deletion .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@ on:
- pull_request

jobs:
build-beego-validator:
name: Check that Souin build as Beego middleware
runs-on: ubuntu-latest
steps:
-
name: Add domain.com host to /etc/hosts
run: |
sudo echo "127.0.0.1 domain.com" | sudo tee -a /etc/hosts
-
name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Checkout code
uses: actions/checkout@v2
-
name: Build Souin as Beego plugin
run: make build-and-run-beego
-
name: Wait for Souin is really loaded inside Beego as middleware
uses: jakejarvis/wait-action@master
with:
time: 25s
-
name: Set Beego logs configuration result as environment variable
run: cd plugins/beego/examples && echo "BEEGO_MIDDLEWARE_RESULT=$(docker-compose logs beego | grep Souin)" >> $GITHUB_ENV
-
name: Check if the configuration is loaded to define if Souin is loaded too
uses: nick-invision/assert-action@v1
with:
expected: '"message":"Souin configuration is now loaded."'
actual: ${{ env.BEEGO_MIDDLEWARE_RESULT }}
comparison: contains
-
name: Run Beego E2E tests
uses: anthonyvscode/newman-action@v1
with:
collection: "docs/e2e/Souin E2E.postman_collection.json"
folder: Beego
reporters: cli
delayRequest: 5000
build-caddy-validator:
name: Check that Souin build as caddy module
runs-on: ubuntu-latest
Expand Down Expand Up @@ -455,7 +497,7 @@ jobs:
name: Check if the configuration is loaded to define if Souin is loaded too
uses: nick-invision/assert-action@v1
with:
expected: '"middlewares\":{\"souin\":{\"plugin\":{\"souin-plugin'
expected: '"middlewares\":{\"souin\":{\"plugin\":{\"souin'
actual: ${{ env.TRAEFIK_MIDDLEWARE_RESULT }}
comparison: contains
-
Expand Down
47 changes: 38 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,63 @@ on:
tags: ["v*"]

jobs:
generate-binary:
name: Generate binary
generate-souin-traefik-docker:
name: Generate embedded Souin as traefik middleware
runs-on: ubuntu-latest
steps:
-
name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
fetch-depth: 0
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build & push Docker image containing only binary
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
file: ./plugins/traefik/Dockerfile.deploy
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: darkweak/souin-traefik:${{ env.RELEASE_VERSION }}
generate-souin-docker:
name: Generate souin docker
runs-on: ubuntu-latest
steps:
-
name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Checkout code
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build & push Docker image containing only binary
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
push: true
file: ./Dockerfile-prod
Expand All @@ -41,7 +70,7 @@ jobs:
darkweak/souin:latest
darkweak/souin:${{ env.RELEASE_VERSION }}
generate-artifacts:
name: Generate cross-platform builds
name: Deploy to goreleaser
runs-on: ubuntu-latest
steps:
-
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
DC=docker-compose
DC_BUILD=$(DC) build
DC_EXEC=$(DC) exec
PLUGINS_LIST=caddy chi dotweb echo fiber skipper gin go-zero goyave traefik tyk webgo
PLUGINS_LIST=beego caddy chi dotweb echo fiber skipper gin go-zero goyave traefik tyk webgo

base-build-and-run-%:
cd plugins/$* && $(MAKE) prepare

build-and-run-beego: base-build-and-run-beego ## Run Beego with Souin as plugin

build-and-run-caddy: ## Run caddy binary with the Caddyfile configuration
$(MAKE) build-caddy
cd plugins/caddy && ./caddy run
Expand All @@ -33,7 +35,7 @@ build-and-run-souin: base-build-and-run-souin ## Run Souin as plugin

build-and-run-gin: base-build-and-run-gin ## Run Gin with Souin as plugin

build-and-run-go-zero: base-build-and-run-go-zero ## Run Gin with Souin as plugin
build-and-run-go-zero: base-build-and-run-go-zero ## Run Go-zero with Souin as plugin

build-and-run-goyave: base-build-and-run-goyave ## Run Goyave with Souin as plugin

Expand Down Expand Up @@ -88,7 +90,7 @@ generate-plantUML: ## Generate plantUML diagrams
cd ./docs/plantUML && sh generate.sh && cd ../..

golangci-lint: ## Run golangci-lint to ensure the code quality
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.42.0 golangci-lint run -v
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.46.2 golangci-lint run -v

health-check-prod: build-app ## Production container health check
$(DC_EXEC) souin ls
Expand Down
Loading

0 comments on commit 602a4e1

Please sign in to comment.