Choreo Sample REST API - Pet Store
Use the following commands to create BYOI component
- Select Create Component with
Service
type.
- Provide component name and description.
- Select
Deploy an image from a Container Registry
as the source.
- Select
Pet Store
tile and create component.
Use the following endpoint configuration when creating when creating endpoints for the component:
Use the following configuration when creating this component in Choreo:
- Build Preset: Dockerfile
- Dockerfile Path:
bring-your-own-image-components/services/pet-store/Dockerfile
- Docker Context Path:
bring-your-own-image-components/services/pet-store
The endpoints.yaml file contains the endpoint configurations that are used by the Choreo to expose the service.
Run the service locally
go run main.go
Generate API definitions
Generated using Go annotations https://github.com/swaggo/swag
- Download swag CLI tool by running:
go install github.com/swaggo/swag/cmd/swag@v1.8.11
- Run the following command to generate the API definitions:
swag fmt && swag init
Service Configurations (optional)
Refer config.go file for the available configurations.
For more information on how to configure a service in Choreo, refer Manage Configurations and Secrets documentation.
Load initial data ( optional )
- Set environment variable by navigating to Choreo Deploy page
INIT_DATA_PATH=configs/initial_data.json
- Mount the file contents of
configs/initial_data.json
in the path specified in step 1.
See initial_data.json for a sample file.