Deploy an Application with Build Presets¶
Using Choreo, you can easily deploy applications written in different language frameworks (such as Java, Go, NodeJS, Python, Ruby, PHP, etc.) on shared or private data planes.
Choreo supports deploying applications with build presets for the following component types:
- Service
- Web Application
- Scheduled Task
- Manual Task
- Webhook
- Event Handler
- Test Runner
Build Presets¶
Build presets are a fundamental building block in modern application development. They convert your source code into a secure, efficient, production-ready container image without a Dockerfile. With Choreo, developers can take advantage of this powerful tool to effortlessly deploy their applications without the hassle of manual configuration.
Choreo uses Google Buildpacks as default build presets for Java, Go, NodeJS, Python, PHP, and Ruby. Choreo uses its own build presets for Ballerina and WSO2 MI.
Develop a component¶
To develop a service component that exposes a Service in Go, you can follow the Develop a Service guide.
Follow the guidelines below based on your language:
Supported Versions - 3.10.x, 3.11.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Reading Books List Service |
| Manual Task | Hello World Task |
For more examples, see Choreo samples.
Info
In Python projects, it is mandatory to provide a Run Command when creating a component.
Here are some example run commands for an application:
e.g.,
- python main.py
- gunicorn --bind :8080 --workers 1 --threads 8 --timeout 0 main:app
- flask run --host=0.0.0.0
Supported Versions - 2201.3.5, 2201.4.1, 2201.5.0, 2201.5.1, 201.6.0, 2201.7.0
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Echo Service |
| Manual Task | Covid19 Statistics To Email |
| Webhook | Salesforce New Case To Google Sheet |
| Scheduled Task | Shopify New Customers to HubSpot Create/Update Contact |
For more examples, see Choreo samples.
Supported Versions - 1.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Greeting Service |
| Manual Task | Hello World Task |
| Web Application | Hello World Web Application |
For more examples, see Choreo samples.
Supported Versions - 6.x, 7.x, 8.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Greeting Service |
For more examples, see Choreo samples.
Supported Versions - 8, 11, 17, 18 (OpenJDK Runtime Environment Temurin)
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Product Management Service |
| Manual Task | Hello World Task |
Info
When working on Java projects:
- The
Mainclass should be defined in the manifest file. - If Maven files such as
mvn.cmdexist in the project without the.mvndirectory, the build will fail. To ensure a successful build, you must either commit the.mvndirectory along with any Maven files or not include any Maven files in the project if you choose not to commit the.mvndirectory.
For more examples, see Choreo samples.
Supported Versions - 12.x.x, 14.x.x, 16.x.x, 18.x.x, 20.x.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Reading Books List Service |
| Manual Task | Hello World Task |
For more examples, see Choreo samples.
Supported Versions - 8.1.x, 8.2.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Hello World Service |
| Manual Task | Hello World Task |
| Web Application | Hello World Web Application |
For more examples, see Choreo samples.
Supported Versions - 3.1.x, 3.2.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Hello World Service |
| Manual Task | Hello World Task |
| Web Application | Hello World Web Application |
For more examples, see Choreo samples.
Supported Versions - 4.1.0.x, 4.2.0.x
Refer below examples for different component types. Follow the readme.md inside the example.
| Component Type | Example |
|---|---|
| Service | Hello World Service |
For more examples, see Choreo samples.
Supported Java Versions - 8, 11, 17, 18 (OpenJDK Runtime Environment Temurin)
Info
You can use this build preset only with web applications. For other component types, use the Java build preset. Additionally, if the generated artifact is a WAR file, you must include the run command in the Build Configurations editor on the component's Build page.
e.g.,
java -jar target/sample.war
Configure build-time environment variables¶
You can configure the environment variables necessary to build the component using the Build Configurations Editor on the component Build page.
During the build process, the build-time environment variables and their values are passed to the build preset. Therefore, you can configure both build preset-specific environment variables and those required for the component build.
For example, if you want to override the Maven command of the Java build presets, you can use GOOGLE_MAVEN_BUILD_ARGS as the environment key and clean install as the value.
For more examples, see Google Cloud's buildpacks documentation.
Customize the Default Run Command¶
You can configure the run command required to start the component via the Build Configurations editor on the component's Build page. This overrides the default run command provided by the build preset. After configuring the run command, you must rebuild the component for the changes to take effect.
e.g.,
- java -jar target/sample.jar
- node app.js
- php -S 0.0.0.0:8000 index.php