Islandora-Devops / isle-buildkit

Provides a number of Docker images which can be used to build an Islandora site. See also https://github.com/Islandora-Devops/isle-dc
https://www.islandora.ca/
MIT License
13 stars 23 forks source link

Have docker nginx logs print the client IP #328

Closed joecorall closed 6 months ago

joecorall commented 6 months ago

Use realip nginx module to have docker logs print the client IP in its logs rather than the traefik private IP.

I made this code change in the GitHub Cloud IDE and inadvertently committed to the main branch: https://github.com/Islandora-Devops/isle-buildkit/commit/78ab2d57c80bf2e200d66d539323bf766629da45 which I then reverted https://github.com/Islandora-Devops/isle-buildkit/commit/95ecba31b77c011e36afe8358b64e492332f9d7d (and canceled the GitHub Actions). Should we prevent direct pushes to main in this repo without a PR? When I clicked the "Commit" button in the GitHub IDE I thought it was going to prompt me to enter a branch name is how I made the mistake.

Before

$ docker compose logs drupal-prod --tail 5

172.24.0.15 - - [14/Mar/2024:13:57:56 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" "1.2.3.4"
172.24.0.15 - - [14/Mar/2024:14:11:44 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15" "4.3.2.1"
172.24.0.15 - - [14/Mar/2024:14:13:21 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "13.4.5.6"
172.24.0.15 - - [14/Mar/2024:14:26:24 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "1.2.3.5"
172.24.0.15 - - [14/Mar/2024:14:32:29 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "7.8.9.9"

After

$ docker compose logs drupal-prod --tail 5

1.2.3.4 - - [14/Mar/2024:13:57:56 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" "1.2.3.4"
4.3.2.1 - - [14/Mar/2024:14:11:44 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15" "4.3.2.1"
13.4.5.6 - - [14/Mar/2024:14:13:21 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "13.4.5.6"
1.2.3.5 - - [14/Mar/2024:14:26:24 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "1.2.3.5"
7.8.9.9 - - [14/Mar/2024:14:32:29 +0000] "GET / HTTP/1.1" 200 47208 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "7.8.9.9"
nigelgbanks commented 6 months ago

Nice work, especially adding the test!