Coder Social home page Coder Social logo

samples's Introduction

Radius Samples

This repository contains the source code for quickstarts, reference apps, and tutorials for Radius.

To try out one of these samples, visit https://docs.radapp.dev

Codespace

The current repository offers a codespace setup with Radius and its dependencies installed. Try it out for free!

Open in GitHub Codespaces

Samples

Sample Description
demo The "swiss army knife" sample for Radius. Displays environment variables, networking information, Radius connections, and more.
aws A simple app to interact with AWS S3
aws-sqs A simple app to interact with AWS SQS
dapr A 2-tier app leveraging Dapr building blocks
eshop A Rad-ified version of eShop on Containers, the .NET reference app
eshop-dapr A Rad-ified version of eShop on Dapr
volumes An app to interact with mounted volumes

samples's People

Contributors

aaroncrawfis avatar amolenk avatar asilverman avatar dependabot[bot] avatar jamesmontemagno avatar jasonviviano avatar jkotalik avatar kachawla avatar lakshmimsft avatar mariohewardt avatar mhaveliwala1 avatar mishrapratikshya avatar nithyatsu avatar reshrahim avatar rynowak avatar sk593 avatar snehabandla avatar vinayada1 avatar vishwahiremat avatar willdavsmith avatar willtsai avatar ytimocin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples's Issues

Reference apps should use images we build and maintain

Today our reference apps use containers from external registries such as Docker Hub.

This causes an issue where if the external image is deleted or updated, our reference apps break.

We should:

  • Build and push external Docker containers to our registry, radius.azurecr.io
  • Update our reference app samples to use our images instead
  • Optionally create a pipeline that automatically builds and pushes the external images, so it's not done on local dev machines. We can update this pipeline anytime we want to update our dependency to a newer version.

AWS MemoryDB + Sample webapp returns errors for some API calls

When running the webapp sample, we sometimes get error when using MemoryDB:

(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

On the client side, this shows up as a 504. This failure happens some of the time when doing a request to the TODO list.

We need to get more information from the failure and figure out why it's happening.

Codespace port forwarding is fragile

Will throw 503 nginx errors

Steps to reproduce

  1. Visit https://aka.ms/ProjectRadus/Codespace
  2. Create a new codespace on the default branch
  3. Let the script complete to create a Radius environment
  4. Deploy any quickstart or the tutorial
  5. Attempt to visit the endpoint
  6. Get a 503 nginx error

Note that this only reproduces sporadically so you may need to create a couple Codespaces

AB#9826

Container App Store reference app cannot pull containers

I'm trying to run the Container App Store ref app:

cd samples/reference-apps/container-app-store

rad deploy iac/app.bicep

Deployment succeeds, but the application doesn't become healthy because containers for the Go, Node & Python app cannot be found:

stream logs failed container "goapp" in pod "store-goapp-6949977b66-bg8g4" is waiting to start: trying and failing to pull image for default/store-goapp-6949977b66-bg8g4 (goapp)

These container references all still have 0.14 as the version. May need to be updated to 0.15?

Updating sample images prior to merge isn't ideal

Before merging a change that would fix a sample, we need to repush images manually or #yolo merge.

For example, if I want to fix this sample: #102, I would need to push that image prior to merging to validate it works.

I think an easy solution which would be good for users AND a way to validate per PR is to have a script which find replaces for phrases like edge in bicep files and replaces it with the PR version or release version.

error connecting to redis at redis:6379: dial tcp: lookup redis on 10.0.0.10:53: no such host

quickstart sample deployed redis in default namespace and frontend is deployed to default-dapr-quickstart. frontend container uses only hostname instead of FQDN.

https://github.com/project-radius/samples/blob/4c1c0413ab34e288addde618346f018158cbd768/quickstarts/dapr/dapr.bicep#L112-L121

k logs backend-756f55788c-ft4gw daprd -n default-dapr-quickstart
time="2022-12-09T19:51:04.66284201Z" level=info msg="starting Dapr Runtime -- version 1.6.0 -- commit 4bb25fab444c4f1a1bf0ffd74293dbd4fdcea580" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.66289331Z" level=info msg="log level set to: info" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663027212Z" level=info msg="metrics server started on :9090/" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.metrics type=log ver=1.6.0
time="2022-12-09T19:51:04.663165614Z" level=info msg="loading default configuration" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663188914Z" level=info msg="kubernetes mode configured" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663201014Z" level=info msg="app id: backend" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663366916Z" level=info msg="mTLS enabled. creating sidecar authenticator" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663489718Z" level=info msg="trust anchors and cert chain extracted successfully" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime.security type=log ver=1.6.0
time="2022-12-09T19:51:04.663514318Z" level=info msg="authenticator created" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.663835922Z" level=info msg="Initialized name resolution to kubernetes" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.664558031Z" level=info msg="loading components" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.668992187Z" level=info msg="component loaded. name: kubernetes, type: secretstores.kubernetes/v1" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.678228003Z" level=info msg="waiting for all outstanding components to be processed" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.776967422Z" level=warning msg="error initializing state store statestore (state.redis/v1): redis store: error connecting to redis at redis:6379: dial tcp: lookup redis on 10.0.0.10:53: no such host" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.777033723Z" level=warning msg="process component error daprd process will exited, gracefully to stop" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.777054223Z" level=info msg="dapr shutting down." app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.777069923Z" level=info msg="Stopping Dapr APIs" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:04.777090023Z" level=info msg="Waiting 5s to finish outstanding operations" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:09.777295064Z" level=info msg="Shutting down all components" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0
time="2022-12-09T19:51:09.777393565Z" level=fatal msg="process component statestore error: redis store: error connecting to redis at redis:6379: dial tcp: lookup redis on 10.0.0.10:53: no such host" app_id=backend instance=backend-756f55788c-ft4gw scope=dapr.runtime type=log ver=1.6.0

Dapr Quickstart : Not able to access the public endpoint

Observed behavior
Not able to access the public endpoint .
Here are the steps followed:

  1. k3d cluster create -p "8081:80@loadbalancer" --k3s-arg "--disable=traefik@server:0"
  2. rad env init kubernetes -i --public-endpoint-override 'http://localhost:8081'
    3)rad deploy dapr.bicep
