Skip to content
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

Add recipes contribution guides #63

Merged
merged 25 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
./.github/scripts/install-radius.sh $RADIUS_VERSION
- name: Publish Recipes
run: |
files_list=$(ls "local-dev")
files_list=$(ls "local-dev" | grep '\.bicep$')
for file in $files_list; do
echo "Publishing recipe: local-dev/$file"
recipeName="${file%.*}"
Expand Down
69 changes: 9 additions & 60 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,18 @@
# Contribution Guidelines

Thank you for your interest in Radius!
Thank you for your interest in Recipes! We welcome contributions from the community. Contributions come in many forms: submitting issues, writing code, participating in discussions and community calls.

This project has adopted the [Contributor Covenant Code of Conduct](https://github.com/radius-project/radius/blob/main/CODE-OF-CONDUCT.md).
This document provides the guidelines for how to contribute to the recipes repository.

Contributions come in many forms: submitting issues, writing code, participating in discussions and community calls.
## Table of Contents

This document provides the guidelines for how to contribute to the Radius project.

## Issues

This section describes the guidelines for submitting issues

### Issue Types

There are 2 types of issues:

- bug: You've found a bug with the code, and want to report it, or create an issue to track the bug.
- feature: Used for items that propose a new idea or functionality. This allows feedback from others before code is written.

> For questions or feedback please refer to the [Radius Community docs](https://docs.radapp.dev/community/). Discord will be the best way to get in touch with the community and the maintainers.

### Before You File

Before you file an issue, make sure you've checked the following:

1. Is it the right repository?
- The Radius project is distributed across multiple repositories. Check the list of [repositories](https://github.com/radius-project) if you aren't sure which repo is the correct one.
1. Check for existing issues
- Before you create a new issue, please do a search in [open issues](https://github.com/radius-project/recipes/issues) to see if the issue or feature request has already been filed.
- If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reaction-to-pull-requests-issues-and-comments). Use a reaction:
- 👍 up-vote
- 👎 down-vote
1. For bugs
- Check it's not an environment issue. For example, if running on Kubernetes, make sure prerequisites are in place.
- Ensure you have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Radius services (UCP, RP, DE). More details on how to get logs can be found [here](https://docs.radapp.dev/reference/troubleshooting-radius/).
1. For proposals
- Many changes to the Radius runtime may require changes to the API. In that case, the best place to discuss the potential feature is the main [Radius repo](https://github.com/radius-project/radius).
- Recipes runtime changes can be discussed in the [Radius repo](https://github.com/radius-project/radius).
- Community Recipes can be discussed within [this repo](https://github.com/radius-project/recipes/issues).

## Contributing to Radius Recipes

This section describes the guidelines for contributing code / docs to Radius Recipes.

### Prerequisites

Make sure you are familiar with how to author and test Recipes. The [custom Recipes docs](https://docs.radapp.io/guides/recipes/howto-author-recipes/) will walk you through the process. Make sure to test with your own registry and environment before submitting a PR.

### Pull Requests

All contributions come through pull requests. To submit a proposed change, we recommend following this workflow:

1. Make sure there's an issue (bug or feature) raised, which sets the expectations for the contribution you are about to make.
1. Fork the relevant repo and create a new branch
1. Create your change
1. Update relevant documentation for the change
1. Commit and open a PR
1. Wait for the CI process to finish and make sure all checks are green
1. A maintainer of the repo will be assigned, and you can expect a review within a few days

#### Use work-in-progress PRs for early feedback

A good way to communicate before investing too much time is to create a draft PR and share it with your reviewers. The standard way of doing this is to mark your PR as draft within GitHub.
- [Contributing to Radius Recipes](docs/contributing/contributing-recipes.md) : This guide provides an overview of how to write your own recipes and contribute to the community.
- [Contributing Issues](docs/contributing/contributing-issues.md) : This guide provides an overview of how to contribute issues to the Recipes.

## Thank You!

Your contributions to open source, large or small, make projects like this possible. Thank you for taking the time to contribute.

## Code of Conduct

Please refer to our [Radius Community Code of Conduct](https://github.com/radius-project/radius/blob/main/CODE_OF_CONDUCT.md)
50 changes: 16 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
# Radius Community Recipes

This repo contains commonly used [Recipe](https://docs.radapp.dev/recipes) templates for Radius Environments.
This repository contains commonly used [Recipe](https://docs.radapp.io/recipes) templates for Radius Environments.

## Recipes

Recipes provide self-service infrastructure provisioning for developers. Developers select the resource(s) they need, and operators can configure Recipes with secure, approved, infrastructure.
Recipes provide self-service infrastructure provisioning for developers. Developers select the resource(s) they need, and operators can configure Recipes with secure, approved, infrastructure. For more information about the supported resource types and the IaC languages, please refer to the [Recipes overview](https://docs.radapp.io/guides/recipes/overview/) page.

## Available Recipes
## Repository Structure

### local-dev
Recipes in this repository are organized by the environments and the resource types they support. Below is the structure:

The [local-dev](/local-dev) directory contains lightweight Recipes for development purposes. They run containerized infrastructure which is not persisted across restarts and is optimized for CPU and memory usage on a local machine.
- <environment> eg : aws
- <resourcetype.bicep> eg : rediscaches.bicep
- <resourcetype> eg : rediscaches
- <main.tf>
- <variables.tf>

> **Note**: These Recipes are automatically installed via `rad init`
All the available Recipes can be found in the folders below:

| Recipe | Resource | Description | Template Path |
|--------|----------|-------------|---------------|
| [`local-dev/daprpubsubbrokers`](/local-dev/pubsubbrokers.bicep) | `Applications.Dapr/pubSubBrokers` | A lightweight container running the `redis` image and a Redis Dapr Pub/Sub component for development purposes. | `ghcr.io/radius-project/recipes/local-dev/daprpubsubbrokers:TAG` |
| [`local-dev/daprstatestores`](/local-dev/statestores.bicep) | `Applications.Dapr/stateStores` |A lightweight container running the `redis` image and a Redis Dapr state store component for development purposes. | `ghcr.io/radius-project/recipes/local-dev/daprstatestores:TAG` |
| [`local-dev/extender-postgresql`](/local-dev/extender-postgresql.bicep) | `Applications.Core/extenders` |A lightweight container running the `postgres` image for development purposes. Used with the Radius extender resource. | `ghcr.io/radius-project/recipes/local-dev/extender-postgresql:TAG` |
| [`local-dev/rabbitmqmessagequeues`](/local-dev/rabbitmqmessagequeues.bicep) | `Applications.Messaging/rabbitMQQueues` |A lightweight container running the `rabbitmq` image for development purposes. | `ghcr.io/radius-project/recipes/local-dev/rabbitmqmessagequeues:TAG` |
| [`local-dev/rediscaches`](/local-dev/rediscaches.bicep) | `Applications.Datastores/redisCaches` |A lightweight container running the `redis` image for development purposes. | `ghcr.io/radius-project/recipes/local-dev/rediscaches:TAG` |
| [`local-dev/mongodatabases`](/local-dev/mongodatabases.bicep) | `Applications.Datastores/mongoDatabases` |A lightweight container running the `mongo` image for development purposes. | `ghcr.io/radius-project/recipes/local-dev/mongodatabases:TAG` |
| [`local-dev/sqldatabases`](/local-dev/sqldatabases.bicep) | `Applications.Datastores/sqlDatabases` |A lightweight container running the `azure-sql-edge` image for development purposes. | `ghcr.io/radius-project/recipes/local-dev/sqldatabases:TAG` |

### azure

The [azure](/azure) directory contains Recipes for Azure resources. They are configurable via parameters, with the default values optimizing for cost and security.

| Recipe | Resource | Description | Template Path |
|--------|----------|-------------|---------------|
| [`azure/rediscaches`](/azure/rediscaches.bicep) | `Applications.Datastores/redisCaches` | An Azure Cache for Redis resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/azure/rediscaches:TAG` |

### aws

The [aws](/aws) directory contains Recipes for AWS resources. They are configurable via parameters, with the default values optimizing for cost and security.

| Recipe | Resource | Description | Template Path |
|--------|----------|-------------|---------------|
| [`aws/rediscaches`](/aws/rediscaches.bicep) | `Applications.Datastores/redisCaches` | An AWS MemoryDB resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/aws/rediscaches:TAG` |
- [Local Dev](/local-dev)
- [Azure](/azure)
- [AWS](/aws)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we say more here? I'd like to say more about the background of how we're organizing these. If I want to contribute something, how can I figured out where it fits?

Copy link
Contributor Author

@Reshrahim Reshrahim Feb 26, 2024

Choose a reason for hiding this comment

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

added some details on the structure of the folder.


## Versioning and Tags

Expand All @@ -54,7 +36,7 @@ Patched versions of Recipes are tagged with the patch number, e.g. `0.21.1`. Whe

## Usage

To use a community recipe from this repo, simply use [`rad recipe register`](https://docs.radapp.dev/reference/cli/rad_recipe_register) with the Recipe's template path, or update your environment's Bicep definition with the Recipe:
To use a community recipe from this repo, simply use [`rad recipe register`](https://docs.radapp.io/reference/cli/rad_recipe_register) with the Recipe's template path, or update your environment's Bicep definition with the Recipe:

### CLI

Expand Down Expand Up @@ -89,9 +71,9 @@ resource myenv 'Applications.Core/environments' = {

For more information on using Recipes refer to the [Radius docs](https://docs.radapp.io/guides/recipes/overview/).

## Contributing
## How to Contribute to Recipes

We welcome contributions to this repo! Please see our [contributing guide](/CONTRIBUTING.md) for more information.
Visit the [contributions guide](CONTRIBUTING.md) to learn how to write your own Recipes and contribute to the community.

## Code of Conduct

Expand Down
13 changes: 13 additions & 0 deletions aws/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# AWS Recipes

The [aws](/aws) directory contains Recipes for AWS resources. They are configurable via parameters, with the default values optimizing for cost and security.

## Available Recipes

| Recipe | Resource | Description | Template Path |
|--------|----------|-------------|---------------|
| [`aws/rediscaches`](/aws/rediscaches.bicep) | `Applications.Datastores/redisCaches` | An AWS MemoryDB resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/aws/rediscaches:TAG` |
| [`aws/sqldatabases`](/aws/sqldatabases.bicep) | `Applications.Datastores/sqlDatabases` | An AWS RDS resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/aws/sqldatabases:TAG` |

You can also contribute your own AWS recipes for the supported resource types and IaC languages. Visit the [contributions guide](/contributing/contributing-recipes.md) to learn how to write your own recipes and contribute to the community.

29 changes: 29 additions & 0 deletions azure/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Azure recipes

The [azure](/azure) directory contains Recipes for Azure resources. They are configurable via parameters, with the default values optimizing for cost and security.

## Available Recipes

| Recipe | Resource | Description | Template Path |
|--------|----------|-------------|---------------|
| [`azure/rediscaches`](/azure/rediscaches.bicep) | `Applications.Datastores/redisCaches` | An Azure Cache for Redis resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/azure/rediscaches:TAG` |
| [`azure/sqldatabases`](/azure/sqldatabases.bicep) | `Applications.Datastores/sqlDatabases` | An Azure SQL server resource with a configurable size and SKU. | `ghcr.io/radius-project/recipes/azure/sqldatabases:TAG` |
| [`azure/statestores`](/azure/statestores.bicep) | `Applications.Dapr/stateStores` |An Azure blob storage state store. | `ghcr.io/radius-project/recipes/azure/statestores:TAG` |

You can also contribute your own Azure recipes for the supported resource types and IaC languages. Visit the [contributions guide](/contributing/contributing-recipes.md) to learn how to write your own recipes and contribute to the community.

## Tags

1. For Azure recipes, make sure to add tags to the recipe to indicate the infrastructure deployed by Recipes is created by Radius. For example:

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

@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
}
```
11 changes: 11 additions & 0 deletions azure/extender-servicebus.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ param skuTier string = 'Standard'
@description('ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.')
param defaultMessageTimeToLive string = 'P14D'

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

@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
}

resource servicebus 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = {
name: 'servicebus-namespace-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(radiusTags, tags)
sku: {
name: skuName
tier: skuTier
Expand Down
11 changes: 11 additions & 0 deletions azure/rediscaches.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,20 @@ param skuFamily string = 'C'
])
param skuName string = 'Basic'

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

@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
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this pattern be documented somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added this to the README in /azure directory

resource azureCache 'Microsoft.Cache/redis@2022-06-01' = {
name: 'cache-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
properties: {
sku: {
capacity: skuCapacity
Expand Down
12 changes: 12 additions & 0 deletions azure/sqldatabases.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ param skuName string = 'Standard'
])
param skuTier string = 'Standard'

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

@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
}

var mssqlPort = 1433

resource mssql 'Microsoft.Sql/servers@2021-02-01-preview' = {
name: '${context.resource.name}-${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
properties: {
administratorLogin: adminLogin
administratorLoginPassword: adminPassword
Expand All @@ -67,6 +78,7 @@ resource mssql 'Microsoft.Sql/servers@2021-02-01-preview' = {
resource db 'databases' = {
name: database
location: location
tags: union(tags, radiusTags)
sku: {
name: skuName
tier: skuTier
Expand Down
18 changes: 16 additions & 2 deletions azure/statestores.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,23 @@ param location string = resourceGroup().location
@description('Sets this Dapr State Store as the actor state store. Only one Dapr State Store can be set as the actor state store. Defaults to false.')
param actorStateStore bool = false

@description('The name of the container to create within the Azure storage account and to reference within the Dapr component.')
var containerName = context.resource.name

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

@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
}

resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'recipe${uniqueString(context.resource.id, resourceGroup().id)}'
location: location
tags: union(tags, radiusTags)
sku: {
name: 'Standard_ZRS'
}
Expand All @@ -35,7 +49,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'default'

resource container 'containers' = {
name: context.resource.name
name: containerName
}
}
}
Expand Down Expand Up @@ -67,7 +81,7 @@ resource daprComponent 'dapr.io/Component@v1alpha1' = {
}
{
name: 'containerName'
value: storageAccount::blob::container.name
value: containerName
}
{
name: 'actorStateStore'
Expand Down
Loading
Loading