I have been looking through the good OPAL docs and...
# opal
b
I have been looking through the good OPAL docs and examples to get an overview of OPAL's features 👍 • Is it correct that for using OPAL scopes, the OPAL server needs to have access to a Redis and cannot use a Postgres instead? • I would like the OPAL client to get policies from multiple Git repositories and provide them to the internal OPA. Is it correct that this is not possible? ◦ I found that a scope can only be associated with a single Git repo, and an OPAL client can only request a single scope.
a
Hi @bdjgs, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Let me address your questions about OPAL scopes and multiple Git repositories: Redis vs Postgres for OPAL Scopes OPAL actually supports ​*both*​ Redis and Postgres (along with Kafka) for the backbone pub/sub, not just Redis. (1) The OPAL server scales with other server instances via a configurable backbone pub/sub that currently supports Postgres, Redis, and Kafka. You can configure this using the
OPAL_BROADCAST_URI
environment variable, for example: (2)
Copy code
export OPAL_BROADCAST_URI=postgres://postgres:postgres@localhost:5432/postgres
Multiple Git Repositories for a Single OPAL Client You're correct that there are limitations here. Each scope contains its own policy and data sources from a single Git repository. (3) An OPAL client subscribes to specific directories within a policy repository, but this is within a single tracked branch of one repository. (4) However, there are alternative approaches mentioned in the documentation: 1. ​*OPAL Scopes*​: While each scope is associated with a single Git repo, you can use scopes to serve different policies to different clients. (3) (5) This is described as "a classic setup for larger deployments, allowing each service to have its dedicated OPAL Client, with its OPA and Policy Repo, managed independently by the relevant team." (5) 2. ​*Git Submodules*​: According to a GitHub discussion, OPAL doesn't currently support Git submodules for pulling multiple repos into one. The submodules would appear as empty folders. The recommended approach for multiple policy repositories is to use OPAL Scopes with separate clients for each repository, rather than having a single client pull from multiple repositories.
To learn more, see the sources I considered: [[1] Architecture 🏗️](https://docs.opal.ac/overview/architecture) [[2] OPAL Configuration Guide | OPAL](https://docs.opal.ac/getting-started/configuration) [[3] OPAL Scopes](https://docs.opal.ac/overview/scopes) [[4] Track a Git Repo | OPAL](https://docs.opal.ac/tutorials/track_a_git_repo) [[5] OPAL SERVER HANDLING GIT SUBMODULES](https://github.com/permitio/opal/discussions/772)
a
Hey @bdjgs , Does the AI’s answer make sense?
b
Thanks for the quick response Alon 👍 I have been chatting a bit with the AI on the side. However, in that chat we concluded that Redis was neccesary. I also found this in the scope example: https://github.com/permitio/opal/blob/master/docker/docker-compose-scopes-example.yml#L18 And it looks like in the OPAL server logs upon booting, that it always tries to reach out to a Redis:
Copy code
opal_server_1        | 2025-09-10 07:37:07.458 | DEBUG    | opal_server.redis_utils:__init__:13 - Connecting to Redis
And for the second question, it seems to agree, that it is not possible to make the OPAL client fetch policies from multiple Git repos and provide them all to the interal OPA.
d
Hey @bdjgs, 1. Yes, the OPAL Scopes feature uses Redis specifically for storing the scopes state shared across all OPAL Servers. 2. You cannot synchronize multiple git repositories into a single OPAL Client / OPA, as OPAL cannot know how to merge the correctly. As the AI suggested, you can use Git Submodules and let Git manage the repo merge for you. Hope that makes sense 🙂 Let me know if you have further questions
b
Thanks for the clarification Dan, it makes sense 👍
Hey Dan, got a follow up question, I hope you can answer 🤞 We are currently using Styra and in this setup, teams have their own policy in their own repos. Then a centralized team has developed from Rego libraries located in another repo. The teams' policies use these Rego libraries. Therefore, in the current setup, the teams' Rego files and the Rego files for the libraries are stored in the same bundle. How would you achieve this using OPAL? As I see it from https://github.com/permitio/opal/discussions/772 OPAL does not support submodules. How do you suggest to handle this setup in OPAL and what do other do? Do they have a mono repo with all teams' policy and libraries?
d
Hey @bdjgs, thank you for the details. I've looked into that, and you are correct with that. At the moment, OPAL simply does a Git clone to sync the policy repo. By default, it does not clone the submodules as well, and they may remain empty. Adding that would probably require adding a flag to the git clone command in git fetcher. We would much appreciate it if you contributed that feature and will gladly guide you in planning and developing it 🙏 https://github.com/permitio/opal/blob/master/packages%2Fopal-server%2Fopal_server%2Fgit_fetcher.py#L218 Let me know what you think 🙂
b
Currently I am just in the phase of researching alternatives to Styra and seeing how we could migrate to them. For now, I will just conclude that OPAL doesn't directly support our current setup. So unfortunately I will not make a contribution. But once again, thanks for taking your time to answer my questions, appreciate it 👍
o
I'm sorry to hear your decision here, I think the Git approach suggested is far superior to what you've been doing, taking advantage of the inherit benefits of Git. You might want to consider Permit.io instead of just OPAL which includes additional shared policy capabilities including environment management with copy commands and native Terraform support
👍 1
For clarity sake, we can also add this feature to OPAL if this is the blocker for you.
b
That sounds good 👍 At the moment we have looked at OCP (OPA Control Plane) and I think we are most interested in seeing if it satisfies our needs. If not, we will circle back to OPAL.
o
Alright. BTW if you really have your heart set on using bundles. You can use bundles in OPAL as well, https://opal.ac/tutorials/track_an_api_bundle_server
👍 1