C:\Users\Vishwa\Projects\testRadius\webapp-local>rad deploy dapr.bicep
Building dapr.bicep...
Deploying Application into workspace 'k3denv'...

Deployment In Progress...

Completed            statestore      Applications.Connector/daprStateStores
Completed            frontend-route  Applications.Core/httpRoutesnvokeHttpRoutes
Completed            dapr-quickstart Applications.Core/applicationsokeHttpRoutes
Completed            backend         Applications.Core/containersnvokeHttpRoutes
Completed            backend-route   Applications.Connector/daprInvokeHttpRoutes
Completed            gateway         Applications.Core/gatewaysrs
Completed            frontend        Applications.Core/containers

Deployment Complete

Resources:
    backend-route   Applications.Connector/daprInvokeHttpRoutes
    statestore      Applications.Connector/daprStateStores
    dapr-quickstart Applications.Core/applications
    backend         Applications.Core/containers
    frontend        Applications.Core/containers
    gateway         Applications.Core/gateways
    frontend-route  Applications.Core/httpRoutes

Public Endpoints:
    gateway         Applications.Core/gateways http://localhost:8081

Not able to access the endpoint
image

dapr.bicep

import radius as radius

param location string = resourceGroup().location
param environment string

////////////////////////////////////////////////////////////////////
// Radius resources
////////////////////////////////////////////////////////////////////

resource app 'Applications.Core/applications@2022-03-15-privatepreview' = {
  name: 'dapr-quickstart'
  location: location
  properties: {
    environment: environment
  }
}

resource backend 'Applications.Core/containers@2022-03-15-privatepreview' = {
  name: 'backend'
  location: location
  properties: {
    application: app.id
    container: {
      image: 'radius.azurecr.io/quickstarts/dapr-backend:edge'
      ports: {
        web: {
          containerPort: 3000
        }
      }
    }
    connections: {
      orders: {
        source: stateStore.id
      }
    }
    extensions: [
      {
        kind: 'daprSidecar'
        provides: backendRoute.id
        appId: 'backend'
        appPort: 3000
      }
    ]
  }
}

resource backendRoute 'Applications.Connector/daprInvokeHttpRoutes@2022-03-15-privatepreview' = {
  name: 'backend-route'
  location: location
  properties: {
    environment: environment
    application: app.id
    appId: 'backend'
  }
}

resource frontend 'Applications.Core/containers@2022-03-15-privatepreview' = {
  name: 'frontend'
  location: location
  properties: {
    application: app.id
    container: {
      image: 'radius.azurecr.io/quickstarts/dapr-frontend:edge'
      ports: {
        ui: {
          containerPort: 80
          provides: frontendRoute.id
        }
      }
    }
    connections: {
      backend: {
        source: backendRoute.id
      }
    }
    extensions: [
      {
        kind: 'daprSidecar'
        appId: 'frontend'
      }
    ]
  }
}

resource frontendRoute 'Applications.Core/httpRoutes@2022-03-15-privatepreview' = {
  name: 'frontend-route'
  location: location
  properties: {
    application: app.id
  }
}

resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' = {
  name: 'gateway'
  location: location
  properties: {
    application: app.id
    routes: [
      {
        path: '/'
        destination: frontendRoute.id
      }
    ]
  }
}

resource stateStore 'Applications.Connector/daprStateStores@2022-03-15-privatepreview' = {
  name: 'statestore'
  location: location
  properties: {
    environment: environment
    application: app.id
    kind: 'generic'
    type: 'state.redis'
    version: 'v1'
    metadata: {
      redisHost: '${service.metadata.name}:${service.spec.ports[0].port}'
      redisPassword: ''
    }
  }
}

