Use the row's own model and host type in regenerate-config - #5813
Open
vzagorovskiy wants to merge 1 commit into
Open
Use the row's own model and host type in regenerate-config#5813vzagorovskiy wants to merge 1 commit into
vzagorovskiy wants to merge 1 commit into
Conversation
processItems() passed proxyHostModel and the literal "proxy_host" to configure() for every host type. host_type selects both the template and the output path, and each host type has its own id sequence, so redirection hosts, 404 hosts and streams were rendered through proxy_host.conf and written over /data/nginx/proxy_host/<id>.conf. The proxy host sharing that id lost its config file and had the resulting nginx error recorded in its own meta.
|
Docker Image for build 1 is available on DockerHub: Note Ensure you backup your NPM instance before testing this image! Especially if there are database changes. Warning Changes and additions to DNS Providers require verification by at least 2 members of the community! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
backend/scripts/regenerate-configwalks four host types, butprocessItems()hands the same model and the literal"proxy_host"toconfigure()for all of them:host_typepicks both the template and the output path:generateConfig()readstemplates/${nice_host_type}.confand writes/data/nginx/${nice_host_type}/${id}.conf. Each host type has its own id sequence, so redirection host 1, 404 host 1 and stream 1 all end up pointed at/data/nginx/proxy_host/1.conf.For every redirection host, 404 host and stream, the script deletes the config of the proxy host that happens to share the id, renders the row through
proxy_host.conf(which has noforward_scheme,forward_hostorforward_portto fill in), failsnginx -t, and writes the error into theproxy_hostrow'smeta.The proxy host ends up offline and blamed for a config it never had. Its own
metais overwritten, and the redirection host'smetais never updated.Reproduction
Stock 2.15.1 container with one proxy host and one redirection host, both id 1:
proxy.example.comstops being served, and the error recorded against it points at line 14 of a file that was generated from the redirection host row. Nothing is left on disk to show what happened, which is #5812.With this change, on the same instance:
Fix
Pass the model and the host type of the rows being processed.
typekeeps its current job as the label used in log lines.