Choreo Community Call 1: How to Create a Service in Choreo!
Agenda:
1. Introduction to Choreo
2. Introduction to Service Components
- What are Service components and its use cases
- Capabilities
3. Demo
- Deploy a Todo list web application
Watch the video at : https://youtube.com/live/FX06RgpNUB4
2. Agenda
● Introduction to Choreo
● Introduction to Service Components
๏ What are Service components and its use cases
๏ Capabilities
● Demo
๏ Deploy Todo list web application
● Q & A
4. Modern Cloud Native Applications
Image source: https://learn.microsoft.com/en-us/dotnet/architecture/cloud-native/introduction
5. Development to Production Process
● Getting a cloud native application from development to production is a complex process
๏ Delivery pipelines and infrastructure setup
๏ Scalability and performance
๏ Testing
๏ Security
๏ Monitoring
● You can either learn everything or ask someone else to do the complex parts
6. What is Choreo?
● Choreo is an internal developer platform that enables developers to build, deploy, manage
and monitor cloud native applications.
● Developers write their application and Choreo takes care of the rest.
7. Resource Hierarchy
● Organization: A grouping of users and resources.
๏ Each user will have their own organization and can join another organization via an invitation
๏ Billing and infrastructure resources are attached to the organization
● Project: A logical grouping of related components with associated environments.
๏ Typically represents a single application with multiple components
๏ Defines your environments (E.g. Development, Staging, Production)
● Component: A single workload in an application.
๏ Examples: Microservice, Scheduled Task
9. Choreo Component
● Manage the entire workload lifecycle from source to deployment
● Different types of components for different workloads
๏ Service: Used to deploy long running workloads such as REST and gRPC APIs.
๏ Scheduled Trigger: Used to deploy tasks that needs to be run periodically.
๏ Manual Trigger: Used to deploy tasks that only needs to be run once.
๏ REST API Proxy: Used to proxy an existing API with Choreo’s API management capabilities.
๏ Web Application: Used to deploy web applications.
10. Choreo Component
● Link your workload source code from your code hosting platform.
GitHub
Bitbucket
● Select Build Preset based on your workload
๏ Ballerina: Workloads written in the Ballerina programming language
๏ Dockerfile: Bring any workload using your own toolchain
๏ React: Specialized build preset for web applications
13. What is a Service Component?
● Allows you to build, deploy, and manage stateless workloads
● Allows exposing different API technologies like REST, GraphQL via Endpoints
๏ Replacement for previous REST and GraphQL components
● Use cases
๏ Web/Mobile app backends
๏ Internal services (microservices)
๏ Background workers (message queue consumers)
14. Service Component Capabilities
● Managed build pipeline with automated deployment from source
● Built-in test console
● Multi-environment deployment
● Multiple API technology support (via Endpoints)
● API management
● Monitoring
15. What is an Endpoint?
● An Endpoint represents an API that is exposed by a service.
● Endpoint defines how Choreo should handle the deployment and management of a specific
API.
● A single Service component can have 0 to N Endpoints with different visibility levels (Public,
Organization, and Project).
17. Adding Endpoints to a Service
● For any Service (BYOC or Ballerina), Choreo will look for a file named .choreo/endpoints.yaml
in the source directory.
๏ This defines the contract between the user and Choreo on how endpoints are deployed.
● For Ballerina services, Choreo will generate endpoints automatically (this is only for REST
APIs).
18. Sample endpoints.yaml
version: 0.1
# +required List of endpoints to create
endpoints:
# +required Unique name for the endpoint. (This name will be used when generating the managed API)
- name: Go Greeter
# +required Numeric port value that gets exposed via this endpoint
port: 9090
# +required Type of the traffic this endpoint is accepting. Example: REST, GraphQL, etc.
# Allowed values: REST, GraphQL, GRPC
type: REST
# +optional Network level visibility of this endpoint. Defaults to Project
# Accepted values: Project|Organization|Public.
networkVisibility: Public
# +optional Context (base path) of the API that is exposed via this endpoint.
# This is mandatory if the endpoint type is set to REST or GraphQL.
context: /
# +optional Path to the schema definition file. Defaults to wild card route if not provided
# This is only applicable to REST endpoint types.
# The path should be relative to the docker context.
schemaFilePath: openapi.yaml
20. Todo List App
● Use case - Deploying a web application backend
● Goals
๏ Learn source code and repository structure
๏ Create Service component from source
๏ Deploy to multiple environments
๏ Test and manage the API
๏ Configure consumer (web application)
๏ Monitor