Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b7a5ed9
Added recipe for MySQL database
andrewmatveychuk Sep 12, 2025
ab860ba
Removed platform-specific properties for better abstraction
andrewmatveychuk Sep 12, 2025
05e5dcb
Removed resource-specific properties from the documentation
andrewmatveychuk Sep 12, 2025
6f8127f
Added sample Radius application using the mySqlDatabases type
andrewmatveychuk Sep 12, 2025
4ae7a70
Moved the sample to proper location
andrewmatveychuk Sep 12, 2025
e82725d
Routes Resource Type definition (#42)
zachcasper Sep 12, 2025
3a6e7ce
Add documentation for workflow testing (#44)
sk593 Sep 12, 2025
02a732e
Removed the sample Radius application for the mySqlDatabases type
andrewmatveychuk Sep 15, 2025
6fb6817
Updated the API version to the resource contribution month
andrewmatveychuk Sep 15, 2025
f37275c
Renamed the user parameter to username
andrewmatveychuk Sep 15, 2025
acd666e
Synced parameter descriptions
andrewmatveychuk Sep 15, 2025
aae2da3
Removed the root_password property and moved from the container tag t…
andrewmatveychuk Sep 15, 2025
ab8251d
Updated type description with sample application
andrewmatveychuk Sep 15, 2025
d9a038c
Updated the recipe file name to lowercase
andrewmatveychuk Sep 15, 2025
725f339
Updated the file name to lowercase
andrewmatveychuk Sep 15, 2025
d4278c4
Updated the port property description
andrewmatveychuk Sep 15, 2025
f000827
Converted the password property to a variable instead of optional par…
andrewmatveychuk Sep 16, 2025
fe4342c
Update Data/mySqlDatabases/README.md
andrewmatveychuk Sep 17, 2025
a3dd353
Update Data/mySqlDatabases/README.md
andrewmatveychuk Sep 17, 2025
1cf69ee
Update Data/mySqlDatabases/README.md
andrewmatveychuk Sep 17, 2025
ced60b8
Updated the recipe with explicit evaluation for optional Bicep parame…
andrewmatveychuk Sep 17, 2025
ce9a7c8
Removed WordPress-specific information from the type description for …
andrewmatveychuk Sep 18, 2025
2fb0ce9
Revert "Routes Resource Type definition (#42)"
andrewmatveychuk Sep 19, 2025
a757464
Revert "Add documentation for workflow testing (#44)"
andrewmatveychuk Sep 19, 2025
b3dae08
Updated parameter validation to use Bicep safe access operator
andrewmatveychuk Sep 23, 2025
86a05cb
Updated type description
andrewmatveychuk Sep 23, 2025
1bde24b
Merge branch 'radius-project:main' into main
andrewmatveychuk Sep 24, 2025
5aa47cf
Merge branch 'radius-project:main' into main
andrewmatveychuk Sep 24, 2025
fb020ed
Merge remote-tracking branch 'upstream'
andrewmatveychuk Oct 1, 2025
098a6b9
Added MySQL recipe for Azure Database for MySQL Flexible Server
andrewmatveychuk Oct 2, 2025
9a4e8b3
Added the new optional tags property to the MySQL recipe for Kubernetes
andrewmatveychuk Oct 2, 2025
942cd93
Fixed the tag property definition in the 'Radius.Data/mySqlDatabases'…
andrewmatveychuk Oct 2, 2025
9428816
Fixed tag handling in recipes
andrewmatveychuk Oct 2, 2025
30cc774
Removed special character from MySQL default username and added valid…
andrewmatveychuk Oct 6, 2025
7611c33
Merged the new type version into existing one and added info about p…
andrewmatveychuk Oct 6, 2025
5528e86
Converted the auto-generated password variable to a parameter to over…
andrewmatveychuk Oct 6, 2025
615ec04
Removed double-referencing in the output object
andrewmatveychuk Oct 13, 2025
80e745e
Converted database to nested resource
andrewmatveychuk Oct 13, 2025
479a4c0
Updated resource API version
andrewmatveychuk Oct 13, 2025
87fe77a
Added second factor to make resource name more unique
andrewmatveychuk Oct 13, 2025
93f2ec9
Corrected formatting
andrewmatveychuk Oct 13, 2025
4c7c283
Converted type description to Markdown
andrewmatveychuk Oct 13, 2025
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
2 changes: 2 additions & 0 deletions Data/mySqlDatabases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ A list of available Recipes for this resource type, including links to the Bicep
|Platform| IaC Language| Recipe Name | Stage |
|---|---|---|---|
| Kubernetes | Bicep | kubernetes-mysql.bicep | Alpha |
| Azure | Bicep | azure-database-for-mysql.bicep | Alpha |

## Recipe Input Properties

Expand All @@ -21,6 +22,7 @@ Properties for the **Radius.Data/mySqlDatabases** resource type are provided via
- `context.properties.database`(string, optional): The name of the database. Defaults to the `application-name` if not provided.
- `context.properties.username`(string, optional): The username for connecting to the database. Defaults to the `application-name-user` if not provided.
- `context.properties.version`(string, optional): The major MySQL server version in the X.Y format. Defaults to the version `8.4` if not provided.
- `context.properties.tags`(object, optional): The user-defined tags that will be applied to the resource. Default is null.

## Recipe Output Properties

Expand Down
84 changes: 50 additions & 34 deletions Data/mySqlDatabases/mySqlDatabases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,58 @@ namespace: Radius.Data
types:
mySqlDatabases:
description: |
The Radius.Data/mySqlDatabases Resource Type deploys a MySQL database. To deploy a new MySQL database, add the mySqlDatabases resource to the application definition Bicep file.
# Radius.Data/mySqlDatabases

The **Radius.Data/mySqlDatabases** Resource Type deploys a MySQL database. To deploy a new MySQL database, add the mySqlDatabases resource to the application definition Bicep file:

```bicep
extension radius
param environment string
param environment string

resource myApplication 'Applications.Core/applications@2023-10-01-preview' = { ... }

resource database 'Radius.Data/mySqlDatabases@2025-08-01-preview' = {
name: 'database'
properties: {
application: myApplication.id
environment: environment
}
name: 'database'
properties: {
application: myApplication.id
environment: environment
}
}
```

To connect your container to the database, create a connection from the Container resource to the database as shown below.
To connect your container to the database, create a connection from the Container resource to the database as shown below:

```bicep
resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
name: 'frontend'
properties: {
application: myApplication.id
environment: environment
container: {
image: 'frontend:1.25'
ports: {
web: {
containerPort: 8080
name: 'frontend'
properties: {
application: myApplication.id
environment: environment
container: {
image: 'frontend:1.25'
ports: {
web: {
containerPort: 8080
}
}
}
connections: {
mysqldb: {
source: database.id
}
}
}
}
connections: {
mysqldb: {
source: database.id
}
}
}
}
```

The connection automatically injects environment variables into the container for all properties from the database. The environment variables are named `CONNECTION_<CONNECTION-NAME>_<PROPERTY-NAME>`. In this example, the connection name is `mysqldb` so the environment variables will be:
CONNECTION_MYSQLDB_DATABASE
CONNECTION_MYSQLDB_USERNAME
CONNECTION_MYSQLDB_PASSWORD
CONNECTION_MYSQLDB_VERSION
CONNECTION_MYSQLDB_HOST
CONNECTION_MYSQLDB_PORT

* `CONNECTION_MYSQLDB_DATABASE`
* `CONNECTION_MYSQLDB_USERNAME`
* `CONNECTION_MYSQLDB_PASSWORD`
* `CONNECTION_MYSQLDB_VERSION`
* `CONNECTION_MYSQLDB_HOST`
* `CONNECTION_MYSQLDB_PORT`

apiVersions:
'2025-08-01-preview':
Expand All @@ -62,14 +68,24 @@ types:
description: "(Optional) The Radius Application ID. `myApplication.id` for example."
database:
type: string
description: "(Optional) The name of the database."
description: "(Optional) The name of the database. Assumed to be `myApplication.name` if not specified."
username:
type: string
description: "(Optional) The username for connecting to the database."
description: "(Optional) The username for connecting to the database. Assumed to be `<myApplication.name>_user` if not specified."
version:
type: string
enum: ['5.7', '8.0', '8.4']
description: "(Optional) The major MySQL server version in the X.Y format. Assumed to be 8.4 if not specified."
description: "(Optional) The major MySQL server version in the X.Y format. Assumed to be 8.4 if not specified."
tags:
type: object
description: "(Optional) The user-defined tags that will be applied to the resource. Default is null."
additionalProperties:
type: string
description: "(Optional) Tag name."
properties:
value:
type: string
description: "(Optional) Tag value."
password:
type: string
description: "(Read-only) The password for connecting to the database."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.io/reference/context-schema/ ')
param context object

@description('Name of the MySQL database. Defaults to the application name.')
param database string = context.resource.properties.?database ?? '${context.application.name}'

@maxLength(32)
@description('MySQL username. Defaults to <application-name>_user')
param username string = context.resource.properties.?username ?? '${context.application.name}_user'

@description('The major MySQL server version in the X.Y format. Defaults to the version 8.4 if not provided.')
@allowed([
'5.7'
'8.0'
'8.4'
])
param version string = context.resource.properties.?version ?? '8.4'

@description('The user-defined tags that will be applied to the resource. Default is null.')
param tags object = context.resource.properties.?tags ?? {}

@description('The Radius specific tags that will be applied to the resource')
var radiusTags = {
'radapp.io-environment': context.environment.id
'radapp.io-application': context.application == null ? '' : context.application.id
'radapp.io-resource': context.resource.id
}

@description('Location to deploy the resources')
var location string = resourceGroup().location

@description('Unique name for the MySQL deployment and service.')
var uniqueName = 'mysql-${uniqueString(context.resource.id, resourceGroup().id)}'

@description('The port the MySQL server listens on.')
var port = 3306

@description('MySQL server root password.')
@secure()
param root_password string = uniqueString(context.resource.id, newGuid())

resource mysqlServer 'Microsoft.DBforMySQL/flexibleServers@2024-12-30' = {
name: uniqueName
location: location
tags: union(tags, radiusTags)
sku: {
name: 'Standard_B1ms'
tier: 'Burstable'
}
properties: {
createMode: 'Default'
version: (version == '8.0') ? '8.0.21' : version
administratorLogin: username
administratorLoginPassword: root_password
databasePort: port
storage: {
storageSizeGB: 32
}
network: {
publicNetworkAccess: 'Enabled'
}
}

resource mysqlDatabase 'databases' = {
name: database
properties: {
charset: 'utf8'
collation: 'utf8_general_ci'
}
}
}


output result object = {
values: {
host: mysqlServer.properties.fullyQualifiedDomainName
port: port
database: database
username: username
}
secrets: {
#disable-next-line outputs-should-not-contain-secrets
password: root_password
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ extension kubernetes with {
@description('Name of the MySQL database. Defaults to the application name.')
param database string = context.resource.properties.?database ?? '${context.application.name}'

@description('MySQL username. Defaults to <application-name>-user')
param username string = context.resource.properties.?username ?? '${context.application.name}-user'
@description('MySQL username. Defaults to <application-name>_user')
@maxLength(32)
param username string = context.resource.properties.?username ?? '${context.application.name}_user'

@description('The major MySQL server version in the X.Y format. Defaults to the version 8.4 if not provided.')
@allowed([
Expand All @@ -20,6 +21,9 @@ param username string = context.resource.properties.?username ?? '${context.appl
])
param version string = context.resource.properties.?version ?? '8.4'

@description('The user-defined tags that will be applied to the resource. Default is null.')
param tags object = context.resource.properties.?tags ?? {}

@description('Unique name for the MySQL deployment and service.')
var uniqueName = 'mysql-${uniqueString(context.resource.id)}'

Expand All @@ -38,6 +42,7 @@ var root_password string = uniqueString(context.resource.id, guid(uniqueName, 'r
resource mySql 'apps/Deployment@v1' = {
metadata: {
name: uniqueName
labels: tags
}
spec: {
selector: {
Expand Down