-
Notifications
You must be signed in to change notification settings - Fork 5
Add kubernetes artifacts #9
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
Open
RivinduM
wants to merge
1
commit into
wso2:main
Choose a base branch
from
RivinduM:k8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| # WSO2 SWIFT MT/MX Translator and Dashboard: Kubernetes Deployment Guide | ||
|
|
||
| This guide details the steps to deploy an all-in-one setup for the **WSO2 SWIFT MT/MX Translator and Dashboard** using Kubernetes. | ||
|
|
||
| --- | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Ensure you have the following installed and configured before proceeding: | ||
|
|
||
| * **Kubernetes** cluster access and `kubectl` configured. | ||
| * **Docker** installed for building container images. | ||
| * **Docker Hub Account** (or any other container registry) to push the custom images. | ||
|
|
||
| --- | ||
|
|
||
| ## Deployment Overview | ||
|
|
||
| This setup involves deploying **four** main Kubernetes components: | ||
|
|
||
| 1. **Translator Deployment (Single Pod with up to Three Containers):** | ||
| * `translator` container (main application) | ||
| * `fluent-bit` container (for log forwarding) | ||
| * `extensions` container (optional, only required if extensions are enabled) | ||
| 2. **Opensearch Deployments (Two):** The data store for the translator and dashboard. | ||
| 3. **Opensearch Dashboard Deployment:** The visualization layer, leveraging the custom SWIFT Dashboard plugin. | ||
|
|
||
| --- | ||
|
|
||
| ## Step-by-Step Deployment Instructions | ||
|
|
||
| ### 1. Obtain Translator and Dashboard Artifacts | ||
|
|
||
| 1. **Download Translator:** Get the latest `swift-mt-mx-translator.zip` from the [WSO2 reference-implementation-cbpr releases page](https://github.com/wso2/reference-implementation-cbpr/releases). | ||
| 2. **Download Dashboard Plugin:** Get the latest `swift-dashboard.zip` from the same [releases page](https://github.com/wso2/reference-implementation-cbpr/releases). | ||
|
|
||
| --- | ||
|
|
||
| ### 2. Build and Push the Translator Docker Image | ||
|
|
||
| 1. **Prepare Directory:** | ||
| - Create a directory named `translator-deployment`. | ||
| ```bash | ||
| mkdir translator-deployment | ||
| cd translator-deployment | ||
| ``` | ||
| - Extract the downloaded translator package (e.g., `swift-mt-mx-translator-1.0.0.zip`) and copy the **`swiftMtMxTranslator.jar`**. | ||
| - Copy **`extensions.jar`** (if applicable) | ||
| - Rename and copy the **`translator-dockerfile`** to **`Dockerfile`** | ||
|
|
||
| 2. **Build Image:** | ||
|
|
||
| Build the Docker image. | ||
| ```bash | ||
| docker build -t swift-translator:latest . | ||
| ``` | ||
| 3. **Tag & Push Image:** | ||
|
|
||
| Tag the image with your registry name. **Replace `<your-registry>`** with your actual username or registry path. | ||
| ```bash | ||
| docker tag swift-translator:latest <your-registry>/swift-translator:latest | ||
| ``` | ||
| Push the image to your container registry. | ||
| ```bash | ||
| docker push <your-registry>/swift-translator:latest | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ### 3. Build and Push the Dashboard Docker Image | ||
|
|
||
| 1. **Prepare Directory:** | ||
| - Create a directory named `dashboard-deployment`. | ||
| ```bash | ||
| mkdir translator-deployment | ||
| cd translator-deployment | ||
| ``` | ||
| - Copy the downloaded **`swift-dashboard.zip`** | ||
| - Rename and copy the **`dashboard-dockerfile`** to **`Dockerfile`** | ||
|
|
||
| 2. **Verify Dockerfile:** | ||
|
|
||
| Before building, open the `Dockerfile` and ensure the version name of the Dashboard ZIP file (`swift-dashboard-1.0.0.zip`) matches the file you copied into the directory.** | ||
|
|
||
| 3. **Build Image:** Build the Docker image. | ||
| ```bash | ||
| docker build -t swift-dashboard:latest . | ||
| ``` | ||
| 4. **Tag & Push Image:** | ||
|
|
||
| Tag the image with your registry name. **Replace `<your-registry>`** with your actual username or registry path. | ||
| ```bash | ||
| docker tag swift-dashboard:latest <your-registry>/swift-dashboard:latest | ||
| ``` | ||
| Push the image to your container registry. | ||
| ```bash | ||
| docker push <your-registry>/swift-dashboard:latest | ||
| ``` | ||
| *(**Note:** Ensure your Kubernetes manifest (`wso2-swift-translator-k8s.yaml`) uses the correct registry paths for both images.)* | ||
|
|
||
| --- | ||
|
|
||
| ### 4. Configure Kubernetes Environment (VM Max Map Count) | ||
|
|
||
| Before deployment, if you are running Kubernetes on a local VM (like Minikube or Docker Desktop), you must increase the maximum memory map count (`vm.max_map_count`) for **Opensearch** to function correctly. | ||
|
|
||
| 1. **Access VM Shell:** Enter the shell environment of your Kubernetes VM. | ||
| ```bash | ||
| rdctl shell # Example for Rancher Desktop | ||
| # Use 'minikube ssh' for Minikube, or relevant command for your environment | ||
| ``` | ||
| 2. **Increase Max Map Count:** Set the `vm.max_map_count` kernel parameter. | ||
| ```bash | ||
| sudo sysctl -w vm.max_map_count=262144 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ### 5. Deploy to Kubernetes | ||
|
|
||
| 1. Apply secrets & config maps | ||
|
|
||
| Modify opensearch-secret.yaml with your default credentials and apply configurations. | ||
| ```bash | ||
| kubectl apply -f opensearch-secret.yaml | ||
| kubectl create configmap translator-config --from-file=Config.toml | ||
| ``` | ||
| 2. Apply the combined Kubernetes YAML file to deploy all components (Translator, Opensearch, and Dashboard). | ||
| ```bash | ||
| kubectl apply -f wso2-swift-translator-k8s.yaml | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ### 6. Monitor and Verify Deployment | ||
|
|
||
| 1. **Check Deployments:** Verify that all deployments are up and running. | ||
| ```bash | ||
| kubectl get deployments | ||
| ``` | ||
| 2. **Check Pod Status:** Monitor the status of the created Pods. | ||
| ```bash | ||
| kubectl get pods | ||
| ``` | ||
| *Verify that all pods, including the Opensearch and Dashboard ones, are in the **Running** state.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Start from the base image used in your Kubernetes YAML | ||
| FROM opensearchproject/opensearch-dashboards:2.19.0 | ||
|
|
||
| # Define the installation directory | ||
| WORKDIR /usr/share/opensearch-dashboards | ||
|
|
||
| # Copy the plugin ZIP into the container | ||
| COPY swift-dashboard-1.0.0.zip ./swift-dashboard.zip | ||
|
|
||
| # Install the plugin and remove the ZIP file | ||
| # Note: The 'opensearch-dashboards-plugin install' command should be used. | ||
| # The trailing '&' is often used to ensure the command runs in the background. | ||
| RUN bin/opensearch-dashboards-plugin install file:///usr/share/opensearch-dashboards/swift-dashboard.zip \ | ||
| && rm swift-dashboard.zip | ||
|
|
||
| # The ENTRYPOINT and CMD are inherited from the base image | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: opensearch-auth | ||
| type: Opaque | ||
| data: | ||
| # Base64 encoded: echo -n 'admin' | base64 | ||
| username: YWRtaW4= | ||
| # Base64 encoded: echo -n 'Pass@123@pass' | base64 | ||
| password: UGFzc0AxMjNAcGFzcw== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Use a lightweight OpenJDK runtime image | ||
| FROM eclipse-temurin:17-jre-focal | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /app | ||
|
|
||
| # Copy the two JAR files into the container | ||
| COPY swiftMtMxTranslator.jar /app/swiftMtMxTranslator.jar | ||
| COPY extensions.jar /app/extensions.jar | ||
|
|
||
| # Define an entrypoint, though the Deployment will override the command | ||
| ENTRYPOINT ["java", "-jar"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 add licenses?