From 6c5901d27f6f01099070885973543a5bb5759d7d Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Wed, 21 Apr 2021 18:26:16 +0100 Subject: [PATCH] Add local redis session store testing environment --- contrib/local-environment/Makefile | 8 +++++ .../docker-compose-redis.yaml | 30 +++++++++++++++++++ .../local-environment/oauth2-proxy-redis.cfg | 14 +++++++++ 3 files changed, 52 insertions(+) create mode 100644 contrib/local-environment/docker-compose-redis.yaml create mode 100644 contrib/local-environment/oauth2-proxy-redis.cfg diff --git a/contrib/local-environment/Makefile b/contrib/local-environment/Makefile index db335d8d..711a6b6b 100644 --- a/contrib/local-environment/Makefile +++ b/contrib/local-environment/Makefile @@ -46,3 +46,11 @@ traefik-up: .PHONY: traefik-% traefik-%: docker-compose -f docker-compose.yaml -f docker-compose-traefik.yaml $* + +.PHONY: redis-up +redis-up: + docker-compose -f docker-compose.yaml -f docker-compose-redis.yaml up -d + +.PHONY: redis-% +redis-%: + docker-compose -f docker-compose.yaml -f docker-compose-redis.yaml $* diff --git a/contrib/local-environment/docker-compose-redis.yaml b/contrib/local-environment/docker-compose-redis.yaml new file mode 100644 index 00000000..27210a23 --- /dev/null +++ b/contrib/local-environment/docker-compose-redis.yaml @@ -0,0 +1,30 @@ +# This docker-compose file can be used to bring up an example instance of oauth2-proxy +# for manual testing and exploration of features. +# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider, +# etcd for storage for Dex, Redis for storage for OAuth2 Proxy sessions and HTTPBin +# as an example upstream. +# +# This file is an extension of the main compose file and must be used with it +# docker-compose -f docker-compose.yaml -f docker-compose-redis.yaml +# Alternatively: +# make redis- (eg make redis-up, make redis-down) +# +# Access http://localhost:4180 to initiate a login cycle +version: '3.0' +services: + oauth2-proxy: + ports: [] + hostname: oauth2-proxy + volumes: + - "./oauth2-proxy-redis.cfg:/oauth2-proxy.cfg" + networks: + oauth2-proxy: {} + redis: + container_name: redis + image: redis:6.2 + hostname: redis + networks: + oauth2-proxy: {} + httpbin: {} +networks: + oauth2-proxy: {} diff --git a/contrib/local-environment/oauth2-proxy-redis.cfg b/contrib/local-environment/oauth2-proxy-redis.cfg new file mode 100644 index 00000000..5afc466b --- /dev/null +++ b/contrib/local-environment/oauth2-proxy-redis.cfg @@ -0,0 +1,14 @@ +http_address="0.0.0.0:4180" +cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w=" +provider="oidc" +email_domains="example.com" +oidc_issuer_url="http://dex.localhost:4190/dex" +client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK" +client_id="oauth2-proxy" +cookie_secure="false" + +redirect_url="http://localhost:4180/oauth2/callback" +upstreams="http://httpbin" + +session_store_type="redis" +redis_connection_url="redis://redis:6379"