From d8db01fb4087d345245a917feadcd58454f5db07 Mon Sep 17 00:00:00 2001 From: fredbcode Date: Mon, 22 Nov 2021 10:36:44 +0100 Subject: [PATCH] Add autoreload option --- README.md | 4 ++-- autoreload.sh | 14 +++++++++++++ docker-compose/docker-compose.yml | 33 +++++++++++++++++++++++++++++++ docker-compose/squid/squid.conf | 13 ++++++++++++ gitlabci/docker-hub.yml | 15 ++++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 autoreload.sh diff --git a/README.md b/README.md index 6f728e9..245b7b2 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ For the cache to preserve its state should mount a volume /var/spool/squid as vo # If a file is changed/delete/created squid reload - autoreload=/etc/squid -**docker-compose** +**Docker-compose** https://gitlab.com/fredbcode/docker-compose **Supported architectures:** -- adm64, armv8 +- amd64, armv8 **Where to file issues:** diff --git a/autoreload.sh b/autoreload.sh new file mode 100644 index 0000000..d653a70 --- /dev/null +++ b/autoreload.sh @@ -0,0 +1,14 @@ +#!/bin/bash +horodate=$(date +%d-%m-%Y_%H_%M) +if [ -d $autoreload ] && [ ! -z "$autoreload" ]; +then + while inotifywait -e modify,delete,create -r $autoreload --exclude \.swp + do + # wait all modifications + sleep 10 + horodate=$(date +%d-%m-%Y_%H_%M) + squid -k reconfigure + echo "RELOAD SQUID $horodate: new files" >> /var/log/squid/reloadsquid.log + sleep 60 + done +fi diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index d9c8b9f..ccf1384 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -19,5 +19,38 @@ services: max-file: "3" volumes: - cache:/var/spool/squid + networks: + - webfilter + + e2guardian: + image: fredbcode/e2guardian:v5.4 + environment: + - TZ=Europe/Paris + healthcheck: + disable: true + volumes: + - ./e2guardian/:/etc/e2guardian:ro + labels: + deck-chores.e2guardianrestart.command: sh -c '/usr/sbin/e2guardian -q' + deck-chores.e2guardianrestart.cron: "* * * * * 00 00 00" + networks: + - webfilter + + deckchores: + image: funkyfuture/deck-chores:1.1.3 + environment: + - TZ=Europe/Paris + restart: always + volumes: + - "/var/run/docker.sock:/var/run/docker.sock:ro" + restart: unless-stopped + logging: + options: + max-size: "100m" + max-file: "3" + +networks: + webfilter: + volumes: cache: diff --git a/docker-compose/squid/squid.conf b/docker-compose/squid/squid.conf index bab48ec..92a781c 100644 --- a/docker-compose/squid/squid.conf +++ b/docker-compose/squid/squid.conf @@ -26,6 +26,19 @@ acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http +icap_enable on +icap_service service_req reqmod_precache bypass=off icap://e2guardian:1344/request +adaptation_access service_req deny purge +adaptation_access service_req deny manager +adaptation_access service_req allow all +icap_preview_enable off +icap_send_client_ip on +icap_send_client_username on +icap_service_failure_limit 80 in 5 seconds +icap_connect_timeout 60 seconds +icap_io_timeout 120 seconds +icap_service_revival_delay 30 + # # Recommended minimum Access Permission configuration: # diff --git a/gitlabci/docker-hub.yml b/gitlabci/docker-hub.yml index 46fc3f0..c543c36 100644 --- a/gitlabci/docker-hub.yml +++ b/gitlabci/docker-hub.yml @@ -19,6 +19,14 @@ docker-hub-build: - docker build --build-arg SQUID_VERSION=$SQUID_VERSION --pull -t $CONTAINER_BUILD_NOPROD_NAME_AMD64 . - docker push $CONTAINER_BUILD_NOPROD_NAME_AMD64 +.standalone: + image: + name: $CONTAINER_BUILD_NOPROD_NAME_AMD64 + entrypoint: [""] + variables: + GIT_STRATEGY: none + dependencies: [] + .services-amd64: services: - name: $CONTAINER_BUILD_NOPROD_NAME_AMD64 @@ -35,6 +43,13 @@ docker-hub-test: HOSTNAME: squidpipeline needs: ["docker-hub-build"] +SquidParseConfig: + stage: Docker-hub-test + extends: .standalone + script: + - /usr/sbin/squid -k parse /etc/squid/squid.conf + # Stop if error + - "! /usr/sbin/squid -k parse /etc/squid/squid.conf 2>&1 | grep ERROR" dive: image: name: wagoodman/dive:latest