[DEV] Debug authelia when running a suite. (#1060)

* [DEV] Debug authelia when running a suite.

This runs dlv debugger within authelia backend container so that an IDE can remote
debug the application using port 2345.

* Apply suggestions from code review

Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
pull/1062/head^2
Clément Michaud 2020-06-01 08:50:55 +02:00 committed by GitHub
parent 7dc79b2ac4
commit eec6424bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

4
.gitignore vendored
View File

@ -43,4 +43,6 @@ Configuration.schema.json
qemu-*-static qemu-*-static
public_html.gen.go public_html.gen.go
__debug_bin

View File

@ -7,8 +7,13 @@ services:
args: args:
USER_ID: ${USER_ID} USER_ID: ${USER_ID}
GROUP_ID: ${GROUP_ID} GROUP_ID: ${GROUP_ID}
security_opt:
- seccomp:unconfined
- apparmor:unconfined
command: /resources/entrypoint-backend.sh command: /resources/entrypoint-backend.sh
working_dir: /app working_dir: /app
cap_add:
- SYS_PTRACE
volumes: volumes:
- './example/compose/authelia/resources/:/resources' - './example/compose/authelia/resources/:/resources'
- '../..:/app' - '../..:/app'

View File

@ -2,8 +2,14 @@
set -x set -x
# We move out of the workspace to not include the modules as dependencies of the project.
cd /
echo "Use hot reloaded version of Authelia backend" echo "Use hot reloaded version of Authelia backend"
go get github.com/cespare/reflex go get github.com/cespare/reflex
go get github.com/go-delve/delve/cmd/dlv
cd /app
# Sleep 10 seconds to wait the end of npm install updating web directory # Sleep 10 seconds to wait the end of npm install updating web directory
# and making reflex reload multiple times. # and making reflex reload multiple times.

View File

@ -2,10 +2,8 @@
set -e set -e
# Build the binary
go build -o /tmp/authelia/authelia-tmp cmd/authelia/*.go
while true; while true;
do do
/tmp/authelia/authelia-tmp --config /etc/authelia/configuration.yml dlv --listen 0.0.0.0:2345 --headless=true --continue --accept-multiclient debug cmd/authelia/*.go -- --config /etc/authelia/configuration.yml
sleep 10 sleep 10
done done