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

Enable OAuth2 authentication. #646

Open
wants to merge 131 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
44a1505
docs(obtain-jwt-token.mdx): curl request data-raw should be valid json
May 1, 2024
0473d76
Enable OAuth2 authentication.
Aug 16, 2024
b323d1e
Merge pull request #582 from emily-zall/ezall-jwt-syntax
roekatz Aug 23, 2024
d119c1c
Data updater tests: Fix cleaning up undefined resource
roekatz Aug 28, 2024
3c77346
Lock fastapi-websocket-rpc to 0.1.25 - as 0.1.26 introduces a regression
roekatz Aug 28, 2024
5a091e6
Merge pull request #647 from permitio/roe/per-10558-fix-failing-opal-…
roekatz Aug 29, 2024
810b731
Fix opal-server -> opal_server in docker compose files
roekatz Aug 8, 2024
903adf3
Introduce first draft (still missing) for bash based app scripts
roekatz Aug 8, 2024
443f51c
Also test git pushes and replications
roekatz Aug 8, 2024
ccedb41
Organize in functions
roekatz Aug 8, 2024
0d02020
Introduce app tests to CI
roekatz Aug 14, 2024
af7c402
Prettify app tests script
roekatz Aug 15, 2024
6b1ba11
Test statistics as well
roekatz Aug 15, 2024
c6e6564
Small changes for running locally
roekatz Aug 15, 2024
b82b4df
Introduce README for app tests
roekatz Aug 15, 2024
2dce27b
CR Fixes
roekatz Aug 22, 2024
539f2d9
Merge pull request #645 from permitio/roe/per-10476-write-opal-applic…
roekatz Aug 29, 2024
4bb9dbd
Bump micromatch from 4.0.7 to 4.0.8 in /documentation
dependabot[bot] Aug 29, 2024
c2dda5f
Bump axios from 1.7.3 to 1.7.5 in /documentation
dependabot[bot] Aug 29, 2024
cf62d67
Bump webpack from 5.91.0 to 5.94.0 in /documentation
dependabot[bot] Aug 29, 2024
228a401
Merge pull request #650 from permitio/dependabot/npm_and_yarn/documen…
roekatz Aug 29, 2024
987874e
Merge pull request #649 from permitio/dependabot/npm_and_yarn/documen…
roekatz Aug 29, 2024
69c52bb
Merge branch 'master' into dependabot/npm_and_yarn/documentation/axio…
roekatz Aug 29, 2024
d90000f
Merge pull request #648 from permitio/dependabot/npm_and_yarn/documen…
roekatz Aug 29, 2024
178be60
fix: packages/requires.txt to reduce vulnerabilities
snyk-bot Jun 25, 2024
952b750
fix: packages/opal-common/requires.txt to reduce vulnerabilities
snyk-bot Jun 18, 2024
f0c0729
fix: upgrade multiple dependencies with Snyk
snyk-bot May 16, 2024
2e8ebab
Merge pull request #601 from permitio/snyk-fix-8bc280dbd40f86097177c5…
roekatz Aug 29, 2024
a8471ae
fix: packages/opal-common/requires.txt to reduce vulnerabilities
snyk-bot May 22, 2024
eda81f6
Merge pull request #598 from permitio/snyk-fix-9bedb2918354b3a7169e06…
roekatz Aug 29, 2024
c890d21
Merge pull request #587 from permitio/snyk-fix-0cf274b1f5f0ce3cf691aa…
roekatz Aug 29, 2024
efaab07
Merge pull request #585 from permitio/snyk-upgrade-165e5e661e1a8ae10a…
roekatz Aug 29, 2024
37c39b8
Fix setuptools to 70.0.0 on root requirements.txt
roekatz Aug 29, 2024
d51399f
Upgrade fastapi_websocket_rpc to 0.1.27
roekatz Aug 29, 2024
95ee9a5
Allow websockets upgrade (up to 13)
roekatz Aug 29, 2024
39f27b0
Merge pull request #652 from permitio/roe/per-10573-fix-current-vulne…
roekatz Aug 29, 2024
ef67058
Remove outdated password warning out of broadcast interface docs
roekatz Aug 29, 2024
456730f
Fix newer versions of builtin packages not overridden from build stage
roekatz Aug 29, 2024
b55bb50
Merge pull request #653 from permitio/roe/per-10577-fix-opal-image-bu…
roekatz Aug 29, 2024
8726380
Update sync_opal_plus.yml (#651)
danyi1212 Sep 1, 2024
065c539
Update sync_opal_plus.yml (#654)
danyi1212 Sep 1, 2024
f815233
Enable OAuth2 authentication.
Aug 16, 2024
cb3b926
Reformat code by running pre-commit run --all-files
Sep 2, 2024
4863bb6
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Sep 2, 2024
55ced17
Enable OAuth2 authentication.
Aug 16, 2024
71178f7
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
992c8a0
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Sep 4, 2024
bcaa566
Remove invalid import
Sep 4, 2024
3030ac1
Enable OAuth2 authentication.
Aug 16, 2024
4d4575b
Let us send Authorization header when fetching data sources.
Sep 9, 2024
8b91637
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Sep 9, 2024
a8e43d1
Fix DataUpdater tests
Sep 9, 2024
e5e3732
OPAL Updated Readme Proposal
gemanor Sep 17, 2024
0f8d7e3
Update README.md
gemanor Sep 17, 2024
d91759e
Update README.md
gemanor Sep 17, 2024
0f14a19
Update README.md
gemanor Sep 17, 2024
c7790da
Merge pull request #658 from permitio/authorization_usecases_readme
gemanor Sep 17, 2024
cecfafe
pulsar integration doc
daveads Sep 19, 2024
d1fd0b8
Update run_opal_with_pulsar.mdx
gemanor Sep 25, 2024
60b0316
Merge pull request #663 from daveads/pulsar-integration
gemanor Sep 25, 2024
4f7789c
Changed authentication to be required (#669)
danyi1212 Sep 25, 2024
3e80964
Revert "Changed authentication to be required (#669)" (#670)
danyi1212 Sep 26, 2024
b8cf78b
Add timeouts to avoid stuck actions
obsd Sep 29, 2024
e5ffab7
Merge pull request #672 from permitio/oded/per-10464-add-timeout-to-a…
obsd Sep 30, 2024
9aa0975
Allow httpx>=0.27.0
roekatz Oct 8, 2024
1f175b6
Merge pull request #674 from permitio/rk/allow-newer-httpx-versions
roekatz Oct 8, 2024
8344169
Enable OAuth2 authentication.
Aug 16, 2024
70a26a5
Reformat code by running pre-commit run --all-files
Sep 2, 2024
d79077c
Enable OAuth2 authentication.
Aug 16, 2024
e880d39
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
e09f7c4
Enable OAuth2 authentication.
Aug 16, 2024
2c0770c
Let us send Authorization header when fetching data sources.
Sep 9, 2024
040d2a8
Fix DataUpdater tests
Sep 9, 2024
283407b
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Oct 9, 2024
46ca93a
update docs
gideonsmila Oct 9, 2024
627b8c4
fix pre-commit
gideonsmila Oct 13, 2024
f0c54f4
update-pre-commit
gideonsmila Oct 13, 2024
6b72ec8
Merge pull request #675 from permitio/gidi/per-8929-pdp-leaking-jwt-t…
gideonsmila Oct 14, 2024
1877728
Enable OAuth2 authentication.
Aug 16, 2024
4eb2e3a
Reformat code by running pre-commit run --all-files
Sep 2, 2024
a72dc41
Enable OAuth2 authentication.
Aug 16, 2024
2f01768
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
e308ef9
Enable OAuth2 authentication.
Aug 16, 2024
df9cfe7
Let us send Authorization header when fetching data sources.
Sep 9, 2024
3cd6d50
Fix DataUpdater tests
Sep 9, 2024
4f92847
Reformat code by running pre-commit run --all-files
Sep 2, 2024
1088065
Enable OAuth2 authentication.
Aug 16, 2024
3fa90ee
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
ddafe26
Enable OAuth2 authentication.
Aug 16, 2024
7f8a7b9
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Nov 4, 2024
d602e5b
Reformat code by running pre-commit run --all-files
Sep 2, 2024
fbbff6a
Enable OAuth2 authentication.
Aug 16, 2024
4917802
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
745f290
Enable OAuth2 authentication.
Aug 16, 2024
9328480
Reformat code by running pre-commit run --all-files
Sep 2, 2024
31ad4f0
Enable OAuth2 authentication.
Aug 16, 2024
f021b16
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
eb4c6ac
Enable OAuth2 authentication.
Aug 16, 2024
9f46644
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Nov 4, 2024
1b2e9b6
add ability to register to on ws connect and disconnect events of opa…
asafc Nov 5, 2024
23006ab
Merge pull request #692 from permitio/asaf/cto-371-opal-register-to-o…
asafc Nov 5, 2024
778cc6f
fix _pipe_log_stream not running consistently for monitored subprocess
asafc Nov 5, 2024
989869a
Merge pull request #693 from permitio/asaf/cto-372-opal-fix-runner-pi…
asafc Nov 5, 2024
8a082d6
Enable OAuth2 authentication.
Aug 16, 2024
fe6c660
Reformat code by running pre-commit run --all-files
Sep 2, 2024
f4ecaef
Enable OAuth2 authentication.
Aug 16, 2024
c002b31
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
d09e45b
Enable OAuth2 authentication.
Aug 16, 2024
484a576
Let us send Authorization header when fetching data sources.
Sep 9, 2024
e9b2948
Fix DataUpdater tests
Sep 9, 2024
2dca4c0
Reformat code by running pre-commit run --all-files
Sep 2, 2024
16e77b9
Enable OAuth2 authentication.
Aug 16, 2024
d082d3e
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
3c21f0d
Enable OAuth2 authentication.
Aug 16, 2024
acddf06
Reformat code by running pre-commit run --all-files
Sep 2, 2024
134aed9
Enable OAuth2 authentication.
Aug 16, 2024
ae11c13
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
db0e7c1
Enable OAuth2 authentication.
Aug 16, 2024
bfcac4d
Reformat code by running pre-commit run --all-files
Sep 2, 2024
fe791f7
Enable OAuth2 authentication.
Aug 16, 2024
fc98a6c
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
1d97412
Enable OAuth2 authentication.
Aug 16, 2024
62f81ce
Reformat code by running pre-commit run --all-files
Sep 2, 2024
fe46cd1
Enable OAuth2 authentication.
Aug 16, 2024
adce5b2
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
acec127
Enable OAuth2 authentication.
Aug 16, 2024
de638da
Reformat code by running pre-commit run --all-files
Sep 2, 2024
28117b3
Enable OAuth2 authentication.
Aug 16, 2024
8a98abc
Refactor Authenticator to interface and initialize one with provided …
Sep 4, 2024
55079e3
Enable OAuth2 authentication.
Aug 16, 2024
6ea4078
Merge remote-tracking branch 'origin/oauth2-v2' into oauth2-v2
Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/sync_opal_plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ jobs:
- name: Create Pull Request for opal-plus
working-directory: opal-plus
run: |
gh pr create --repo permitio/opal-plus --assignee "$GITHUB_ACTOR" --reviewer "$GITHUB_ACTOR" --base master --head public-${{ github.ref_name }} --title "Sync changes from public OPAL repository" --body "This PR synchronizes changes from the public OPAL repository to the private OPAL Plus repository."
set -e
PR_NUMBER=$(gh pr list --repo permitio/opal-plus --base master --head public-master --json number --jq '.[0].number')
if [ -n "$PR_NUMBER" ]; then
echo "PR already exists: #$PR_NUMBER"
gh pr edit "$PR_NUMBER" --repo permitio/opal-plus --add-reviewer "$GITHUB_ACTOR" || true
else
gh pr create --repo permitio/opal-plus --assignee "$GITHUB_ACTOR" --reviewer "$GITHUB_ACTOR" --base master --head public-master --title "Sync changes from public OPAL repository" --body "This PR synchronizes changes from the public OPAL repository to the private OPAL Plus repository." || true
echo "New PR created."
fi
shell: bash
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
41 changes: 26 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
Expand Down Expand Up @@ -53,6 +54,7 @@ jobs:

test-docker:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
# BUILD PHASE
- name: Checkout
Expand Down Expand Up @@ -97,21 +99,30 @@ jobs:
tags: |
permitio/opal-server:test

# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'
- name: Install opal packages
run: |
python -m pip install -e ./packages/opal-common
python -m pip install -e ./packages/opal-client
python -m pip install -e ./packages/opal-server

- name: App Tests
working-directory: ./app-tests
env:
OPAL_IMAGE_TAG: test
OPAL_TESTS_POLICY_REPO_DEPLOY_KEY: ${{ secrets.OPAL_TESTS_POLICY_REPO_DEPLOY_KEY }}
run: |
# Prepare git for using tests policy repo
export OPAL_POLICY_REPO_SSH_KEY_PATH=$(realpath ./opal-tests-policy-repo-key)
echo "$OPAL_TESTS_POLICY_REPO_DEPLOY_KEY" > $OPAL_POLICY_REPO_SSH_KEY_PATH
chmod 400 $OPAL_POLICY_REPO_SSH_KEY_PATH

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs
git config --global core.sshCommand "ssh -i $OPAL_POLICY_REPO_SSH_KEY_PATH -o IdentitiesOnly=yes"
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "<>"

- name: check if opal-client was brought up successfully
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep 'PUT /v1/data/static -> 204'
./run.sh
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand Down
47 changes: 32 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,46 @@ Open Policy Administration Layer

OPAL is an administration layer for Policy Engines such as <a target="_blank" href="https://www.openpolicyagent.org/">Open Policy Agent (OPA)</a>, and <a target="_blank" href="https://github.com/permitio/cedar-agent">AWS' Cedar Agent</a> detecting changes to both policy and policy data in realtime and pushing live updates to your agents. OPAL brings open-policy up to the speed needed by live applications.

As your application state changes (whether it's via your APIs, DBs, git, S3 or 3rd-party SaaS services), OPAL will make sure your services are always in sync with the authorization data and policy they need (and only those they need).
As your app's data state changes (whether it's via your APIs, DBs, git, S3 or 3rd-party SaaS services), OPAL will make sure your services are always in sync with the authorization data and policy they need (and only those they need).

Check out our main site at <a target="_blank" href="https://opal.ac">OPAL.ac</a>, <a target="_blank" href="https://youtu.be/tG8jrdcc7Zo">this video</a> briefly explaining OPAL and how it works with OPA, and a deeper dive into it at [this OWASP DevSlop talk](https://www.youtube.com/watch?v=1_Iz0tRQCH4).
Check out OPAL's main site at <a target="_blank" href="https://opal.ac">OPAL.ac</a>

## Why use OPAL?
## OPAL Use Cases

OPAL is the easiest way to keep your solution's authorization layer up-to-date in realtime. It aggregates policy and data from across the field and integrates them seamlessly into the authorization layer, and is microservices and cloud-native.

## OPA + OPAL == 💜
Here are some of the main use cases for using OPAL:
* **End-to-End [Fine-Grained Authorization](https://www.permit.io/blog/what-is-fine-grained-authorization-fga) service** that can be used with any policy language or data store
* [Google-Zanzibar](https://www.permit.io/blog/what-is-google-zanzibar) support for Policy as Code engines such as OPA and AWS Cedar
* Streamline permissions in microservice architectures using [centralized policy configuration with decentralized data](https://www.permit.io/blog/best-practices-for-implementing-hybrid-cloud-security) sources and policy engines
* Manage and automate the deployment of multiple Open Policy Agent engines in a Cloud-Native environment

<img src="https://github.com/permitio/opal/assets/4082578/99d3dd95-a7ff-45c2-805e-3d533f8b1e8c" alt="simplified" border="0">

OPAL uses a client-server stateless architecture. OPAL-Servers publish policy and data updates over a lightweight (websocket) PubSub Channel, which OPAL-clients subscribe to via topics. Upon updates, each client fetches data directly (from the source) to load it into its managed Policy Engine instance.


### OPA + OPAL == 💜

While OPA (Open Policy Agent) decouples policy from code in a highly-performant and elegant way, the challenge of keeping policy agents up-to-date remains.
This is especially true in applications, where each user interaction or API call may affect access-control decisions.
OPAL runs in the background, supercharging policy-agents, keeping them in sync with events in realtime.
OPAL runs in the background, supercharging policy agents and keeping them in sync with events in real time.

## AWS Cedar + OPAL == 💪
### AWS Cedar + OPAL == 💪

Cedar is a very powerful policy language, which powers AWS' AVP (Amazon Verified Permissions) - but what if you want to enjoy the power of Cedar on another cloud, locally, or on premise?
This is where [Cedar-Agent](https://github.com/permitio/cedar-agent) and OPAL come in.

This [video](https://youtu.be/tG8jrdcc7Zo) briefly explains OPAL and how it works with OPA, and a deeper dive into it at [this OWASP DevSlop talk](https://www.youtube.com/watch?v=1_Iz0tRQCH4).

## Who's Using OPAL?
OPAL is being used as the core engine of Permit.io Authorization Service and serves in production:
* \> 10,000 policy engines deployment
* \> 100,000 policy changes and data synchronizations every day
* \> 10,000,000 authorization checks every day

Besides Permit, OPAL is being used in Production in **Tesla**, **Walmart**, **The NBA**, **Intel**, **Cisco**, **Live-Oak Bank**, and thousands of other development teams and companies of all sizes.

## Documentation

- 📃 &nbsp; [Full documentation is available here](https://docs.opal.ac)
Expand Down Expand Up @@ -104,22 +125,18 @@ curl -L https://raw.githubusercontent.com/permitio/opal/master/docker/docker-com

- 🎨 &nbsp; [Key concepts and design](https://docs.opal.ac/overview/design)
- 🏗️ &nbsp; [Architecture](https://docs.opal.ac/overview/architecture)
<be>
<br>
OPAL uses a client-server stateless architecture. OPAL-Servers publish policy and data updates over a lightweight (websocket) PubSub Channel, which OPAL-clients subscribe to via topics. Upon updates each client fetches data directly (from source) to load it in to its managed OPA instance.
<br>
<img src="https://github.com/permitio/opal/assets/4082578/99d3dd95-a7ff-45c2-805e-3d533f8b1e8c" alt="simplified" border="0">
<br>
📖 &nbsp; For further reading check out our [Blog](https://bit.ly/opal_blog).

📖 For further reading, check out our [Blog](https://io.permit.io/opal-readme-blog)

## Community

Come talk to us about OPAL, or authorization in general - we would love to hear from you ❤️
We would love to chat with you about OPAL. [Join our Slack community](https://io.permit.io/opal-readme-slack) to chat about authorization, open-source, realtime communication, tech, or anything else!

You can raise questions and ask for features to be added to the road-map in our [**Github discussions**](https://github.com/permitio/opal/discussions), report issues in [**Github issues**](https://github.com/permitio/opal/issues), follow us on Twitter to get the latest OPAL updates, and join our Slack community to chat about authorization, open-source, realtime communication, tech, or anything else!
You can raise questions and ask for features to be added to the road-map in our [**Github discussions**](https://github.com/permitio/opal/discussions), report issues in [**Github issues**](https://github.com/permitio/opal/issues)
</br>
</br>
If you are using our project, please consider giving us a ⭐️
If you like our project, please consider giving us a ⭐️
</br>

[![Button][join-slack-link]][badge-slack-link] </br> [![Button][follow-twitter-link]][badge-twitter-link]
Expand Down
51 changes: 51 additions & 0 deletions app-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# OPAL Application Tests

To fully test OPAL's core features as part of our CI flow,
We're using a bash script and a docker-compose configuration that enables most of OPAL's important features.

## How To Run Locally

### Controlling the image tag

By default, tests would run with the `latest` image tag (for both server & client).

To configure another specific version:

```bash
export OPAL_IMAGE_TAG=0.7.1
```

Or if you want to test locally built images
```bash
make docker-build-next
export OPAL_IMAGE_TAG=next
```

### Using a policy repo

To test opal's git tracking capabilities, `run.sh` uses a dedicated GitHub repo ([opal-tests-policy-repo](https://github.com/permitio/opal-tests-policy-repo)) in which it creates branches and pushes new commits.

If you're not accessible to that repo (not in `Permit.io`), Please fork our public [opal-example-policy-repo](https://github.com/permitio/opal-example-policy-repo), and override the repo URL to be used:
```bash
export [email protected]:your-org/your-repo.git
```

As `run.sh` requires push permissions, and as `opal-server` itself might need to authenticate GitHub (if your repo is private). If your GitHub ssh private key is not stored at `~/.ssh/id_rsa`, provide it using:
```bash
# Use an absolute path
export OPAL_POLICY_REPO_SSH_KEY_PATH=$(realpath ./your_github_ssh_private_key)
```


### Putting it all together

```bash
make docker-build-next # To locally build opal images
export OPAL_IMAGE_TAG=next # Otherwise would default to "latest"

export [email protected]:your-org/your-repo.git # To use your own repo for testing (if you're not an Permit.io employee yet...)
export OPAL_POLICY_REPO_SSH_KEY_PATH=$(realpath ./your_github_ssh_private_key) # If your GitHub ssh key isn't in "~.ssh/id_rsa"

cd app-tests
./run.sh
```
58 changes: 58 additions & 0 deletions app-tests/docker-compose-app-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
services:
broadcast_channel:
image: postgres:alpine
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres

opal_server:
image: permitio/opal-server:${OPAL_IMAGE_TAG:-latest}
deploy:
mode: replicated
replicas: 2
endpoint_mode: vip
environment:
- OPAL_BROADCAST_URI=postgres://postgres:postgres@broadcast_channel:5432/postgres
- UVICORN_NUM_WORKERS=4
- OPAL_POLICY_REPO_URL=${OPAL_POLICY_REPO_URL:[email protected]:permitio/opal-tests-policy-repo.git}
- OPAL_POLICY_REPO_MAIN_BRANCH=${POLICY_REPO_BRANCH}
- OPAL_POLICY_REPO_SSH_KEY=${OPAL_POLICY_REPO_SSH_KEY}
- OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[{"url":"http://opal_server:7002/policy-data","config":{"headers":{"Authorization":"Bearer ${OPAL_CLIENT_TOKEN}"}},"topics":["policy_data"],"dst_path":"/static"}]}}
- OPAL_LOG_FORMAT_INCLUDE_PID=true
- OPAL_POLICY_REPO_WEBHOOK_SECRET=xxxxx
- OPAL_POLICY_REPO_WEBHOOK_PARAMS={"secret_header_name":"x-webhook-token","secret_type":"token","secret_parsing_regex":"(.*)","event_request_key":"gitEvent","push_event_value":"git.push"}
- OPAL_AUTH_PUBLIC_KEY=${OPAL_AUTH_PUBLIC_KEY}
- OPAL_AUTH_PRIVATE_KEY=${OPAL_AUTH_PRIVATE_KEY}
- OPAL_AUTH_MASTER_TOKEN=${OPAL_AUTH_MASTER_TOKEN}
- OPAL_AUTH_JWT_AUDIENCE=https://api.opal.ac/v1/
- OPAL_AUTH_JWT_ISSUER=https://opal.ac/
- OPAL_STATISTICS_ENABLED=true
ports:
- "7002-7003:7002"
depends_on:
- broadcast_channel

opal_client:
image: permitio/opal-client:${OPAL_IMAGE_TAG:-latest}
deploy:
mode: replicated
replicas: 2
endpoint_mode: vip
environment:
- OPAL_SERVER_URL=http://opal_server:7002
- OPAL_LOG_FORMAT_INCLUDE_PID=true
- OPAL_INLINE_OPA_LOG_FORMAT=http
- OPAL_SHOULD_REPORT_ON_DATA_UPDATES=True
- OPAL_DEFAULT_UPDATE_CALLBACKS={"callbacks":[["http://opal_server:7002/data/callback_report",{"method":"post","process_data":false,"headers":{"Authorization":"Bearer ${OPAL_CLIENT_TOKEN}","content-type":"application/json"}}]]}
- OPAL_OPA_HEALTH_CHECK_POLICY_ENABLED=True
- OPAL_CLIENT_TOKEN=${OPAL_CLIENT_TOKEN}
- OPAL_AUTH_JWT_AUDIENCE=https://api.opal.ac/v1/
- OPAL_AUTH_JWT_ISSUER=https://opal.ac/
- OPAL_STATISTICS_ENABLED=true
ports:
- "7766-7767:7000"
- "8181-8182:8181"
depends_on:
- opal_server
command: sh -c "exec ./wait-for.sh opal_server:7002 --timeout=20 -- ./start.sh"
Loading