-
Notifications
You must be signed in to change notification settings - Fork 11
Neo4J Database resource type #45
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
Closed
superbeeny
wants to merge
10
commits into
radius-project:main
from
superbeeny:superbeeny/neo4j-resource-type
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f6bf9cc
docs(neo4jDatabases): align docs with updated schema and Kubernetes B…
superbeeny 3239552
docs(Data/neo4jDatabases): apply PR review feedback\n\n- Remove capab…
superbeeny 853650f
Routes Resource Type definition (#42)
zachcasper ad48148
Add documentation for workflow testing (#44)
sk593 4e0ec6a
Bump the github-actions group with 2 updates (#49)
dependabot[bot] 38b3c7b
Add on-call to codeowners file (#48)
brooke-hamilton 62e077c
Added the Radius.Data/mySqlDatabases resource type (#46)
andrewmatveychuk ab83580
PR template (#38)
brooke-hamilton 57f2fa2
Small changes to developer documentation (#55)
zachcasper adcfb75
Add contributors graphic to README (#54)
willtsai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # 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 | ||
|
|
||
| Developers set the following properties in the resource definition when authoring applications: | ||
|
|
||
| - `environment` (string, required): The Environment ID. | ||
| - `application` (string, optional): Application ID when the DB is app-scoped. | ||
|
|
||
| ## 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| namespace: Radius.Data | ||
| types: | ||
| neo4jDatabases: | ||
| capabilities: ["SupportsRecipes"] | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: | | ||
| The Radius.Data/neo4jDatabases Resource Type adds a Neo4j graph database to an application. | ||
|
|
||
| Example usage in an application Bicep file: | ||
|
|
||
| resource neo4j 'Radius.Data/neo4jDatabases@2025-09-11-preview' = { | ||
| name: 'neo4j' | ||
| properties: { | ||
| environment: environment | ||
| // application: myApp.id // Optional: include when bound to an app | ||
| } | ||
| } | ||
|
|
||
| Then add a connection from a Container (or other resource) to the Neo4j resource as needed. | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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. | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| port: | ||
| type: integer | ||
| readOnly: true | ||
| description: (Read Only) The Bolt protocol port used to connect to Neo4j (typically `7687`). | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| username: | ||
| type: string | ||
| readOnly: true | ||
| description: (Read Only) The username for connecting to Neo4j. | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| password: | ||
| type: string | ||
| readOnly: true | ||
| description: (Read Only) The password for connecting to Neo4j. | ||
superbeeny marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| required: | ||
| - environment | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Kubernetes Recipe - Neo4j (Alpha) | ||
|
|
||
| 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
127
Data/neo4jDatabases/recipes/kubernetes/bicep/kubernetes-neo4j.bicep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.