diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c48992..851dc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Nginx Changelog All notable changes to this project will be documented in this file. @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [v1.17.10-8] - 2021-11-02 + +### Changed +- The script to append the warp menu to each page is now hosted instead of inline (#49) +- Use logging/root key + ## [v1.17.10-7] - 2021-06-17 ### Changed - Update warp-menu version to v1.2.0 and add link to Cloudogu docs (#47) diff --git a/Dockerfile b/Dockerfile index 65c6871..20d7489 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN set -x \ FROM registry.cloudogu.com/official/base:3.12.4-1 LABEL maintainer="hello@cloudogu.com" \ NAME="official/nginx" \ - VERSION="1.17.10-7" + VERSION="1.17.10-8" ENV CES_CONFD_VERSION=0.5.1 \ CES_CONFD_TAR_SHA256="f8776bc473beeacda8ff502861906bb9ab6eeda365513290116697cc6f68eee8" \ diff --git a/Jenkinsfile b/Jenkinsfile index cce13b9..b51938a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!groovy -@Library(['github.com/cloudogu/dogu-build-lib@v1.1.0', 'github.com/cloudogu/ces-build-lib@1.44.2']) _ +@Library(['github.com/cloudogu/dogu-build-lib@v1.4.1', 'github.com/cloudogu/ces-build-lib@1.48.0']) _ import com.cloudogu.ces.dogubuildlib.* import com.cloudogu.ces.cesbuildlib.* diff --git a/custom_scripts/README.md b/custom_scripts/README.md new file mode 100644 index 0000000..d33b519 --- /dev/null +++ b/custom_scripts/README.md @@ -0,0 +1,7 @@ +## Custom Scripts + +This directory contains optional custom scripts that can be activated. To do so move a certain script into the `conf.d` Volume of the Nginx (`/var/lib/ces/nginx/volumes/app.conf.d`). Then you need to restart the dogu for the script/s to apply. + +### Script: block_jenkins_user_view + +THis scripts blocks all member views of the Jenkins dogu. This is especially helpful for giving public access to one Jenkins instance while securing the member information. \ No newline at end of file diff --git a/custom_scripts/block_jenkins_user_view.conf b/custom_scripts/block_jenkins_user_view.conf new file mode 100644 index 0000000..2210f10 --- /dev/null +++ b/custom_scripts/block_jenkins_user_view.conf @@ -0,0 +1,4 @@ +location ~* (/jenkins).*(/asynchPeople) { + error_page 401 /errors/401.html; + return 401; +} \ No newline at end of file diff --git a/dogu.json b/dogu.json index 6959a1c..2e118f4 100644 --- a/dogu.json +++ b/dogu.json @@ -1,6 +1,6 @@ { "Name": "official/nginx", - "Version": "1.17.10-7", + "Version": "1.17.10-8", "DisplayName": "Nginx", "Description": "Nginx WebServer.", "Logo": "https://cloudogu.com/images/dogus/nginx.png", @@ -17,9 +17,19 @@ ], "Configuration": [ { - "Name": "log_level", - "Description": "Detail level of logging (debug, info, notice, warn, error, crit, alert, or emerg)", - "Optional": true + "Name": "logging/root", + "Description": "Set the root log level to one of ERROR, WARN, INFO, DEBUG.", + "Optional": true, + "Default": "WARN", + "Validation": { + "Type": "ONE_OF", + "Values": [ + "WARN", + "DEBUG", + "INFO", + "ERROR" + ] + } }, { "Name": "disable_access_log", diff --git a/resources/etc/ces-confd/templates/app.conf.tpl b/resources/etc/ces-confd/templates/app.conf.tpl index dcc8e45..a0776b2 100644 --- a/resources/etc/ces-confd/templates/app.conf.tpl +++ b/resources/etc/ces-confd/templates/app.conf.tpl @@ -1,6 +1,7 @@ server { include /etc/nginx/include.d/ssl.conf; include /etc/nginx/include.d/errors.conf; + include /etc/nginx/include.d/warp.conf; include /etc/nginx/include.d/robots.conf; include /etc/nginx/app.conf.d/*.conf; diff --git a/resources/etc/nginx/include.d/subfilters.conf.tpl b/resources/etc/nginx/include.d/subfilters.conf.tpl index 77d7508..a30f7b8 100644 --- a/resources/etc/nginx/include.d/subfilters.conf.tpl +++ b/resources/etc/nginx/include.d/subfilters.conf.tpl @@ -1,5 +1,5 @@ # warp menu -set $scripts ''; +set $scripts ''; # Include google analytics scripts if a tracking id is set {{ if .Config.Exists "google_tracking_id" }} diff --git a/resources/etc/nginx/include.d/warp.conf b/resources/etc/nginx/include.d/warp.conf new file mode 100644 index 0000000..0e198b9 --- /dev/null +++ b/resources/etc/nginx/include.d/warp.conf @@ -0,0 +1,4 @@ +# error page location +location /warpmenu { + root /var/www/html; +} diff --git a/resources/etc/nginx/nginx.conf.tpl b/resources/etc/nginx/nginx.conf.tpl index 4d864cc..70deb12 100644 --- a/resources/etc/nginx/nginx.conf.tpl +++ b/resources/etc/nginx/nginx.conf.tpl @@ -1,7 +1,7 @@ user nginx; worker_processes 2; -error_log /var/log/nginx/error.log {{ .Config.GetOrDefault "log_level" "warn" }}; +error_log /var/log/nginx/error.log {{ .Env.Get "LOG_LEVEL" }}; pid /var/run/nginx.pid; events { diff --git a/resources/startup.sh b/resources/startup.sh index cf413d3..8f008e9 100755 --- a/resources/startup.sh +++ b/resources/startup.sh @@ -3,6 +3,30 @@ set -o errexit set -o nounset set -o pipefail +echo " ./////, " +echo " ./////==//////* " +echo " ////. ___ ////. " +echo " ,**,. //// ,////A, */// ,**,. " +echo " ,/////////////* */////* *////////////A " +echo " ////' \VA. '|' .///' '///* " +echo " */// .*///*, | .*//*, ///* " +echo " (/// (//////)**--_./////_----*//////) ///) " +echo " V/// '°°°° (/////) °°°°' //// " +echo " V/////(////////\. '°°°' ./////////(///(/' " +echo " 'V/(/////////////////////////////V' " + +function export_log_level() { + ETCD_LOG_LEVEL="$(doguctl config logging/root --default "WARN")" + echo "Found etcd log level: ${ETCD_LOG_LEVEL}" + + # The log level is exported for `doguctl template` + # The format is almost the same, except the case. The etcd-format is all uppercase, the configuration format + # is all lower case. + export LOG_LEVEL="${ETCD_LOG_LEVEL,,}" + + echo "Set dogu log level to : ${LOG_LEVEL}" +} + echo "[nginx] configure ssl and https ..." doguctl config --global certificate/server.crt > "/etc/ssl/server.crt" doguctl config --global certificate/server.key > "/etc/ssl/server.key" @@ -20,6 +44,7 @@ doguctl template /etc/nginx/include.d/customhtml.conf.tpl /etc/nginx/include.d/c # render main configuration to include log_level echo "[nginx] configure logging ..." +export_log_level doguctl template /etc/nginx/nginx.conf.tpl /etc/nginx/nginx.conf # render analytics template diff --git a/resources/var/www/html/warpmenu/add-warp-menu.js b/resources/var/www/html/warpmenu/add-warp-menu.js new file mode 100644 index 0000000..06b89db --- /dev/null +++ b/resources/var/www/html/warpmenu/add-warp-menu.js @@ -0,0 +1,9 @@ +const addWarpMenu = function(){ + var s = document.createElement("script"); + s.type = "text/javascript"; + s.src = "/warp/warp.js"; + var x = document.getElementsByTagName("script")[0]; + x.parentNode.insertBefore(s, x); +} + +addWarpMenu(); \ No newline at end of file