Skip to content

Commit

Permalink
feat(plugins): add Caddy reverse proxy integration
Browse files Browse the repository at this point in the history
  • Loading branch information
acouvreur committed Apr 2, 2023
1 parent 5e85cdb commit 60b5097
Show file tree
Hide file tree
Showing 29 changed files with 3,042 additions and 31 deletions.
71 changes: 69 additions & 2 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
strategy:
fail-fast: false
matrix:
provider: [docker_classic, docker_swarm, kubernetes]
provider: [docker, docker_swarm] # , kubernetes]
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v2
Expand All @@ -115,4 +115,71 @@ jobs:
run: docker load --input /tmp/sablier.tar

- name: Test ${{ matrix.provider }}
run: cd plugins/nginx/e2e && bash ./${{ matrix.provider }}.sh
run: cd plugins/nginx/e2e && bash ./${{ matrix.provider }}.sh

build-caddy:
name: Build Caddy docker image once and share it to Caddy E2E jobs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v2
with:
context: plugins/caddy
file: plugins/caddy/Dockerfile
tags: caddy:local
outputs: type=docker,dest=/tmp/caddy.tar

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: caddy-image-tar
path: /tmp/caddy.tar

caddy_e2e:
name: Run Sablier E2E tests for Caddy middleware
runs-on: ubuntu-latest
needs:
- build
- build-caddy
strategy:
fail-fast: false
matrix:
provider: [docker, docker_swarm] # , kubernetes]
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Download artifact
uses: actions/download-artifact@v2
with:
name: sablier-image-tar
path: /tmp

- name: Load Docker image
run: docker load --input /tmp/sablier.tar

- name: Download Caddy artifact
uses: actions/download-artifact@v2
with:
name: caddy-image-tar
path: /tmp

- name: Load Caddy Docker image
run: docker load --input /tmp/caddy.tar

- name: Test ${{ matrix.provider }}
run: cd plugins/caddy/e2e && bash ./${{ matrix.provider }}.sh
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ update-doc-version:

update-doc-version-middleware:
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/version: "v$(LAST)"/version: "v$(NEXT)"/g' {} +
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/version=v$(LAST)/version=v$(NEXT)/g' {} +
find . -type f \( -name "*.md" -o -name "*.yml" \) -exec sed -i 's/version=v$(LAST)/version=v$(NEXT)/g' {} +
sed -i 's/SABLIER_VERSION=v$(LAST)/SABLIER_VERSION=v$(NEXT)/g' plugins/caddy/Dockerfile.remote
sed -i 's/v$(LAST)/v$(NEXT)/g' plugins/caddy/README.md
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Which allows you to start your containers on demand and shut them down automatic
- [Sablier](#sablier)
- [Quick start with Traefik](#quick-start-with-traefik)
- [Reverse proxies integration plugins](#reverse-proxies-integration-plugins)
- [Traefik](#traefik)
- [Nginx](#nginx)
- [Guides](#guides)
- [Sablier Guide: Code-Server + Traefik + Kubernetes Ingress](#sablier-guide-code-server--traefik--kubernetes-ingress)
- [Configuration](#configuration)
Expand Down Expand Up @@ -86,24 +84,11 @@ It leverage the API calls to Sablier to your reverse proxy middleware to wake up

![Reverse Proxy Integration](./docs/img/reverse-proxy-integration.png)

| Reverse Proxy | Docker | Docker Swarm mode | Kubernetes | Podman |
| ------------- | :-------------------------------------------------------: | :---------------: | :-----------: | :-------------------------------------------------------: |
| Traefik |||*(partial)* | [See #70](https://github.com/acouvreur/sablier/issues/70) |
| Nginx ||||
| Apache | *Coming soon* |
| Caddy | [See #67](https://github.com/acouvreur/sablier/issues/67) |

### Traefik

See [Traefik Middleware Plugin](https://github.com/acouvreur/sablier/tree/main/plugins/traefik/README.md)

- [Traefik Middleware Plugin with Docker classic](https://github.com/acouvreur/sablier/tree/main/plugins/traefik/README.md#traefik-with-docker-classic)
- [Traefik Middleware Plugin with Docker Swarm](https://github.com/acouvreur/sablier/tree/main/plugins/traefik/README.md#traefik-with-docker-swarm)
- [Traefik Middleware Plugin with Kubernetes](https://github.com/acouvreur/sablier/tree/main/plugins/traefik/README.md#traefik-with-kubernetes)

### Nginx

See [Nginx Middleware Plugin](/plugins/nginx/README.md)
| Reverse Proxy | Docker | Docker Swarm mode | Kubernetes | Podman |
| ----------------------------- | :-----------: | :---------------: | :-----------: | :-------------------------------------------------------: |
| [Traefik](./plugins/traefik/) |||*(partial)* | [See #70](https://github.com/acouvreur/sablier/issues/70) |
| [Nginx](./plugins/nginx/) ||||
| [Caddy](./plugins/caddy/) ||||


## Guides
Expand Down
7 changes: 0 additions & 7 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ func Test_Multiple(t *testing.T) {
func Test_Healthy(t *testing.T) {
e := httpexpect.New(t, "http://localhost:8080/healthy/")

e.GET("/nginx").
Expect().
Status(http.StatusOK).
Body().
Contains(`Healthy Nginx`).
Contains(`Your instance(s) will stop after 1 minutes of inactivity`)

e.GET("/nginx").
Expect().
Status(http.StatusOK).
Expand Down
1 change: 1 addition & 0 deletions go.work
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ go 1.19
use (
.
./plugins/traefik
./plugins/caddy
)
Loading

0 comments on commit 60b5097

Please sign in to comment.