diff --git a/Dockerfile b/Dockerfile index 88425a2..7ca2219 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,7 +48,7 @@ ENV PHP7_SOCK=/var/run/php/php${PHP_VERSION}-fpm.sock ENV PHP_LOG_SYSOUT=true # http-over-all part -ARG RELEASE="1.1.11" +ARG RELEASE="1.1.12" ARG SSL_COUNTRY=DE ARG SSL_STATE=Berlin diff --git a/incontainer/README.md b/incontainer/README.md index 72618e5..3dc0c45 100644 --- a/incontainer/README.md +++ b/incontainer/README.md @@ -201,7 +201,7 @@ Options for all resources | PROXY_MAX_SIZE | maximum size of the proxy cache (default: 10g) | - | | PROXY_INACTIVE | data that are not accessed during the time get removed (default: 1d) | - | | TINY_INSTANCE | configure for low requirements and low memory consumption (default: false) | - | - +| FORCE_UPDATE_LOCK | timeout in seconds for repetitive call (default: 16) | - | # Special functions ## periodic jobs ENV: PERIODIC_JOB_INTERVAL diff --git a/incontainer/healthcheck.sh b/incontainer/healthcheck.sh index 90f4e51..9dfb5a4 100755 --- a/incontainer/healthcheck.sh +++ b/incontainer/healthcheck.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # short name for http-over-all is sds (Software Distribution Server) -if [ ! -f "/tmp/sds.ready" ]; then exit 0; fi +if [ ! -f "/var/run/sds.ready" ]; then exit 0; fi -curl -A "curl/healthcheck" -f http://localhost/ || exit 1 \ No newline at end of file +curl -A "curl/healthcheck" -f http://localhost/ || exit 1 diff --git a/incontainer/helper.sh b/incontainer/helper.sh index c1a03f3..b5fa4dd 100644 --- a/incontainer/helper.sh +++ b/incontainer/helper.sh @@ -105,6 +105,14 @@ function initialize() { echo "sed -i \"s|__CRYPT_KEY__|obfuscated|g\" /scripts/php/include/globals.php" sed -i "s|__CRYPT_KEY__|${CRYPT_KEY}|g" "/scripts/php/include/globals.php" + # handle timeout for force-update operations (default are 16 seconds) + if [ -z "${FORCE_UPDATE_LOCK##*[!0-9]*}" ]; then + echo FORCE_UPDATE_LOCK="16" + FORCE_UPDATE_LOCK="16" + fi + echo "sed -i \"s|'__FORCE_UPDATE_LOCK__'|${FORCE_UPDATE_LOCK}|g\" /scripts/php/include/globals.php" + sed -i "s|'__FORCE_UPDATE_LOCK__'|${FORCE_UPDATE_LOCK}|g" "/scripts/php/include/globals.php" + echo "adjust davfs2 (/etc/davfs2/davfs2.conf)" { echo "ignore_dav_header 1" diff --git a/incontainer/http-over-all.sh b/incontainer/http-over-all.sh index b449120..e121b1b 100755 --- a/incontainer/http-over-all.sh +++ b/incontainer/http-over-all.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -SDS_READY="/tmp/sds.ready" +SDS_READY="/var/run/sds.ready" rm -f ${SDS_READY} source /scripts/connect-services.sh @@ -48,6 +48,9 @@ handle_local_paths connect_or_update_docker "connect" +echo touch /var/run/force-update.last +touch /var/run/force-update.last + start_http_server touch ${SDS_READY} @@ -55,7 +58,6 @@ touch ${SDS_READY} echo source /etc/os-release echo "$(date +'%T'): ready -> ${PRETTY_NAME}" - echo "$(date +'%T'): http-over-all -> RELEASE: ${RELEASE}" trap "term_handler" EXIT diff --git a/incontainer/nginx-config/nginx-default b/incontainer/nginx-config/nginx-default index 8971bf5..2b58356 100644 --- a/incontainer/nginx-config/nginx-default +++ b/incontainer/nginx-config/nginx-default @@ -55,6 +55,12 @@ server { return 200 "Don't index this drive!"; } + location /func/nginx_status { + allow 127.0.0.1; + deny all; + stub_status; + } + # return ip address from the requestor location /func/remote-ip { default_type text/plain; diff --git a/incontainer/php/force-update.php b/incontainer/php/force-update.php index 9491a55..2132a12 100644 --- a/incontainer/php/force-update.php +++ b/incontainer/php/force-update.php @@ -1,6 +1,7 @@ " + err.Error())) + return + } + + w.Write(output) + log.Printf("- %v - %v (%s)\n", r.RemoteAddr, r.RequestURI, time.Since(start)) +} + +func Serve(addr *string) { + http.HandleFunc("/force-update", funcForceUpdate) + http.HandleFunc("/force-update/", funcForceUpdate) + + fs := http.FileServer(http.Dir("/var/www/html")) + http.Handle("/", fs) + + log.Printf("Listening on %s...", *addr) + err := http.ListenAndServe(*addr, nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/tools/doclig/src/args.go b/tools/doclig/src/args.go index 9cbf87e..2616144 100644 --- a/tools/doclig/src/args.go +++ b/tools/doclig/src/args.go @@ -10,6 +10,7 @@ type Args struct { Image *string User *string Password *string + ListenAddr *string SourcePaths []string DestinationPath *string } @@ -17,10 +18,11 @@ type Args struct { func HandleArgs() *Args { var args Args - args.Action = flag.String("action", "", "check-image, copy, prune, pull") + args.Action = flag.String("action", "", "check-image, copy, prune, pull, serve") args.Image = flag.String("image", "", "full image name (action: check-image, copy, pull)") args.User = flag.String("user", "", "username for docker registry (action: pull)") args.Password = flag.String("password", "", "password for docker registry (action: pull)") + args.ListenAddr = flag.String("listen-addr", ":80", "TCP address for the server to listen on (action: serve)") var sourceDirs string flag.StringVar(&sourceDirs, "srcPaths", "", "comma separated source directories (action: copy)") args.DestinationPath = flag.String("dst", "", "destination dir (action: copy)") diff --git a/tools/doclig/src/doclig.go b/tools/doclig/src/doclig.go index 95cb489..15262eb 100644 --- a/tools/doclig/src/doclig.go +++ b/tools/doclig/src/doclig.go @@ -24,5 +24,7 @@ func main() { action.CheckImage(args.Image) } else if *args.Action == "prune" { action.PruneImages() + } else if *args.Action == "serve" { + action.Serve(args.ListenAddr) } }