Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local test environments for testing changes and new features #529

Merged
merged 3 commits into from
May 12, 2020

Conversation

JoelSpeed
Copy link
Member

@JoelSpeed JoelSpeed commented May 7, 2020

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 using make local-env-down and can then visit localhost: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 on httpbin.oauth2-proxy.localhost and the static site on oauth2-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> and make 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:

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.

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

@codeclimate
Copy link

codeclimate bot commented May 7, 2020

Code Climate has analyzed commit b2641e2 and detected 0 issues on this pull request.

View more on Code Climate.

@JoelSpeed JoelSpeed force-pushed the test-environment branch 2 times, most recently from 909a24c to 87d6105 Compare May 10, 2020 10:56
@JoelSpeed JoelSpeed removed the WIP Work in progress label May 10, 2020
@JoelSpeed
Copy link
Member Author

I've added a bunch of comments through this to explain how to use it

loshz
loshz previously approved these changes May 12, 2020
Copy link
Member

@loshz loshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@JoelSpeed
Copy link
Member Author

@syscll Rebased to fix up the changelog conflict, can you retick?

@JoelSpeed JoelSpeed merged commit d0cfca4 into master May 12, 2020
@JoelSpeed JoelSpeed deleted the test-environment branch May 12, 2020 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants