Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard base #84

Merged
merged 25 commits into from
Dec 20, 2021
Merged

Standard base #84

merged 25 commits into from
Dec 20, 2021

Conversation

nemchik
Copy link
Member

@nemchik nemchik commented Oct 18, 2021

!! NOTICE !!
Some of the changes listed below have been rolled back in #98
Items listed below that are NOT checked have been rolled back.

Update:
linuxserver/cstate#114
https://github.com/linuxserver/cstate/blob/master/content/issues/2022-08-20-nginx-base.md
https://info.linuxserver.io/issues/2022-08-20-nginx-base/


Standardizing all images using our alpine nginx base. More info will be recorded here soon.

Objectives:

  • Bring our default shipped configs as close as possible to alpine upstream defaults
  • Include worker_processes.conf and init script to generate it in the base
  • Include resolver.conf and init script to generate it in the base
  • Include ssl.conf in the base (the same as what is currently shipped in SWAG, but adjusted to use the self-signed certs generated by the base)
  • include /config/nginx/site-confs/*.conf; with *.conf extension (rename existing user files automatically)
  • Split out init scripts
    • root/migrations/01-nginx-site-confs-default migrate existing default to default.conf
    • root/etc/cont-init.d/11-folders creates all the folders needed in /config
    • root/etc/cont-init.d/12-samples removes existing *.sample files from /config/nginx and copies any included *.sample files from the image
    • root/etc/cont-init.d/13-nginx enable required configs (nginx.conf, default.conf) if they don't exist, setup dhparams, setup resolver.conf, setup worker_processes.conf
    • root/etc/cont-init.d/14-php configure php
    • root/etc/cont-init.d/15-keygen create certificates for ssl.conf possibly could be overwritten downstream (ex: swag could ship a different script for certs from certbot)
    • root/etc/cont-init.d/20-permissions set /config permissions
    • root/etc/cont-init.d/85-version-checks check all enabled *.conf files against all *.sample files shipped with the image and alert the user about updates
  • Rework default.conf
    • Expect applications inside containers to exist at /app/www/public/, and if that does not exist, use /config/www
    • Include ipv6 support
    • Move port 443 listen directives to ssl.conf
    • detect existence of /config/nginx/.htpasswd and apply basic auth automatically
    • deny access to .htaccess/.htpasswd files
    • adjust php location and fastcgi_params to use PATH_INFO and mitigate HTTP_PROXY vulnerability
  • Restructure nginx configs
    • All nginx related configs have been structured into subfolders in root/defaults/nginx/ (presented in the container as /defaults/nginx/)
    • Configs in /defaults/nginx/ are recursively copied to the user's /config/nginx/ (maintaining the structure)
    • All configs are now named *.sample and all include ## Version YYYY/MM/DD - Changelog: <url to repo history> used by /etc/cont-init.d/85-version-checks
      • Required configs (/config/nginx/nginx.conf and /config/nginx/site-confs/default.conf) are enabled by default. Downstream images can include and/or enable others as needed (ex: SWAG will enable /config/nginx/location-confs/proxy.conf, /config/nginx/server-confs/502.conf and /config/nginx/server-confs/ssl.conf)
    • Folder structure is as follows (in the /config/nginx/ context):
      • Includes proxy.conf (swag), authelia-location.conf (swag), ldap-location.conf (swag)
      • Includes ssl.conf (base and swag) 502.conf (swag), authelia-server.conf (swag), ldap-server.conf (swag)
      • /config/nginx/site-confs/* included inside the http context in /config/nginx/nginx.conf
        • Includes default.conf (base or downstream images)
      • /config/nginx/http-confs/* included inside the http context in /config/nginx/nginx.conf
      • /config/nginx/location-confs/* included inside the location context in /config/nginx/site-confs/default.conf
      • /config/nginx/server-confs/* included inside the server context in /config/nginx/site-confs/default.conf
      • /config/nginx/subdomain-confs/* included inside the http context in /config/nginx/site-confs/default.conf (swag)
      • /config/nginx/subfolder-confs/* included inside the http context in /config/nginx/site-confs/default.conf (swag)
Image Branch PR Passing Build Notes
baseimage-alpine-nginx master #84 GitHub branch checks state merged Should be merged and built before the rest on the list
bookstack master linuxserver/docker-bookstack#113 GitHub branch checks state merged
cops master linuxserver/docker-cops#34 GitHub branch checks state composer downgraded to v1 for compatibility
diskover master linuxserver/docker-diskover#43 GitHub branch checks state
dokuwiki master linuxserver/docker-dokuwiki#43 GitHub branch checks state merged
freshrss master linuxserver/docker-freshrss#40 GitHub branch checks state merged
grav main linuxserver/docker-grav#9 GitHub branch checks state merged
grocy master linuxserver/docker-grocy#52 GitHub branch checks state merged
heimdall main linuxserver/docker-heimdall#79 GitHub branch checks state
heimdall development linuxserver/docker-heimdall#109 GitHub branch checks state
librespeed master linuxserver/docker-librespeed#15 GitHub branch checks state merged
lychee master linuxserver/docker-lychee#51 GitHub branch checks state
muximux master linuxserver/docker-muximux#26 GitHub branch checks state Deprecated
nextcloud master linuxserver/docker-nextcloud#219 GitHub branch checks state merged installing php smbclient from alpine edge instead of building it (will need testing)
nginx master linuxserver/docker-nginx#79 GitHub branch checks state merged
photoshow master linuxserver/docker-photoshow#28 GitHub branch checks state Deprecated uses deprecated function get_magic_quotes_gpc, not compatible with php8
phpmyadmin main linuxserver/docker-phpmyadmin#3 GitHub branch checks state merged
piwigo master linuxserver/docker-piwigo#49 GitHub branch checks state merged
pixapop master linuxserver/docker-pixapop#11 GitHub branch checks state Deprecated composer dependencies not compatible with php8
projectsend master linuxserver/docker-projectsend#22 GitHub branch checks state merged
snapdrop master linuxserver/docker-snapdrop#6 GitHub branch checks state merged
snipe-it master linuxserver/docker-snipe-it#28 GitHub branch checks state merged
swag master linuxserver/docker-swag#169 GitHub branch checks state merged
xbackbone main linuxserver/docker-xbackbone#5 GitHub branch checks state merged

Split apart init scripts
Include dhparams
Include ssl.conf
Include resolver.conf generation
Include worker_processes.conf generation
use nginx.conf and default site config formatted like swag (formatted similar to upstream nginx)
default.conf now universally handles /app/www/public or /config/www
ssl.conf now includes mozilla recommendations
$host sends $http_host without the port and
falls back to sending $server_name if HTTP_HOST header is empty
@nemchik nemchik marked this pull request as ready for review December 6, 2021 17:29
@nemchik nemchik requested a review from a team December 6, 2021 17:29
1 similar comment
Copy link
Member

@drizuid drizuid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants