WIP: feat: adds iocaine config #114

Draft
devydave wants to merge 2 commits from devydave/traefik:feature/iocaine into master
7 changed files with 76 additions and 4 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
export TRAEFIK_YML_VERSION=v31
export FILE_PROVIDER_YML_VERSION=v12
export ENTRYPOINT_VERSION=v5
export TRAEFIK_YML_VERSION=v32
export FILE_PROVIDER_YML_VERSION=v13
export ENTRYPOINT_VERSION=v7
export IOCAINE_ENTRYPOINT_VERSION=v1
+25
View File
@@ -0,0 +1,25 @@
---
version: "3.8"
services:
app:
environment:
IOCAINE_ENABLE: "1"
IOCAINE_PLUGIN_VERSION: "v1.2.0"
volumes:
- "plugins-local:/plugins-local"
iocaine:
image: "git.madhouse-project.org/iocaine/iocaine:3.5.0"
environment:
RUST_LOG: "iocaine=info"
ports:
- target: 42069
Review

@decentral1se at this point I want to use the host_ip:127.0.0.1 property to prevent the public port
https://docs.docker.com/reference/compose-file/services/#ports

@decentral1se at this point I want to use the `host_ip:127.0.0.1` property to prevent the public port https://docs.docker.com/reference/compose-file/services/#ports
Review

As it turns out, it seems like toolshed/abra#816 is required because otherwise, we end up in a linting failure which is due to vendor/github.com/docker/cli/opts/swarmopts/port.go does not support it.

As it turns out, it seems like https://git.coopcloud.tech/toolshed/abra/pulls/816 is required because otherwise, we end up in a linting failure which is due to `vendor/github.com/docker/cli/opts/swarmopts/port.go` does not support it.
published: 42069
protocol: tcp
mode: host
networks:
- proxy
volumes:
plugins-local:
+7
View File
@@ -27,6 +27,9 @@ services:
- source: entrypoint
target: /custom-entrypoint.sh
mode: 0555
- source: iocaine_entrypoint
target: /entrypoint.iocaine.sh
mode: 0555
networks:
- proxy
- internal
@@ -115,6 +118,10 @@ configs:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
iocaine_entrypoint:
name: ${STACK_NAME}_entrypoint_${IOCAINE_ENTRYPOINT_VERSION}
file: entrypoint.iocaine.sh.tmpl
template_driver: golang
volumes:
letsencrypt:
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -e
apk --no-cache add git go
iocaine_path="/plugins-local/src/git.mstar.dev/mstar/traefik-iocaine-middleware"
if [ ! -d "$iocaine_path" ]; then
git clone --depth 1 --branch $IOCAINE_PLUGIN_VERSION https://git.mstar.dev/mstar/traefik-iocaine-middleware.git $iocaine_path
else
git -C $iocaine_path fetch origin 'refs/tags/*:refs/tags/*'
git -C $iocaine_path checkout tags/$IOCAINE_PLUGIN_VERSION
fi
(cd $iocaine_path && go mod vendor)
exit 0
+4
View File
@@ -15,4 +15,8 @@ export DO_AUTH_TOKEN=$(cat "$DO_AUTH_TOKEN_FILE")
export AZURE_CLIENT_SECRET=$(cat "$AZURE_CLIENT_SECRET_FILE")
{{ end }}
{{ if eq (env "IOCAINE_ENABLE") "1" }}
Review

This seems a bit involved.... would it perhaps be an idea to throw it into it's own entrypoint.iocaine.sh.tmpl? Then you call the default entrypoint and then run this one with some additional logging to signal what is going on? Might be unecessary but see what you think. If other plugins get implemented, it might be nice to start with this "separated" pattern.

This seems a bit involved.... would it perhaps be an idea to throw it into it's own `entrypoint.iocaine.sh.tmpl`? Then you call the default entrypoint and then run this one with some additional logging to signal what is going on? Might be unecessary but see what you think. If other plugins get implemented, it might be nice to start with this "separated" pattern.
Review

sounds good to me and the entrypoint.iocaine.sh is called instead of the current code block?
I will take a look tomorrow.

sounds good to me and the entrypoint.iocaine.sh is called instead of the current code block? I will take a look tomorrow.
/entrypoint.iocaine.sh
{{ end }}
/entrypoint.sh "$@"
+10 -1
View File
@@ -17,6 +17,15 @@ http:
authResponseHeaders:
- X-Forwarded-User
{{ end }}
{{ if eq (env "IOCAINE_ENABLE") "1" }}
iocaine:
plugin:
iocaine:
iocaineHttpUrl: "http://iocaine:42069"
methods:
- GET
- HEAD
{{ end }}
{{ if eq (env "BASIC_AUTH") "1" }}
basicauth:
basicAuth:
@@ -61,4 +70,4 @@ tls:
certificates:
- certFile: /run/secrets/ssl_cert
keyFile: /run/secrets/ssl_key
{{ end }}
{{ end }}
+11
View File
@@ -42,6 +42,10 @@ entrypoints:
allowEncodedPercent: true
allowEncodedQuestionMark: true
allowEncodedHash: true
{{- if eq (env "IOCAINE_ENABLE") "1" }}
middlewares:
- iocaine@file
{{- end }}
{{- if eq (env "GITEA_SSH_ENABLED") "1" }}
gitea-ssh:
address: ":2222"
@@ -153,3 +157,10 @@ certificatesResolvers:
- "1.1.1.1:53"
- "9.9.9.9:53"
{{- end }}
{{ if eq (env "IOCAINE_ENABLE") "1" }}
experimental:
localPlugins:
iocaine:
moduleName: git.mstar.dev/mstar/traefik-iocaine-middleware
{{ end }}