Add local test environments for testing changes and new features #529
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.
Description
Adds two environments, first off one that sets up Dex and OAuth2 Proxy in a very simple setup that proxies to HTTPBin once authenticated.
The idea here is that developers can run
make local-env-up
to bring up a local environment (tear down usingmake local-env-down
and can then visitlocalhost:4180
to access the proxy, login, and then see the HTTPBin.Secondly, by calling
make local-env-nginx-up
instead, this starts an nginx with three upstreams, HTTPBin, the OAuth2-Proxy and a static site. This demonstrates the auth request style set up and will allow testing of that environment. The HTTPBin is served onhttpbin.oauth2-proxy.localhost
and the static site onoauth2-proxy.localhost
. Both of which are protected by the same oauth2-proxy container set up with whitelist domains.In both cases, the log in is admin@example.com and password as the password. Deliberately simple and I'm happy with this being public, it's for debugging and testing purposes and is a pure localhost example.
From the root you can run
make local-env-<command>
andmake local-env-nginx-<command>
where command is any docker-compose command, so up, down, restart all work for example.Motivation and Context
This will allow developers to test their changes more easily. Build a container, substitute in the compose file, update the config as per requirements and check that the expectation is correct.
How Has This Been Tested?
I ran the environments, logged in to the OAuth2 Proxy via Dex and saw the sites
Checklist:
I need to add some documentation for this and should probably comment through the code that I've introduced, but I wanted to get the PR open so people can see what I'm working on/leave some feedback