Repository navigation
feat: include project nginx config from server.d in templates - #163
turegjorup wants to merge 4 commits into
Conversation
Drupal and Symfony templates include .docker/templates/server.d/*.conf in the server block, so project-specific nginx rules survive template:update.
Keep the APP_PATH_PREFIX rewrite in .docker/templates/server.d/, the same as event-database-imports, so template updates do not remove it. The include line matches itk-dev/devops_itkdev-docker#163.
|
The The fix is in #167: use |
cableman
left a comment
There was a problem hiding this comment.
It is the default thing in the docker image.
By default, this function reads template files in /etc/nginx/templates/*.template and outputs the result of executing envsubst to /etc/nginx/conf.d.
https://hub.docker.com/_/nginx#using-environment-variables-in-nginx-configuration-new-in-119
|
Yes, the image reads all
In both cases the project rule has no effect. A project The background is event-database-imports ( rewrite ^${APP_PATH_PREFIX}/(.*) /$1 break;
The rewrite must run before nginx selects a location, so it must be inside the template's |
…er-overrides # Conflicts: # CHANGELOG.md
Lets projects keep their own nginx rules in
.docker/templates/server.d/sotemplate:updateno longer overwrites them.Changes
templates/{drupal,symfony}/.docker/templates/default.conf.template:include /etc/nginx/conf.d/server.d/*.conf;in theserverblock (also used bydrupal-10,drupal-11,symfony-6,symfony-7andsymfony-8through symlinks)README.md: where to keep project-specific changes (docker-compose.override.yml,docker-compose.server.override.ymland.docker/templates/server.d/)CHANGELOG.md: add entryWhy
template:updatecopies the template files over the project's own, so project-specific lines indefault.conf.templateare lost on every update. For example, event-database-imports serves its admin under/adminand needs a rewrite for its assets. A template update removed that rewrite, and it had to be restored in itk-dev/event-database-imports@2f59b75. The same update removed it again today.docker compose already has override files for this. nginx now has the same kind of override:
envsubston*.templatefiles in subfolders of/etc/nginx/templatesand writes them to the same subfolder inconf.d. Project files inserver.d/therefore get the same variable substitution asdefault.conf.template.conf.d/*.conf, not subfolders, soserver.d/*.confis only used through the newinclude.template:update(rsyncwithout--delete) leaves files the template doesn't ship, soserver.d/survives updates.includewith a wildcard that matches nothing is not an error. Both configs passnginx -twith noserver.d/folder, so existing projects need no changes.Tested in event-database-imports with the rewrite moved to
.docker/templates/server.d/app-path-prefix.conf.template: admin assets and routes load under/admin(itk-dev/event-database-imports#116).The EOL
drupal-8anddrupal-9templates are left unchanged.