Skip to content

Bootstrapping problems in pull-config.sh #94

@runleveldev

Description

@runleveldev

https://github.com/mieweb/opensource-server/blob/main/nginx-reverse-proxy/pull-config.sh has the problem where, before there is any reverse proxy configuration, create-a-container.opensource.mieweb.org is inaccessible since it relies on the reverse proxy to handle requests for *.opensource.mieweb.org. The script also expects /etc/nginx/conf.d/reverse-proxy.conf to exist so it can make a backup and fails due to set -e otherwise. The script also pulls the config every minute, even if there's been no changes. In effect, we need the following changes:

  1. Check for the existence of /etc/nginx/conf.d/reverse-proxy.conf and skip the backup and restore operations if it doesn't exist
  2. Store the ETag of the reverse-proxy.conf file in a seperate file, say /etc/nginx/conf.d/reverse-proxy.etag, send that value to the server when requesting the new config. On a cache hit do nothing, we already have the latest file. On a cache miss, proceed with the backup -> download -> check -> reload/restore process
  3. If create-a-container.opensource.mieweb.org generates a gateway error (502), fallback to the http://create-a-container.cluster.mieweb.org:3000/nginx.conf (ie. the internal IP and port for the create-a-container service)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions