Skip to content

Commit

Permalink
examples: add proxying example
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Renatus <[email protected]>
  • Loading branch information
srenatus committed Sep 24, 2024
1 parent 248da23 commit 95d910e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/proxying/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Proxying example for Enterprise OPA

This demo setup is using docker compose to set up the following:

```mermaid
graph LR
proxy-->internet
dns-->internet
subgraph internal
eopa-->proxy
eopa-->dns
end
```

Enterprise OPA is started with
1. HTTP_PROXY and HTTPS_PROXY set to `proxy:3128`
2. `/etc/resolv.conf` including both the Docker DNS and the DNS proxy
3. **No direct access to the public internet.**

When starting the stack with `docker compose up`, we'll find Enterprise OPA starting up:

```raw
enterprise-opa-1 | {"level":"debug","msg":"Server initialized.","time":"2024-08-12T09:49:01Z"}
```

Requests to the internet to verify the license go through the proxy.
42 changes: 42 additions & 0 deletions examples/proxying/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
enterprise-opa:
image: ghcr.io/styrainc/enterprise-opa:latest
ports:
- "8181:8181"
command:
- "run"
- "--server"
- "--addr=0.0.0.0:8181"
- "--log-level=debug"
environment:
EOPA_LICENSE_KEY: ${EOPA_LICENSE_KEY}
HTTP_PROXY: proxy:3128
HTTPS_PROXY: proxy:3128
networks:
intnet: {}
depends_on:
- proxy
- dns
volumes:
- ./resolv.conf:/etc/resolv.conf

dns:
image: coredns/coredns
ports:
- "53:53"
networks:
intnet: {}
extnet: {}

proxy:
image: hinata/nginx-forward-proxy:latest
ports:
- "3128:3128"
networks:
intnet: {}
extnet: {}

networks:
intnet:
internal: true
extnet: {}
2 changes: 2 additions & 0 deletions examples/proxying/resolv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nameserver 127.0.0.11
nameserver dns

0 comments on commit 95d910e

Please sign in to comment.