Skip to content

Commit

Permalink
Merge pull request #489 from permitio/improve-pdp-docs
Browse files Browse the repository at this point in the history
Update PDP Docs
  • Loading branch information
gemanor authored Jan 16, 2025
2 parents 7d9aae0 + 4f9fc6b commit 96e17b9
Showing 1 changed file with 105 additions and 8 deletions.
113 changes: 105 additions & 8 deletions docs/concepts/pdp/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ Permit's PDP essentially becomes your microservice for authorization, bundling t
The PDP is easy to install via Docker image, and will ensure **zero-latency, great performance, high availability, and improved security**.
Like all of Permit's customer deployed components, the [Permit PDP is open-source](https://github.com/permitio/PDP) and is available publicly from [Docker hub](https://hub.docker.com/r/permitio/pdp-v2).

## Deploying the PDP

Permit.io supports all PDP layouts and provides the missing layers on-top of open-source PDP solutions (such as OpenPolicyAgent). These layers include policy delivery and updating, supporting data collection, application level SDKs, application level instrumentation and more.
Read about [the various layouts you can deploy the PDP with here](/how-to/deploy/overview#pdp-deployments).

There are several ways you can deploy the PDP:
## Use the PDP
There are several ways you can use the PDP for testing and enforcement:


### Managed Cloud PDP
Expand Down Expand Up @@ -112,11 +108,112 @@ permit = Permit.new(
</Tabs>

:::note
Cloud PDP is limited to RBAC policies only, with 1MB data restriction. For ABAC / ReBAC policies, you need to deploy a local PDP.
Cloud PDP is limited to RBAC policies only and has a 1MB data restriction. You need to deploy a local PDP for ABAC/ReBAC policies.

For production deployments, we recommend deploying a local PDP to minimize network latency and ensure high availability.
We recommend deploying a PDP inside your network for production deployments to minimize network latency and ensure high availability.
:::

### Run a Local PDP With Docker
You can run a PDP on your local machine as a container on [Docker Desktop](https://docs.docker.com/get-docker/). You will need this to use ABAC / ReBAC policies.

To run the PDP use the following command:

```bash
docker run -it \
-p 7766:7000 \
--env PDP_API_KEY=<your-permit-api-key> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latest
```

In your application code, use the following PDP address in the `Permit` client to perform authorization queries.

<Tabs groupId="language">
<TabItem value="python" label="Python">

```python
from permit import Permit

permit = Permit(
token="[your-api-key]",
pdp="http://localhost:7766",
)
```

</TabItem>
<TabItem value="nodejs" label="Node.js">

```typescript
import { Permit } from "permit";

const permit = new Permit({
token: "[your-api-key]",
pdp: "http://localhost:7766",
});
```
</TabItem>
<TabItem value="go" label="Go">

```go
package main

import "github.com/permitio/permit-golang/pkg/permit"
import "github.com/permitio/permit-golang/pkg/config"

func main() {
PermitConfig := config.NewConfigBuilder("[your-api-key]")
.WithPdpUrl("http://localhost:7766")
.Build()
Permit := permit.New(PermitConfig)
}
```

</TabItem>
<TabItem value="java" label="Java">

```java
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;

Permit permit = new Permit(
new PermitConfig.Builder("[your-api-key]")
.withPdpAddress("http://localhost:7766")
.build()
);
```

</TabItem>
<TabItem value="dotnet" label="DotNet">

```csharp
using Permit;

Permit permit = new Permit(
"[your-api-key]",
"http://localhost:7766"
);
```

</TabItem>
<TabItem value="ruby" label="Ruby">

```ruby
require 'permit'

permit = Permit.new(
"[your-api-key]",
"http://localhost:7766"
)
```

</TabItem>
</Tabs>


## Production Deployment Models

Permit.io supports all PDP layouts and provides the missing layers on-top of open-source PDP solutions (such as OpenPolicyAgent). These layers include policy delivery and updating, supporting data collection, application level SDKs, application level instrumentation and more.

:::info
Custom cloud PDP deployments are available to enterprise tier customers.
Those can include different regions, cloud providers, custom SSL/TLS configurations or other specifications.
Expand Down

0 comments on commit 96e17b9

Please sign in to comment.