-
Notifications
You must be signed in to change notification settings - Fork 178
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
[master]Add Ballerina Deployment Guide #9660
base: master
Are you sure you want to change the base?
Conversation
swan-lake/development-tutorials/deployment-guide/k8s-deployment.md
Outdated
Show resolved
Hide resolved
Talked about this with @lnash94 |
Please note that the VM CD task will be added after completing the flow testing. Therefore, we will resume this work once the MI release is completed. :) |
|
||
Use the `bal build` command to build the Ballerina package. This will generate Kubernetes YAML files and Docker container artifacts. | ||
|
||
>**Note:** For macOS users with Apple Silicon chips, it is necessary to set the environment variable DOCKER_DEFAULT_PLATFORM to linux/amd64 before building the image. This requirement exists because the Ballerina Docker image does not currently support Apple Silicon chips. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>**Note:** For macOS users with Apple Silicon chips, it is necessary to set the environment variable DOCKER_DEFAULT_PLATFORM to linux/amd64 before building the image. This requirement exists because the Ballerina Docker image does not currently support Apple Silicon chips. | |
>**Note:** For macOS users with Apple Silicon chips, it is necessary to set the environment variable `DOCKER_DEFAULT_PLATFORM` to `linux/amd64` before building the image. This requirement exists because the Ballerina Docker image does not currently support Apple Silicon chips. |
- **Step 06:** Deploy the application to a Kubernetes cluster by applying the Kubernetes YAML configuration files generated by the Ballerina build in Step 2. | ||
>**Note:** Replace <path to generated artifacts> with the actual path to the Kubernetes YAML files generated by the Ballerina build command (e.g., target/kubernetes). | ||
|
||
See [Code to Cloud deployment](https://ballerina.io/learn/code-to-cloud-deployment/) for more information on deployment options in Kubernetes and Docker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to have https://ballerina.io/learn/code-to-cloud-deployment/ pages as well after these changes?
|
||
For more reference, | ||
- See [AWS Lambda](https://ballerina.io/learn/aws-lambda/) for more information. | ||
- See [Azure Functions](https://ballerina.io/learn/azure-functions/) for information about deployment options that can be used in Azure Functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to have above two pages in the learn section after these changes? If so what is the landing page location? And how do we handle the information loss (i.e. I see more information on those pages like supported triggers etc)
3. Install any other dependencies your Ballerina service might need (e.g., database drivers, libraries). | ||
|
||
4. Write Ballerina code. | ||
**service.bal** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Ensure the server meets the hardware requirements for your application (CPU, memory, disk space, etc.). | ||
- Configure the server OS (Linux is recommended for production). | ||
|
||
2. Install the Ballerina distribution from [the Ballerina Installation options.](https://ballerina.io/downloads/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Install the Ballerina distribution from [the Ballerina Installation options.](https://ballerina.io/downloads/) | |
2. Install [Ballerina](https://ballerina.io/downloads/). |
> **Tip:** you can access your service locally via `kubectl port-forward` | ||
`$ kubectl port-forward svc/hello-k8s-svc 8081:8080` | ||
|
||
Test the service using curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test the service using curl | |
Test the service using cURL. |
|
||
1. Create a new Ballerina package. | ||
|
||
$ bal new hello_k8s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ``` for code segment?
hello-k8s-svc-local NodePort 10.99.245.41 <none> 9090:30342/TCP,9091:30515/TCP 66s | ||
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 130m | ||
``` | ||
- Execute the curl http://192.168.49.2:30342/helloWorld/greeting command to access the deployed service via cURL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Execute the curl http://192.168.49.2:30342/helloWorld/greeting command to access the deployed service via cURL. | |
- Execute the following command to access the deployed service via cURL. |
@@ -0,0 +1,354 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sm1990 Sometimes I am getting the following error when trying to render this page locally. Any idea?
![image](https://private-user-images.githubusercontent.com/16300038/409753136-30d818ed-a18b-4323-b6a0-ed8f8be9f1be.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTAyNDMsIm5iZiI6MTczOTE4OTk0MywicGF0aCI6Ii8xNjMwMDAzOC80MDk3NTMxMzYtMzBkODE4ZWQtYTE4Yi00MzIzLWI2YTAtZWQ4ZjhiZTlmMWJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDEyMTkwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVhNGRlYjhiNzFmODMyOGIyNmZlYzA1MDA4OTU4YjMxMTliY2MwZTE5Yzk0NDFlYjQ0YmQ3ZTYyZTg1NjIxMTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3zZE0d7KbRNEhhsUbeWp6bpU6d9Jc07jH1rqN--eTb0)
kubectl apply -f <path to generated artifacts> | ||
``` | ||
The push event can initiate a workflow to the deployment process to the Kubernetes cluster. | ||
- **Step 02:** This step builds the Ballerina project, compiling the source code and preparing the necessary artifacts for deployment in Kubernetes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the step 1?
} | ||
``` | ||
|
||
3. Use `bal build` for generating the AWS Lambda artifacts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Use `bal build` for generating the AWS Lambda artifacts. | |
3. Use `bal build` to generate the AWS Lambda artifacts. |
$ bal build --cloud="aws_lambda" | ||
``` | ||
|
||
4. Execute the AWS CLI command to deploy the function, here it creates and publishes the functions by replacing the respective AWS, $LAMBDA_ROLE_ARN, $REGION_ID, and $FUNCTION_NAME values given in the command with your values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider rewriting the sentence to avoid , here
|
||
This example demonstrates how to write a simple echo function in Azure Functions using Ballerina, where triggers | ||
are represented by listeners attaching an `af:HttpListener` to a service that implies an HTTP trigger. | ||
The resource method behaves like a `ballerina/http` service, In the provided code sample, there's an empty service path and a resource path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we starting a new sentence from In the
?
|
||
1. Set up the prerequisites by following [these instructions.](https://ballerina.io/learn/azure-functions/#set-up-the-prerequisites) | ||
|
||
2. Here is an example Ballerina code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Here is an example Ballerina code. | |
2. Here is an sample Ballerina code. |
@lnash94 Can you please schedule a meeting to discuss the above points? Specially the current code to cloud page positioning etc. |
| Ballerina Swan Lake version | Compatible Java version | | ||
|-----------------------------------------------------------------------------------------|-------------------------| | ||
| Ballerina Swan Lake (2201.0.0) up to Ballerina Swan Lake Update 7 (2201.7.0) | JDK Temurin 11 | | ||
| Ballerina Swan Lake Update 8 (2201.8.0) up to Ballerina Swan Lake Update 10 (2201.10.0) | JDK Temurin 17.0.7 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we remove the specific versions JDK Temurin 17.0.7
-> JDK Temurin 17.x
?
> **Tip:** You can build the GraalVM executable in Kubernetes. | ||
> | ||
> GraalVM enhances Kubernetes deployments of Ballerina applications by enabling faster startup times and reduced memory usage. These advantages make it ideal for microservices workloads that demand rapid scaling and minimal resource consumption in a containerized environment. GraalVM’s native image feature uses ahead-of-time compilation, producing lightweight containers and improving Kubernetes deployment efficiency. The GraalVM build is best suited for deployments that prioritize fast scaling and reduced resource usage, while the standard JVM build is more appropriate for services that do not require such optimizations. | ||
> Execute the command below to build a Ballerina package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a line saying the build time will be higher for Graal VM builds.
Purpose
Address all the review suggestion in here : #9621
Checklist
Page addition
permalink
to pages.Page removal
redirect_from
on the alternative page.redirections.js
file.Page rename
redirect_from
.redirect_to:
(if applicable).Page restrcuture
permalink
to pages.redirect_from
.redirect_to:
(if applicable).