git.iko.soy/typeable/oauth2-proxy
on master help sign in
Add test environment docker-compose files
commit0ccfc73ab296f7acd096885343f0bc0f358bb69b authorJoel Speed <joel.speed@hotmail.co.uk> dateSun 3 May 2020, 21:05 (6 years ago) parent4e3dd09
5 files changed+117−1
Makefile+6−1 contrib/local-environment/Makefile+7 contrib/local-environment/dex.yaml+30 contrib/local-environment/docker-compose.yaml+64 contrib/local-environment/oauth2-proxy.cfg+10
Makefile+6−1
@@ -76,7 +76,7 @@ release: lint test
7676 BINARY=${BINARY} VERSION=${VERSION} ./dist.sh
7777
7878.PHONY: validate-go-version
79−validate-go-version: ## Validates the installed version of go against Mattermost's minimum requirement.
79+validate-go-version:
8080 @if [ $(GO_MAJOR_VERSION) -gt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
8181 exit 0 ;\
8282 elif [ $(GO_MAJOR_VERSION) -lt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
@@ -86,3 +86,8 @@ validate-go-version: ## Validates the installed version of go against Mattermost
8686 echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
8787 exit 1; \
8888 fi
89+
90+# local-env can be used to interact with the local development environment
91+.PHONY: local-env-%
92+local-env-%:
93+ make -C contrib/local-environment $*
contrib/local-environment/Makefilenew file+7
@@ -0,0 +1,7 @@
1+.PHONY: up
2+up:
3+ docker-compose up -d
4+
5+.PHONY: %
6+%:
7+ docker-compose $*
contrib/local-environment/dex.yamlnew file+30
@@ -0,0 +1,30 @@
1+# This configuration is intended to be used with the docker-compose testing
2+# environment.
3+# This should configure Dex to run on port 4190 and provides a static login
4+issuer: http://dex.localhost:4190/dex
5+storage:
6+ type: etcd
7+ config:
8+ endpoints:
9+ - http://etcd:2379
10+ namespace: dex/
11+web:
12+ http: 0.0.0.0:4190
13+oauth2:
14+ skipApprovalScreen: true
15+expiry:
16+ signingKeys: "4h"
17+ idTokens: "1h"
18+staticClients:
19+- id: oauth2-proxy
20+ redirectURIs:
21+ - 'http://localhost:4180/oauth2/callback'
22+ name: 'OAuth2 Proxy'
23+ secret: b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK
24+enablePasswordDB: true
25+staticPasswords:
26+- email: "admin@example.com"
27+ # bcrypt hash of the string "password"
28+ hash: "$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W"
29+ username: "admin"
30+ userID: "08a8684b-db88-4b73-90a9-3cd1661f5466"
contrib/local-environment/docker-compose.yamlnew file+64
@@ -0,0 +1,64 @@
1+# This docker-compose file can be used to bring up an example instance of oauth2-proxy
2+# for manual testing and exploration of features.
3+# Alongside OAuth2-Proxy, this file also starts Dex to act as the identity provider,
4+# etcd for storage for Dex and HTTPBin as an example upstream.
5+#
6+# This can either be created using docker-compose
7+# docker-compose -f docker-compose.yaml <command>
8+# Or:
9+# make <command> (eg. make up, make down)
10+#
11+# Access http://localhost:4180 to initiate a login cycle
12+version: '3.0'
13+services:
14+ oauth2-proxy:
15+ container_name: oauth2-proxy
16+ image: quay.io/oauth2-proxy/oauth2-proxy:v5.1.1
17+ command: --config /oauth2-proxy.cfg
18+ ports:
19+ - 4180:4180/tcp
20+ hostname: oauth2-proxy
21+ volumes:
22+ - "./oauth2-proxy.cfg:/oauth2-proxy.cfg"
23+ restart: unless-stopped
24+ networks:
25+ dex: {}
26+ httpbin: {}
27+ depends_on:
28+ - dex
29+ - httpbin
30+ dex:
31+ container_name: dex
32+ image: quay.io/dexidp/dex:v2.23.0
33+ command: serve /dex.yaml
34+ ports:
35+ - 4190:4190/tcp
36+ hostname: dex
37+ volumes:
38+ - "./dex.yaml:/dex.yaml"
39+ restart: unless-stopped
40+ networks:
41+ dex:
42+ aliases:
43+ - dex.localhost
44+ etcd: {}
45+ depends_on:
46+ - etcd
47+ httpbin:
48+ container_name: httpbin
49+ image: kennethreitz/httpbin
50+ networks:
51+ httpbin: {}
52+ etcd:
53+ container_name: etcd
54+ image: gcr.io/etcd-development/etcd:v3.4.7
55+ entrypoint: /usr/local/bin/etcd
56+ command:
57+ - --listen-client-urls=http://0.0.0.0:2379
58+ - --advertise-client-urls=http://etcd:2379
59+ networks:
60+ etcd: {}
61+networks:
62+ dex: {}
63+ etcd: {}
64+ httpbin: {}
contrib/local-environment/oauth2-proxy.cfgnew file+10
@@ -0,0 +1,10 @@
1+http_address="0.0.0.0:4180"
2+redirect_url="http://localhost:4180/oauth2/callback"
3+cookie_secret="OQINaROshtE9TcZkNAm-5Zs2Pv3xaWytBmc5W7sPX7w="
4+provider="oidc"
5+email_domains="example.com"
6+oidc_issuer_url="http://dex.localhost:4190/dex"
7+client_secret="b2F1dGgyLXByb3h5LWNsaWVudC1zZWNyZXQK"
8+client_id="oauth2-proxy"
9+cookie_secure="false"
10+upstreams="http://httpbin"