I used OpenResty to create a reverse proxy to try various authentication methods.
- openresty/openresty:1.21.4.1-0-bullseye-fat
- redis:8.0-M02-bookworm
- install VSCode, Docker
- install VSCode Extensions Dev ContainerS
- On the VSCode,
Ctrl shift p
and runDev Containers: Rebuild Containers
docker compose up -d
On the VSCode, Ctrl shift p
and run Dev Containers: Rebuild Containers
In the Dev Containers, OpenResty is not started using the CMD
directive in the Dcokerfile. Because, to restart OpenResty, it would require rebuilding the container. It takes a lot of times.
Note
Since OpenResty is running as a persistent process to keep the container running, stopping openresty will stop the container.
Instead, I set here in the devcontainer.json.
"overrideCommand": true,
"postStartCommand": "openresty",
This allows for restarting openresty using shell command, as overrideCommand
is used for the container's persistent process.
openresty -s reload
Note
-
Sometime,
openresty -s reload
not work well, thenopenresty -s stop
and restartopenresty
. -
If use
postCreateCommand
instead ofPostStartCommand
, the following error occures.nginx: [alert] could not open error log file: open() "/usr/local/openresty/logs/error.log" failed (2: No such file or directory) 2025/01/08 00:55:23 [emerg] 1630#1630: open() "/usr/local/openresty/conf/nginx.conf" failed (2: No such file or directory)
Note
access.log, error.log are redirected to stdout.
ls -l /usr/local/openresty/nginx/logs/access.log
lrwxrwxrwx 1 root root 11 May 25 2022 /usr/local/openresty/nginx/logs/access.log -> /dev/stdout
So, the easiest way is docker logs
# access.log, error.log
docker compose logs reverse_proxy_app
# eventlogs
cat /usr/local/openresty/nginx/logs/error.log