Hi permitio team, Does PDP have recovery mechanism...
# permit-saas
b
Hi permitio team, Does PDP have recovery mechanisms when a callback has its saved status set to false
a
Hi @B22DCCN393 Nguyễn Việt Huy, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
Based on the available documentation, I don't have specific information about PDP recovery mechanisms when a callback has its saved status set to false. The documentation covers callback registration (1) , listing callbacks (2) , and unregistering callbacks (3) , but doesn't explicitly detail recovery mechanisms for callbacks with failed or false saved status. To help investigate this issue, could you provide: 1. Which Workspace / Project / Env you are using 2. What calls you are performing (as SDK code or CURL) 3. Which PDP version you are running 4. Relevant logs from your PDP This information will help our engineers investigate the callback behavior you're experiencing.
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
😮‍💨 1
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
b
I’m concerned that PDP might crash because of any synchronization error, even if it has been configured correctly
o
you can use offline mode @Ask Inkeep
a
Thanks for tagging me @Or Weis. I'll look through relevant sources and get back to you shortly.
Offline Mode is indeed a good solution for your concern about PDP stability during synchronization issues. When enabled, the PDP can operate independently even when disconnected from the Permit.io cloud. (1) (2) To enable Offline Mode, you need to configure: (1) • Set
OPAL_OFFLINE_MODE_ENABLED=true
to enable storing and loading from a backup file • The backup file is stored to
OPAL_STORE_BACKUP_PATH
(default is
/opal/backup/opa.json
) - ensure its directory is mapped to a meaningful mount point • The backup is exported on SIGTERM (on container graceful shutdown) and every
OPAL_STORE_BACKUP_INTERVAL
seconds (default is 60s) When the client successfully loads the backup, it reports being ready even if the server connection isn't established, meaning it operates in "offline mode". This ensures that authorization decisions can still be made in environments where network connectivity may be unreliable, and the PDP can retrieve its configuration and policy data once and then continue to operate autonomously. (2) Even if it needs to restart, it can update from its local data partition and resume normal operations.
To learn more, see the sources I considered: [[1] OPA Runner Parameters](https://docs.opal.ac/getting-started/running-opal/run-opal-client/opa-runner-parameters) [[2] Permit.io Launch Week - Day 5: Fine-Tuned Performance](https://www.permit.io/blog/launch-week-5-performance)
b
@Or Weis Do you plan to store them in a database in the future, and which database would be the best choice for this use case?
o
You mean the backup files? no.
b
If a project has millions of users and many relationships, I’m concerned that the data could become very large
If the PDP loses connection to the Opal server, the entire dataset may need to be pulled again from scratch to ensure consistency
o
the PDP itself is essentially your database, these backup files are essentially database snapshots. It doesn't make sense to save databases in other databases. Such snapshots are usually managed as part of your storage/ volume mounting system.
Yes, the idea is that a PDP spins up to full state from the control plane
Even with millions of objects, the data volume here should usually be just a few GB at most. You don't need, and shouldn't save all the application data into your permissions layer.
b
With your experience managing PDP, how much OPA data would a large project typically contain? And I can estimate the data size for around 1 million users, but the number of relationships could grow exponentially
o
Can you tell us a little bit about your use case, which company you work for, what project you're working on, and what are your requirements for it?
b
I would like the Permit team to have a mechanism that allows connecting directly to the database through the SDK, because some of my projects already existed before using Permit.
o
We don't have a feature like that
We have features to apply data filtering on a database, but we don't load data directly from your database for you. We do have data-fetchers, and APIs to allow you to loadt your data into Permit with ease
But you've ignored my question
👀 1
b
Yeah, I work on company projects where the parent instances are always departments, and beneath them is a graph of child instances. Therefore, if there are any mistakes in the developers’ logic, it could lead to inconsistencies, and over the years this could grow to hundreds of millions
That’s why I believe having an endpoint to verify/compare OPA data with the database is necessary
o
Most of our customers have such hierarchical setups. Data synchronization is always somewhat of a challenge, but it's usually not a significant one - especially not due to "devloeprs logic. This challenge would exist in any data replication. Whatever you decide to copy onto the control plane would be replicated exactly onto your OPA instances. You can expose the port for OPA and talk to it directly and list its data and comapre it to whatever you'd like. Though that's not something needed in most cases, and from what you described I don't think it is needed in yours either
b
You’re wrong. During development, we can run into situations like: • A project already exists but its old data hasn’t been synchronized to Permit. We can write a script to sync it to Permit, but there are many similar projects, so we end up having to recreate the script from scratch each time we want to sync. • Another case is when the initial dataset is being synchronized with Permit during development, but if a developer forgets to assign permissions or relations, they won’t know what data is missing in order to delete and test again. When the dataset grows to over 100 entries, it becomes impossible to understand what’s missing just by looking at a bunch of meaningless UUIDs. The previous solution becomes even harder because we first have to identify which instances need to be deleted before we can delete them. As a result, we end up having to create two additional scripts to support this process. That’s what I meant. If you think it’s unnecessary, that’s fine—I’ll still stick with this traditional approach in the future
If our script has a bug, we would have to create another script to clean up all the data, because if any endpoint sends incorrect data midway, it can corrupt the system
o
Wishing you all the best
✅ 1
Just as FYI
A project already exists but its old data hasn’t been synchronized to Permit. We can write a script to sync it to Permit, but there are many similar projects, so we end up having to recreate the script from scratch each time we want to sync.
This just means you don’t understand your own system and how to design its data replication - this would be a hurdle for you regardless of how you decide to implement access-control
Another case is when the initial dataset is being synchronized with Permit during development, but if a developer forgets to assign permissions or relations, they won’t know what data is missing in order to delete and test again.
Again this would be a problem in any system; though this is not a significant problem for capable engineers; data versioning, replication and system updates are not new problems - nor do they require new solutions; with Permit you can easily adjust both your policy and data.
When the dataset grows to over 100 entries, it becomes impossible to understand what’s missing just by looking at a bunch of meaningless UUIDs.
That’s where automation comes in. There’s never a need to manually review the data.
we end up having to create two additional scripts to support this process.
Instead of creating scripts you should be building CI/CD pipelines and robust systems - permit provides multiple features, including environments, CLI tools, SDKs, and Terraform to support CI/CD patterns. As I said wishing you all the best.
b
Don't dismiss this as an issue; I've reviewed your Opal source code and noticed a behavior where the PDP will pull back all data if there are any problems with the Websocket stream. That's why I'm concerned about this.
o
That's a feature, not a bug.
Key design principal of the system in fact, ensuring consistency
✅ 1
b
oke thanks