Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

use nginx for prometheus basic auth #11

Merged
merged 2 commits into from
May 21, 2018
Merged

use nginx for prometheus basic auth #11

merged 2 commits into from
May 21, 2018

Conversation

philandstuff
Copy link
Contributor

Apologies for the one-massive-commit. The main thing this does is
adds an nginx authenticating proxy in front of prometheus, that puts
basic auth in place.

This is done by adding an nginx container into the task definition for
prometheus, and using a link to allow nginx to access prometheus.

The password is in the credential store. The password hash is publicly viewable
in this commit; we should probably replace this with a better secret management
policy at some point.

Other things done in this commit:

  • we no longer specify hostPort values; we allow ECS to
    automatically assign host ports. The load balancer can still find
    our container, but we no longer have port conflicts when two
    concurrent versions of the service are deployed

  • reintroduce cpu quotas. because our instance has a total of 4096
    cpu units available, and the default value is 1024, once we added
    nginx we had 3 containers and therefore couldn't run a new version
    of our service without killing the old version. Instead we set
    prometheus=1024, s3-config-grabber=256, nginx=256.

  • we use the nginx:alpine image rather than the plain nginx image.
    This is for two reasons: 1) it's smaller, and 2) the alpine image
    supports bcrypt:
    nginx:1.9 image not working with bcrypt encryption docker-library/official-images#860

Apologies for the one-massive-commit.  The main thing this does is
adds an nginx authenticating proxy in front of prometheus, that puts
basic auth in place.

This is done by adding an nginx container into the task definition for
prometheus, and using a `link` to allow nginx to access prometheus.

Other things done in this commit:

 - we no longer specify `hostPort` values; we allow ECS to
   automatically assign host ports.  The load balancer can still find
   our container, but we no longer have port conflicts when two
   concurrent versions of the service are deployed

 - reintroduce cpu quotas.  because our instance has a total of 4096
   cpu units available, and the default value is 1024, once we added
   nginx we had 3 containers and therefore couldn't run a new version
   of our service without killing the old version.  Instead we set
   prometheus=1024, s3-config-grabber=256, nginx=256.

 - we use the nginx:alpine image rather than the plain `nginx` image.
   This is for two reasons: 1) it's smaller, and 2) the alpine image
   supports bcrypt:
   docker-library/official-images#860
This has to be a separate container because container links can't form
cycles.
@philandstuff philandstuff merged commit cea2e64 into master May 21, 2018
@philandstuff philandstuff deleted the add-nginx branch May 21, 2018 11:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants