Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions Data/neo4jDatabases/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Radius.Data/neo4jDatabases

## Overview

The `Radius.Data/neo4jDatabases` Resource Type represents a Neo4j graph database. It is intended for application-centric usage and can also be provisioned as a shared resource in a Radius Environment.

## Recipes

| Platform | IaC | Recipe Name | Stage |
|------------|-----------|--------------------------------------|-------|
| Kubernetes | Bicep | `kubernetes-neo4j.bicep` | Alpha |

## Recipe Input Properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency across definitions, would be good to follow this format for Recipe input and output properties -https://github.com/radius-project/resource-types-contrib/blob/main/Data/mySqlDatabases/README.md


This Resource Type is in Alpha and does not expose developer-set input properties for the Recipe at this time. In future iterations, additional properties (for example, size and Neo4j-specific configuration) may be introduced.

## Recipe Output Properties

Recipes must populate the following read-only properties on the resource:

- `host` (string): DNS hostname clients use to connect.
- `port` (integer): Bolt port (typically `7687`).
- `username` (string): Username for client connections.
- `password` (string): Password for client connections.

## Notes

- The reference Kubernetes recipe is designed for development and evaluation. For production use, consider adding persistence (PVC), authentication, and backup/restore to your own recipe variant.
75 changes: 75 additions & 0 deletions Data/neo4jDatabases/neo4jDatabases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
namespace: Radius.Data
types:
neo4jDatabases:
description: |
The Radius.Data/neo4jDatabases Resource Type deploys a Neo4j graph database. To create a new Neo4j database, define an Application and Container resource in your application definition Bicep file.

extension radius
param environment string

resource myapplication 'Radius.Core/applications@2025-08-01-preview' = { ... }
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = { ... }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = { ... }

nit: repetitive


Then add a `neo4jDatabases` resource.

resource neo4j 'Radius.Data/neo4jDatabases@2025-09-11-preview' = {
name: 'neo4j'
properties: {
application: myapplication.id
environment: environment
}
}

To connect to the new Neo4j database, add a connection between the container and the new Neo4j database. The final Container resource should look similar to:

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'myContainer'
properties: {
environment: environment
application: myapplication.id
containers: { ... }
connections: {
neo4jDb: {
source: neo4j.id
}
}
}
}
Comment on lines +7 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extension radius
param environment string
resource myapplication 'Radius.Core/applications@2025-08-01-preview' = { ... }
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = { ... }
Then add a `neo4jDatabases` resource.
resource neo4j 'Radius.Data/neo4jDatabases@2025-09-11-preview' = {
name: 'neo4j'
properties: {
application: myapplication.id
environment: environment
}
}
To connect to the new Neo4j database, add a connection between the container and the new Neo4j database. The final Container resource should look similar to:
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'myContainer'
properties: {
environment: environment
application: myapplication.id
containers: { ... }
connections: {
neo4jDb: {
source: neo4j.id
}
}
}
}
```
extension radius
param environment string
resource myApplication 'Radius.Core/applications@2025-08-01-preview' = { ... }
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = { ... }
```
Then add a `neo4jDatabases` resource.
```
resource neo4j 'Radius.Data/neo4jDatabases@2025-09-11-preview' = {
name: 'neo4j'
properties: {
application: myApplication.id
environment: environment
}
}
```
To connect to the new Neo4j database, add a connection between the container and the new Neo4j database. The final Container resource should look similar to:
```
resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
name: 'myContainer'
properties: {
environment: environment
application: myApplication.id
containers: { ... }
connections: {
neo4jDb: {
source: neo4j.id
}
}
}
}
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have resource types in the Dashboard, I've formatted the developer docs as Markdown.


Within your container, your application code can obtain the host, port, username, and password values via environment variables automatically created.

CONNECTION_NEO4JDB_HOST
CONNECTION_NEO4JDB_PORT
CONNECTION_NEO4JDB_DATABASE
CONNECTION_NEO4JDB_USERNAME
CONNECTION_NEO4JDB_PASSWORD
Comment on lines +41 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONNECTION_NEO4JDB_HOST
CONNECTION_NEO4JDB_PORT
CONNECTION_NEO4JDB_DATABASE
CONNECTION_NEO4JDB_USERNAME
CONNECTION_NEO4JDB_PASSWORD
- CONNECTION_NEO4JDB_HOST
- CONNECTION_NEO4JDB_PORT
- CONNECTION_NEO4JDB_DATABASE
- CONNECTION_NEO4JDB_USERNAME
- CONNECTION_NEO4JDB_PASSWORD


apiVersions:
'2025-09-11-preview':
schema:
type: object
properties:
environment:
type: string
description: (Required) The Radius Environment ID. Typically provided by the rad CLI. The typical value is `environment`.
application:
type: string
description: (Optional) The Radius Application ID when the database is app-scoped. Omit to provision a shared database in an Environment.
host:
type: string
readOnly: true
description: (Read-only) The DNS hostname used by clients to connect to Neo4j.
port:
type: integer
readOnly: true
description: (Read-only) The Bolt protocol port used to connect to Neo4j (typically `7687`).
username:
type: string
readOnly: true
description: (Read-only) The username for connecting to Neo4j.
password:
type: string
readOnly: true
description: (Read-only) The password for connecting to Neo4j.
required:
- environment
31 changes: 31 additions & 0 deletions Data/neo4jDatabases/recipes/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kubernetes Recipe - Neo4j (Alpha)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the details in this README be added as comments within the Recipe ?

Also Outputs and Parameters sections are repetitive from the other README


This Alpha recipe deploys Neo4j to Kubernetes as an `apps/StatefulSet` with a `ReadWriteOnce` PersistentVolumeClaim and a `ClusterIP` Service exposing the Bolt port (7687). It is suitable for local development and evaluation.

Authentication is enabled via parameters. The recipe accepts a username and password and returns these in the outputs so that the corresponding resource properties can be populated in Radius.

Outputs:

- `values.host`: Internal DNS name of the Service
- `values.port`: Bolt port (7687)
- `values.username`: Username provided to the recipe
- `values.database`: Database name used by the deployment
- `secrets.password`: Password provided to the recipe

## Usage

This recipe is intended to be registered to a Radius Environment and mapped to `Radius.Data/neo4jDatabases@2025-09-11-preview`.

When a developer defines a `neo4jDatabases` resource, Radius will invoke this recipe and populate the resource outputs.

### Parameters

- `database` (string, default: resource name): Database name to configure.
- `user` (string, default: `neo4j`): Username to provision.
- `password` (secure string, default: `uniqueString(context.resource.id)`): Password to provision.
- `tag` (string, default: `community`): Tag for the `neo4j` container image.

### Notes

- This reference recipe enables persistence via a 10Gi PVC and uses a single replica StatefulSet.
- For production use, consider customizing storage class, resource requests/limits, authentication hardening, backup/restore, and service exposure.
127 changes: 127 additions & 0 deletions Data/neo4jDatabases/recipes/kubernetes/bicep/kubernetes-neo4j.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
@description('Information about what resource is calling this Recipe. Generated by Radius.')
param context object

@description('Name of the Neo4j database. Defaults to the name of the Radius resource.')
param database string = context.resource.name

@description('Neo4j username')
param user string = 'neo4j'

@description('Neo4j password')
@secure()
#disable-next-line secure-parameter-default
param password string = uniqueString(context.resource.id)

@description('Tag to pull for the neo4j container image.')
param tag string = 'community'

extension kubernetes with {
kubeConfig: ''
namespace: context.runtime.kubernetes.namespace
} as kubernetes

var uniqueName = 'neo4j-${uniqueString(context.resource.id)}'
var port = 7687

resource svc 'core/Service@v1' = {
metadata: {
name: uniqueName
labels: {
name: uniqueName
}
}
spec: {
type: 'ClusterIP'
selector: {
app: 'neo4j'
resource: context.resource.name
}
ports: [
{
port: port
}
]
}
}

resource neo4j 'apps/StatefulSet@v1' = {
metadata: {
name: uniqueName
}
spec: {
serviceName: uniqueName
replicas: 1
selector: {
matchLabels: {
app: 'neo4j'
resource: context.resource.name
}
}
template: {
metadata: {
labels: {
app: 'neo4j'
resource: context.resource.name
// Label pods with the application name so `rad run` can find the logs.
'radapp.io/application': context.application == null ? '' : context.application.name
}
}
spec: {
containers: [
{
name: 'neo4j'
image: 'neo4j:${tag}'
ports: [
{
containerPort: 7474
name: 'http'
}
{
containerPort: port
name: 'bolt'
}
]
volumeMounts: [
{
name: 'neo4j-data'
mountPath: '/data'
}
]
}
]
}
}
volumeClaimTemplates: [
{
metadata: {
name: 'neo4j-data'
}
spec: {
accessModes: ['ReadWriteOnce']
resources: {
requests: {
storage: '10Gi'
}
}
}
}
]
}
}

output result object = {
resources: [
'/planes/kubernetes/local/namespaces/${svc.metadata.namespace}/providers/core/Service/${svc.metadata.name}'
'/planes/kubernetes/local/namespaces/${neo4j.metadata.namespace}/providers/apps/Deployment/${neo4j.metadata.name}'
]
values: {
host: '${svc.metadata.name}.${svc.metadata.namespace}.svc.cluster.local'
port: port
database: database
username: user
}
secrets: {
#disable-next-line outputs-should-not-contain-secrets
password: password
}
}