Skip to content

Commit

Permalink
Update the deployment guide with links
Browse files Browse the repository at this point in the history
  • Loading branch information
lnash94 committed Dec 3, 2024
1 parent 18e1edd commit 6688618
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 26 deletions.
9 changes: 9 additions & 0 deletions components/learn/boxes/Boxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,15 @@ export default function Boxes(props) {
<p className={styles.description}>Write AWS Lambda-compatible packages.</p>
</div>

<div className={styles.content}>
<p className={styles.title}>
<a href={`${prefix}/learn/deployment-guide/ballerina-deployment-guidelines`} className={styles.titleLink}>
Ballerina deployment guide
</a>
</p>
<p className={styles.description}>Guidelines for Ballerina deployment in production.</p>
</div>

</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ const nextConfig = {
source: `/${redirectBase}learn/aws-lambda`,
destination: `/${redirectBase}learn/development-tutorials/run-in-the-cloud/aws-lambda`,
},
{
source: `/${redirectBase}learn/deployment-guide/:slug`,
destination: `/${redirectBase}learn/development-tutorials/run-in-the-cloud/deployment-guide/:slug`,
},
{
source: `/${redirectBase}learn/test-ballerina-code/:slug`,
destination: `/${redirectBase}learn/development-tutorials/test-document-the-code/test-ballerina-code/:slug`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
---
layout: ballerina-cloud-left-nav-pages-swanlake
title: Ballerina Production Deployment Guidelines
title: Ballerina production deployment guidelines
description: This guideline is intended to provide a comprehensive overview of best practices and considerations when deploying Ballerina in a production environment. It covers deployment patterns, recommended configurations, Java compatibility, and security hardening tips to ensure your Ballerina applications run efficiently and securely.
keywords: ballerina, programming language, services, cloud, kubernetes, docker
permalink: /learn/run-ballerina-programs-in-the-cloud/code-to-cloud-deployment/
active: code-to-cloud-deployment
active: ballerina-deployment-guidelines
intro: This guideline is intended to provide a comprehensive overview of best practices and considerations when deploying Ballerina in a production environment. It covers deployment patterns, recommended configurations, Java compatibility, and security hardening tips to ensure your Ballerina applications run efficiently and securely.
---

## Introduction
When deploying Ballerina applications in production, you can choose from several deployment types depending on your needs.
Each option balances flexibility, control, and operational overhead based on your specific deployment types:

1. Virtual Machines or Bare Metal: Provides full control over the infrastructure, making it suitable for high-performance or legacy systems requiring custom configurations or direct hardware access.
2. Kubernetes/Docker: Ideal for containerized, cloud-native microservices, offering scalability and orchestration with Ballerina’s built-in support for Kubernetes and Docker artifacts.
3. Serverless: Suitable for event-driven, cost-critical applications, where cloud providers manage the infrastructure, such as AWS Lambda.
1. [Virtual Machines or Bare Metal](/learn/deployment-guide/ballerina-virtual-machine-deployment-guide): Provides full control over the infrastructure, making it suitable for high-performance or legacy systems requiring custom configurations or direct hardware access.
2. [Kubernetes/Docker](/learn/deployment-guide/ballerina-k8s-deployment-guide): Ideal for containerized, cloud-native microservices, offering scalability and orchestration with Ballerina’s built-in support for Kubernetes and Docker artifacts.
3. [Serverless](/learn/deployment-guide/ballerina-serverless-deployment-guide): Suitable for event-driven, cost-critical applications, where cloud providers manage the infrastructure, such as AWS Lambda.

## Compatible Java Versions
## Compatible Java versions

The Ballerina distribution always includes the JDK, the supported Java versions can be found in the table below,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
---
layout: ballerina-cloud-left-nav-pages-swanlake
title: Ballerina Kubernetes Deployment Guide
title: Kubernetes deployment guide
description: When deploying Ballerina services in a Kubernetes environment, it is essential to focus on high availability and scalability. Key considerations include determining the appropriate number of worker nodes and replicas. These decisions help scale the deployment and ensure that the system remains available and responsive under load.
keywords: ballerina, programming language, services, cloud, kubernetes, docker
permalink: /learn/run-ballerina-programs-in-the-cloud/code-to-cloud-deployment/
active: code-to-cloud-deployment
active: ballerina-deployment-guideLines
intro: When deploying Ballerina services in a Kubernetes environment, it is essential to focus on high availability and scalability. Key considerations include determining the appropriate number of worker nodes and replicas. These decisions help scale the deployment and ensure that the system remains available and responsive under load.
---

## Simple Application Deployment in Kubernetes
## Simple application deployment in Kubernetes

Ballerina simplifies Kubernetes artifact generation by deriving configurations directly from your code, which allows developers to focus on business logic while automating containerization and Kubernetes deployment. Below is a guide to deploying Ballerina applications in Kubernetes using Ballerina’s Code to Cloud capabilities.

### Ballerina Application Code
### Ballerina application code
Here is an example of a Ballerina service that serves a simple "Hello from Kubernetes!" message on an HTTP request:
```ballerina
import ballerina/http;
Expand All @@ -33,7 +32,7 @@ generates the Kubernetes deployment artifacts.
> **Note:** If you are using Ballerina cache in a Kubernetes environment, note that the cache is local to each pod.
> Consider using a Redis server to manage the cache if your application requires a distributed caching solution.
### Overriding Default Kubernetes Configurations
### Overriding default Kubernetes configurations
Create a `Cloud.toml` file in the project directory to customize the deployment parameters. This file will allow you to override the compiler's default values.

**Sample Cloud.toml**
Expand All @@ -47,7 +46,7 @@ tag="v0.1.0" # Tag of the container. Default Value: "latest"
See [Ballerina Code to Cloud Specification](https://github.com/ballerina-platform/ballerina-spec/blob/master/c2c/code-to-cloud-spec.md#containerimage) for more information.


### Building the Kubernetes Artifacts
### Building the Kubernetes artifacts

Use the bal build command to build the Ballerina package. This will generate Kubernetes YAML files and Docker container artifacts:
>**Note:** macOS users with Apple Silicon chips need to set an environment variable named `DOCKER_DEFAULT_PLATFORM` to `linux/amd64`, before building the image. This is because the Ballerina Docker image is not supported on Apple Silicon chips yet.
Expand Down Expand Up @@ -80,7 +79,7 @@ Generating artifacts...
Once the build is complete, Ballerina generates the Kubernetes artifacts, including the Service, Deployment, HorizontalPodAutoscaler, and Docker image configuration.
The artifacts are located in `target/kubernetes/hello`.
### Deploying the Application to Kubernetes
### Deploying the application to Kubernetes
Push the Docker image to Docker Hub:
```
Expand Down Expand Up @@ -122,7 +121,7 @@ Test the service using curl
$ curl http://<EXTERNAL-IP>:<NODE-PORT>/helloWorld/sayHello
```

## Kubernetes Deployment With Config Maps and Autoscaling
## Kubernetes deployment with config maps and autoscaling

For a more complex deployment, this demonstrates a Ballerina app that reads a greeting from a config map and responds to HTTP requests. It covers Kubernetes deployment with resource limits, autoscaling, config maps, and health probes using Code to Cloud.

Expand Down Expand Up @@ -274,7 +273,7 @@ See [Build the GraalVM executable in a container](https://ballerina.io/learn/bui
- [Deploy Ballerina on Kubernetes](https://ballerina.io/learn/deploy-ballerina-on-kubernetes/)
- [Kubernetes - Hello world](https://ballerina.io/learn/by-example/kubernetes-hello-world/)
## Ballerina Deployment with Kubernetes Kustomize
## Ballerina deployment with Kubernetes Kustomize
[Kustomize](https://kustomize.io/) is a tool that allows you to modify Kubernetes YAML files without altering
the original files. It can enhance the generated YAML from code-to-cloud deployments by applying additional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
layout: ballerina-cloud-left-nav-pages-swanlake
title: Ballerina Serverless Deployment Guide
title: Serverless deployment guide
description: Serverless architecture allows developers to focus on writing application logic without worrying about managing servers or infrastructure. AWS Lambda automatically handles provisioning, scaling, and maintaining resources, letting you concentrate solely on your code. Following are the Ballerina functions in a serverless environment,
keywords: ballerina, programming language, services, cloud, kubernetes, docker
permalink: /learn/run-ballerina-programs-in-the-cloud/code-to-cloud-deployment/
active: code-to-cloud-deployment
active: ballerina-deployment-guideLines
intro: Serverless architecture allows developers to focus on writing application logic without worrying about managing servers or infrastructure. AWS Lambda automatically handles provisioning, scaling, and maintaining resources, letting you concentrate solely on your code. Following are the Ballerina functions in a serverless environment,
---

Expand Down Expand Up @@ -65,9 +64,9 @@ $ cat echo-response.txt{"MESSAGE":"HELLO"}
```
More examples can be found here,
- AWS Lambda - Execution context
- AWS Lambda - S3 trigger
- AWS Lambda - DynamoDB trigger
- [AWS Lambda - Execution context](https://ballerina.io/learn/by-example/aws-lambda-execution-context/)
- [AWS Lambda - S3 trigger](https://ballerina.io/learn/by-example/aws-lambda-s3-trigger/)
- [AWS Lambda - DynamoDB trigger](https://ballerina.io/learn/by-example/aws-lambda-dynamodb-trigger/)

### CI/CD deployment with AWS Lambda
This GitHub Action workflow automates the continuous integration and continuous deployment (CI/CD) process for a Ballerina project.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
layout: ballerina-cloud-left-nav-pages-swanlake
title: Virtual Machine Deployment
title: Virtual machine deployment guide
description: If you prefer to execute Ballerina services directly on virtual machines (VMs) or bare metal servers without using containerization, you can follow these steps to set up and run your services in a production environment,
keywords: ballerina, programming language, services, cloud, kubernetes, docker
permalink: /learn/run-ballerina-programs-in-the-cloud/code-to-cloud-deployment/
active: code-to-cloud-deployment
active: ballerina-deployment-guideLines
intro: If you prefer to execute Ballerina services directly on virtual machines (VMs) or bare metal servers without using containerization, you can follow these steps to set up and run your services in a production environment,
---

Expand Down
42 changes: 42 additions & 0 deletions utils/learn-lm.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,48 @@
"isDir": false,
"url": "/learn/aws-lambda",
"id": "aws-lambda"
},
{
"dirName": "Ballerina deployment guide",
"level": 3,
"position": 4,
"isDir": true,
"url": "/learn/deployment-guide",
"id": "deployment-guide",
"subDirectories": [
{
"dirName": "Ballerina production deployment guidelines",
"level": 4,
"position": 1,
"isDir": false,
"url": "/learn/deployment-guide/ballerina-deployment-guidelines",
"id": "ballerina-deployment-guidelines"
},
{
"dirName": "Virtual machine deployment guide",
"level": 4,
"position": 2,
"isDir": false,
"url": "/learn/deployment-guide/ballerina-virtual-machine-deployment-guide",
"id": "ballerina-virtual-machine-deployment-guide"
},
{
"dirName": "Kubernetes deployment guide",
"level": 4,
"position": 3,
"isDir": false,
"url": "/learn/deployment-guide/ballerina-k8s-deployment-guide",
"id": "ballerina-k8s-deployment-guide"
},
{
"dirName": "Serverless deployment guide",
"level": 4,
"position": 4,
"isDir": false,
"url": "/learn/deployment-guide/ballerina-serverless-deployment-guide",
"id": "ballerina-serverless-deployment-guide"
}
]
}
]
},
Expand Down

0 comments on commit 6688618

Please sign in to comment.