Add autoreload option

This commit is contained in:
fredbcode 2021-11-22 10:36:44 +01:00
parent b489568c82
commit d8db01fb40
5 changed files with 77 additions and 2 deletions

View File

@ -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:**

14
autoreload.sh Normal file
View File

@ -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

View File

@ -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:

View File

@ -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:
#

View File

@ -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