////////////////////////////////////////////////////////////////////
// Redis Kubernetes resources
////////////////////////////////////////////////////////////////////

import kubernetes as kubernetes {
  kubeConfig: ''
  namespace: 'default'
}

resource statefulset 'apps/StatefulSet@v1' = {
  metadata: {
    name: 'redis'
    labels: {
      app: 'redis'
    }
  }
  spec: {
    replicas: 1
    serviceName: service.metadata.name
    selector: {
      matchLabels: {
        app: 'redis'
      }
    }
    template: {
      metadata: {
        labels: {
          app: 'redis'
        }
      }
      spec: {
        automountServiceAccountToken: true
        terminationGracePeriodSeconds: 10
        containers: [
          {
            name: 'redis'
            image: 'redis:6.2'
            securityContext: {
              allowPrivilegeEscalation: false
            }
            ports: [
              {
                containerPort: 6379
              }
            ]
          }
        ]
      }
    }
  }
}

resource service 'core/Service@v1' = {
  metadata: {
    name: 'redis'
    labels: {
      app: 'redis'
    }
  }
  spec: {
    clusterIP: 'None'
    ports: [
      {
        port: 6379
      }
    ]
    selector: {
      app: 'redis'
    }
  }
}

Desired behavior
Should be able to access the url see UI.

OS/rad version
OS : windows
k3d cluster
RELEASE VERSION BICEP COMMIT
0.12.0-rc5 v0.12.0-rc5 0.7.19 f4a2c0c71dbb33371c3fb95641dc5d9003bc87de

Screenshots

Additional context

eShopOnContainers deploys successfully, but app is not functional

Description: eShop sample on k3d has issues.

Notes: This bicep will not run on an ARM64 Mac. (https://github.com/project-radius/radius/issues/2980)
Attempted to deploy the bicep on Codespaces before v0.13 release.
After updating Redis connectionstring to remove 'ssl=True', the deployment looks successful and homepage loads but the site is not functional.

[Eshop sample] Catalog container failing to start up

https://github.com/project-radius/samples/blob/edge/reference-apps/eshop/iac/app.bicep

Seeing this error on the web page -
Failed to load resource: http://gateway.eshop.20.84.30.181.nip.io/webshoppingapigw/c/api/v1/catalog/items?pageIndex=0&pageSize=12 the server responded with a status of 503 (Service Unavailable)

Pod status shows that the container isn't starting up

NAME READY STATUS RESTARTS AGE
basket-api-6fb96b77d5-kg5rd 1/1 Running 0 12m
catalog-api-66c5cb556c-g82tj 0/1 Error 1 12m
catalog-api-66c5cb556c-htfkb 0/1 ContainerStatusUnknown 1 (6m12s ago) 11m
catalog-api-66c5cb556c-svzs9 0/1 Pending 0 6m9s

Logs for the pod are unavailable -
% kubectl logs catalog-api-66c5cb556c-g82tj
unable to retrieve container logs for containerd://51150091e6a4da54754a356aba7627ee1d51e13ae4b04896f8e1d9dedaa8490d%

python container in container apps is crashing

Problem

  1. app.bicep use the 0.13 tag image
  2. The latest dapr package (1.8.0) version has a bug. So python container is crashed.
Digest: sha256:c45f370b8801ecd984070434eccd6ac9e7d27c0dc23989a703e9e677e3c6e9f1
Status: Downloaded newer image for radius.azurecr.io/reference-apps/container-app-python-service:edge
Traceback (most recent call last):
  File "/app/app.py", line 7, in <module>
    from dapr.clients import DaprClient
  File "/usr/local/lib/python3.9/site-packages/dapr/clients/__init__.py", line 20, in <module>
    from dapr.clients.grpc.client import DaprGrpcClient, MetadataTuple, InvokeMethodResponse
  File "/usr/local/lib/python3.9/site-packages/dapr/clients/grpc/client.py", line 40, in <module>
    from dapr.version import __version__
ModuleNotFoundError: No module named 'dapr.version'

Solution

This change set dapr pkg version to the previous version(1.7.0).

devcontainer: pre-install the az CLI in the radius devcontainer

current state
az CLI is not installed by default

$ rad env init kubernetes -i
Enter a namespace name to deploy apps into [default]: 
Using default as namespace name
Error: Invoking Azure CLI failed with the following error: exec: "az": executable file not found in $PATH

user impact
The devcontainer inits a radius env during startup, but since the az CLI isn't installed, users can't init other envs (and can't deploy to Azure)

desired state
Users should be able to start using all of the radius CLI commands - including deploying to Azure (even if the az CLI isn't required for non-Azure deployments).

samples repo SHA
8c72072

swap out the first-run-notice in Radius devcontainer

non-blocking feature :)

current state
image
which is slightly incorrect since we're not giving users the default image.

possible state
We can have a customized Radius welcome message.

resources:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.