diff --git a/en/docs/deploy-operate/deploy/aws-azure-gcp.md b/en/docs/deploy-operate/deploy/aws-azure-gcp.md index 53a856bf3a8..571656a1c35 100644 --- a/en/docs/deploy-operate/deploy/aws-azure-gcp.md +++ b/en/docs/deploy-operate/deploy/aws-azure-gcp.md @@ -279,5 +279,5 @@ For non-Kubernetes environments (ECS, VM-based), use cloud-native service discov ## What's next -- [Run Locally](../../deploy/self-hosted/run-locally.md) -- Develop and test before deploying +- [Local and VM deployment](../../deploy/self-hosted/local-and-vm-deployment.md) -- Develop and test before deploying - [Scaling & High Availability](scaling-high-availability.md) -- Configure scaling and resilience diff --git a/en/docs/deploy-operate/deploy/graalvm-native-images.md b/en/docs/deploy-operate/deploy/graalvm-native-images.md index ee5c3beb1bc..abb8d85efdb 100644 --- a/en/docs/deploy-operate/deploy/graalvm-native-images.md +++ b/en/docs/deploy-operate/deploy/graalvm-native-images.md @@ -194,5 +194,5 @@ Deploy the generated ZIP -- cold start drops from seconds to under 100ms. ## What's next - [Serverless Deployment](serverless-deployment.md) -- Deploy native images as Lambda functions -- [VM-Based Deployment](vm-based-deployment.md) -- Run native binaries on virtual machines +- [Local and VM deployment](../../deploy/self-hosted/local-and-vm-deployment.md) -- Run native binaries on virtual machines - [Containerized Deployment](../../deploy/self-hosted/containerized-deployment.md) -- Build minimal container images for Docker, Kubernetes, and OpenShift diff --git a/en/docs/deploy-operate/deploy/vm-based-deployment.md b/en/docs/deploy-operate/deploy/vm-based-deployment.md deleted file mode 100644 index 4625c3dcc57..00000000000 --- a/en/docs/deploy-operate/deploy/vm-based-deployment.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -sidebar_position: 7 -title: VM-Based Deployment -description: Deploy integrations as standalone JAR files or centralized consolidated packages on virtual machines. ---- - -# VM-Based Deployment - -WSO2 Integrator projects compile to executable JAR files that run on any JVM, making virtual machines a straightforward deployment target. You can deploy as standalone JARs for individual services or use consolidated packages to run multiple integrations from a single runtime. - -## Prerequisites - -| Requirement | Details | -|-------------|---------| -| Java Runtime | JDK 17 or later | -| Operating System | Linux (recommended), macOS, or Windows | -| Memory | Minimum 512 MB, recommended 1 GB+ per instance | -| Ballerina | Distribution installed on the build machine | - -## Building the executable JAR - -Use the `bal build` command to produce a standalone executable JAR. - -```bash -bal build -``` - -This generates a fat JAR in the `target/bin/` directory: - -``` -target/ - bin/ - my_integration.jar -``` - -Run it directly: - -```bash -java -jar target/bin/my_integration.jar -``` - -### Build options - -| Flag | Description | -|------|-------------| -| `--cloud=docker` | Also generate Docker artifacts | -| `--graalvm` | Build a GraalVM native image | -| `--observability-included` | Bundle observability dependencies | -| `-DskipTests` | Skip test execution during build | - -## Standalone JAR deployment - -The simplest approach is to copy the JAR to the target VM and run it. - -### Step 1 -- transfer the JAR - -```bash -scp target/bin/my_integration.jar user@production-vm:/opt/integrations/ -``` - -### Step 2 -- configure the runtime - -Create a `Config.toml` in the same directory as the JAR (or set the `BAL_CONFIG_FILES` environment variable): - -```toml -[myIntegration.http] -port = 9090 - -[myIntegration.db] -host = "db.internal.example.com" -port = 5432 -username = "svc_user" -password = "encrypted:xxxxx" -``` - -### Step 3 -- run as a systemd service - -Create a systemd unit file at `/etc/systemd/system/my-integration.service`: - -```ini -[Unit] -Description=WSO2 Integration Service -After=network.target - -[Service] -Type=simple -User=ballerina -Group=ballerina -WorkingDirectory=/opt/integrations -ExecStart=/usr/bin/java -Xms256m -Xmx512m -jar my_integration.jar -Restart=on-failure -RestartSec=10 -StandardOutput=journal -StandardError=journal -Environment=BAL_CONFIG_FILES=/opt/integrations/Config.toml - -[Install] -WantedBy=multi-user.target -``` - -Enable and start the service: - -```bash -sudo systemctl daemon-reload -sudo systemctl enable my-integration -sudo systemctl start my-integration -sudo systemctl status my-integration -``` - -### Step 4 -- verify the deployment - -```bash -curl http://localhost:9090/health -``` - -## Consolidated package deployment - -For organizations running multiple integrations, a consolidated deployment bundles several integration packages into a single runtime. - -### Creating a consolidated package - -1. Create a consolidation project: - -```bash -bal new consolidated_deploy -t lib -``` - -2. Add each integration as a dependency in `Ballerina.toml`: - -```toml -[package] -org = "myorg" -name = "consolidated_deploy" -version = "1.0.0" - -[[dependency]] -org = "myorg" -name = "order_service" -version = "1.2.0" - -[[dependency]] -org = "myorg" -name = "inventory_sync" -version = "1.0.3" - -[[dependency]] -org = "myorg" -name = "notification_handler" -version = "2.1.0" -``` - -3. Build the consolidated JAR: - -```bash -bal build -``` - -### Running the consolidated package - -```bash -java -jar target/bin/consolidated_deploy.jar -``` - -All services start within the same JVM process, sharing resources. - -### Consolidated Config.toml - -Provide configuration for all included integrations in a single file: - -```toml -# Order Service configuration -[order_service.http] -port = 9091 - -[order_service.db] -host = "db.internal.example.com" - -# Inventory Sync configuration -[inventory_sync.schedule] -cronExpression = "0 */5 * * * ?" - -[inventory_sync.endpoint] -url = "https://erp.example.com/api" - -# Notification Handler configuration -[notification_handler.email] -smtpHost = "smtp.example.com" -smtpPort = 587 -``` - -## JVM tuning for production - -Recommended JVM flags for production deployments: - -```bash -java \ - -Xms512m \ - -Xmx1024m \ - -XX:+UseG1GC \ - -XX:MaxGCPauseMillis=200 \ - -XX:+HeapDumpOnOutOfMemoryError \ - -XX:HeapDumpPath=/var/log/integrations/ \ - -Dballerina.observability.enabled=true \ - -jar my_integration.jar -``` - -| JVM Flag | Purpose | -|----------|---------| -| `-Xms` / `-Xmx` | Initial and maximum heap size | -| `-XX:+UseG1GC` | Use the G1 garbage collector (recommended) | -| `-XX:MaxGCPauseMillis` | Target max GC pause time | -| `-XX:+HeapDumpOnOutOfMemoryError` | Generate heap dump on OOM | - -## Log management - -Direct logs to files with rotation: - -```bash -java -jar my_integration.jar 2>&1 | tee -a /var/log/integrations/my_integration.log -``` - -Or configure logging in `Config.toml`: - -```toml -[ballerina.log] -level = "INFO" -``` - -## Health checks and monitoring - -Expose a health endpoint for load balancers and monitoring systems: - -```ballerina -import ballerina/http; - -service /health on new http:Listener(9091) { - resource function get .() returns http:Ok { - return http:OK; - } -} -``` - -## What's next - -- [Managing Configurations](managing-configurations.md) -- Per-environment configuration strategies -- [Scaling & High Availability](scaling-high-availability.md) -- Run multiple instances behind a load balancer -- [GraalVM Native Images](graalvm-native-images.md) -- Compile to native binaries for faster startup diff --git a/en/docs/deploy/overview.md b/en/docs/deploy/overview.md index 31a6c51d63f..c9f5777b748 100644 --- a/en/docs/deploy/overview.md +++ b/en/docs/deploy/overview.md @@ -14,8 +14,7 @@ Once your integration is ready, this section covers everything you need to ship WSO2 Integrator supports multiple deployment targets. Choose the one that fits your infrastructure: - **[WSO2 Cloud](./cloud/overview.md)** — Push your project directly from the IDE or the cloud editor to the managed WSO2 Integration Platform. No infrastructure setup required. -- **[Run locally](./self-hosted/run-locally.md)** — Run your integration on your local machine for development or testing. -- **[VM-based deployment](../deploy-operate/deploy/vm-based-deployment.md)** — Deploy to a virtual machine or bare-metal server. +- **[Local and VM deployment](./self-hosted/local-and-vm-deployment.md)** — Run your integration on your local machine for development or testing, or deploy to a virtual machine or bare-metal server. - **[Containerized Deployment](./self-hosted/containerized-deployment.md)** — Package your integration as a container and deploy it to Docker, Kubernetes, or Red Hat OpenShift. - **[Serverless deployment](../deploy-operate/deploy/serverless-deployment.md)** — Run integrations as serverless functions. - **[AWS, Azure, and GCP](../deploy-operate/deploy/aws-azure-gcp.md)** — Deploy to major cloud providers using native services. diff --git a/en/docs/deploy/self-hosted/local-and-vm-deployment.md b/en/docs/deploy/self-hosted/local-and-vm-deployment.md new file mode 100644 index 00000000000..0b2289de31f --- /dev/null +++ b/en/docs/deploy/self-hosted/local-and-vm-deployment.md @@ -0,0 +1,292 @@ +--- +title: Local and VM Deployment +description: Run WSO2 Integrator projects locally during development or deploy as standalone JAR files on virtual machines. +keywords: [wso2 integrator, bal run, run locally, vm deployment, jar deployment, ballerina cli] +--- + +# Local and VM Deployment + +This page explains how to run WSO2 Integrator projects either directly on your local machine during development using `bal run`, or as standalone JAR files on virtual machines for self-hosted production deployments. + +:::info Prerequisites +- [Ballerina installed](https://ballerina.io/downloads/) on any machine where you want to run the project +- A WSO2 Integrator project based on Ballerina +- For production VM deployments: Java Runtime (JDK 21 or later) +::: + +## Run locally during development + +To run the project on your local machine during development: + +1. Open a terminal and navigate to the project directory. + + ```bash + cd my-integration + ``` + +2. Start the project. + + ```bash + bal run + ``` + +The Ballerina CLI compiles the project and starts the integration runtime. You will see the program output in the terminal. Integrations with listeners keep running until you terminate it by **`CTRL + C`** + +## Run on a VM from source + +To run the project on a remote virtual machine, install the Ballerina distribution on the VM and run the project directly from source using `bal run`. + +### Step 1: Push the project to a remote Git repository + +From your local machine, push the project to a remote Git repository such as GitHub, GitLab, or Bitbucket. + +```bash +git add . +git commit -m "Initial integration project" +git push origin main +``` + +### Step 2: Clone the repository on the VM + +SSH into the target VM and clone the repository. + +```bash +git clone https://github.com/your-org/my-integration.git +cd my-integration +``` + +### Step 3: Start the integration + +Run the project using the Ballerina CLI. + +```bash +bal run +``` + +The runtime starts and the integration begins serving traffic on the configured port. + +:::note +Ballerina must be installed on the VM. Download it from [ballerina.io](https://ballerina.io/downloads/). The version on the VM should match the version used during development. +::: + +## Deploy with executable JAR + +For production VM deployments, WSO2 Integrator projects compile to executable JAR files that run on any JVM. This approach gives you full control over the runtime environment and is ideal for traditional VM-based infrastructure. + +### Prerequisites for JAR deployment + +| Requirement | Details | +|-------------|---------| +| Java Runtime | JDK 21 or later | +| Operating System | Linux (recommended), macOS, or Windows | +| Memory | Minimum 512 MB, recommended 1 GB+ per instance | +| Ballerina | Distribution installed on the build machine | + +### Build the executable JAR + +Use the `bal build` command to produce a standalone executable JAR. + +```bash +bal build +``` + +This generates a fat JAR in the `target/bin/` directory: + +```bash +target/ + bin/ + my_integration.jar +``` + +Run it directly: + +```bash +java -jar target/bin/my_integration.jar +``` + +### Build options + +| Flag | Description | +|------|-------------| +| `--cloud=docker` | Also generate Docker artifacts | +| `--graalvm` | Build a GraalVM native image | +| `--observability-included` | Bundle observability dependencies | +| `-DskipTests` | Skip test execution during build | + +### Transfer the JAR to your VM + +```bash +scp target/bin/my_integration.jar user@production-vm:/opt/integrations/ +``` + +### Configure the runtime + +Create a `Config.toml` in the same directory as the JAR (or set the `BAL_CONFIG_FILES` environment variable): + +```toml +[myIntegration.http] +port = 9090 + +[myIntegration.db] +host = "db.internal.example.com" +port = 5432 +username = "svc_user" +password = "encrypted:xxxxx" +``` + +### Start the integration + +```bash +java -jar my_integration.jar +``` + +For production deployments with JVM tuning: + +```bash +java \ + -Xms512m \ + -Xmx1024m \ + -XX:+UseG1GC \ + -XX:MaxGCPauseMillis=200 \ + -XX:+HeapDumpOnOutOfMemoryError \ + -XX:HeapDumpPath=/var/log/integrations/ \ + -Dballerina.observability.enabled=true \ + -jar my_integration.jar +``` + +### Verify the deployment + +```bash +curl http://localhost:9090/health +``` + +## Consolidated package deployment + +For organizations running multiple integrations, a consolidated deployment bundles several integration packages into a single runtime. + +### Creating a consolidated package + +1. Create a consolidation project: + +```bash +bal new consolidated_deploy -t lib +``` + +2. Add each integration as a dependency in `Ballerina.toml`: + +```toml +[package] +org = "myorg" +name = "consolidated_deploy" +version = "1.0.0" + +[[dependency]] +org = "myorg" +name = "order_service" +version = "1.2.0" + +[[dependency]] +org = "myorg" +name = "inventory_sync" +version = "1.0.3" + +[[dependency]] +org = "myorg" +name = "notification_handler" +version = "2.1.0" +``` + +3. Build the consolidated JAR: + +```bash +bal build +``` + +### Running the consolidated package + +```bash +java -jar target/bin/consolidated_deploy.jar +``` + +All services start within the same JVM process, sharing resources. + +### Consolidated Config.toml + +Provide configuration for all included integrations in a single file: + +```toml +# Order Service configuration +[order_service.http] +port = 9091 + +[order_service.db] +host = "db.internal.example.com" + +# Inventory Sync configuration +[inventory_sync.schedule] +cronExpression = "0 */5 * * * ?" + +[inventory_sync.endpoint] +url = "https://erp.example.com/api" + +# Notification Handler configuration +[notification_handler.email] +smtpHost = "smtp.example.com" +smtpPort = 587 +``` + +## JVM tuning for production + +Recommended JVM flags for production deployments: + +```bash +java \ + -Xms512m \ + -Xmx1024m \ + -XX:+UseG1GC \ + -XX:MaxGCPauseMillis=200 \ + -XX:+HeapDumpOnOutOfMemoryError \ + -XX:HeapDumpPath=/var/log/integrations/ \ + -Dballerina.observability.enabled=true \ + -jar my_integration.jar +``` + +| JVM Flag | Purpose | +|----------|---------| +| `-Xms` / `-Xmx` | Initial and maximum heap size | +| `-XX:+UseG1GC` | Use the G1 garbage collector (recommended) | +| `-XX:MaxGCPauseMillis` | Target max GC pause time | +| `-XX:+HeapDumpOnOutOfMemoryError` | Generate heap dump on OOM | + +## Log management + +Configure logging in `Config.toml`: + +```toml +[ballerina.log] +level = "INFO" + +[[ballerina.log.destinations]] +path = "./logs/app.log" +``` + +## Health checks and monitoring + +Expose a health endpoint for load balancers and monitoring systems: + +```ballerina +import ballerina/http; + +service /health on new http:Listener(9091) { + resource function get .() returns http:Ok { + return http:OK; + } +} +``` + +## What's next + +- [Containerized Deployment](./containerized-deployment.md) — Deploy your project to Docker, Kubernetes, or Red Hat OpenShift using Code to Cloud +- [Managing Configurations](../../deploy-operate/deploy/managing-configurations.md) — Per-environment configuration strategies +- [Scaling & High Availability](../../deploy-operate/deploy/scaling-high-availability.md) — Run multiple instances behind a load balancer +- [GraalVM Native Images](../../deploy-operate/deploy/graalvm-native-images.md) — Compile to native binaries for faster startup diff --git a/en/docs/deploy/self-hosted/run-locally.md b/en/docs/deploy/self-hosted/run-locally.md deleted file mode 100644 index faa81fd1253..00000000000 --- a/en/docs/deploy/self-hosted/run-locally.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Run Locally -description: Run a WSO2 Integrator project using the Ballerina CLI, both on your local machine and on a remote VM. -keywords: [wso2 integrator, bal run, run locally, vm deployment, ballerina cli] ---- - -# Run Your Integration Locally - -This page explains how to run a WSO2 Integrator project using the Ballerina CLI. You can run it directly on your local machine during development or on a remote virtual machine for a self-hosted deployment. - -:::info Prerequisites -- [Ballerina installed](https://ballerina.io/downloads/) on any machine where you want to run the project -- A WSO2 Integrator project based on Ballerina -::: - -## Run locally - -To run the project on your local machine: - -1. Open a terminal and navigate to the project directory. - - ```bash - cd my-integration - ``` - -2. Start the project. - - ```bash - bal run - ``` - -The Ballerina CLI compiles the project and starts the integration runtime. You will see the program output in the terminal. Integrations with listeners keep running until you terminate it by **`CTRL + C`** - -## Run on a VM - -To run the project on a remote virtual machine, install the Ballerina distribution on the VM and run the project directly from source using `bal run`. - -### Step 1: Push the project to a remote Git repository - -From your local machine, push the project to a remote Git repository such as GitHub, GitLab, or Bitbucket. - -```bash -git add . -git commit -m "Initial integration project" -git push origin main -``` - -### Step 2: Clone the repository on the VM - -SSH into the target VM and clone the repository. - -```bash -git clone https://github.com/your-org/my-integration.git -cd my-integration -``` - -### Step 3: Start the integration - -Run the project using the Ballerina CLI. - -```bash -bal run -``` - -The runtime starts and the integration begins serving traffic on the configured port. - -:::note -Ballerina must be installed on the VM. Download it from [ballerina.io](https://ballerina.io/downloads/). The version on the VM should match the version used during development. -::: - -## What's next - -- [Containerized Deployment](./containerized-deployment.md) — Deploy your project to Docker, Kubernetes, or Red Hat OpenShift using Code to Cloud diff --git a/en/docs/develop/understand-ide/views/integration-view.md b/en/docs/develop/understand-ide/views/integration-view.md index 47e4019990a..1ed632777e7 100644 --- a/en/docs/develop/understand-ide/views/integration-view.md +++ b/en/docs/develop/understand-ide/views/integration-view.md @@ -76,7 +76,7 @@ The deployment options panel appears on the right sidebar and provides shortcuts |---|---| | [**Deploy to WSO2 Cloud**](../../../deploy/cloud/overview.md) | Fully managed cloud platform for hosting and running integrations. | | [**Containerized Deployment**](../../../deploy/self-hosted/containerized-deployment.md) | Build Docker images and deploy integrations to Docker, Kubernetes, or OpenShift. | -| [**Deploy on a VM**](../../../deploy-operate/deploy/vm-based-deployment.md) | Run integrations as standalone JAR files on virtual machines. | +| [**Local and VM deployment**](../../../deploy/self-hosted/local-and-vm-deployment.md) | Run integrations locally during development or as standalone JAR files on virtual machines. | | [**Integration Control Plane (ICP)**](../../../deploy-operate/observe/integration-control-plane-icp.md) | Monitor and manage running integrations from a centralized dashboard. | Select **Enable ICP monitoring** to activate ICP for this integration, or expand **Publish to local ICP** to push the integration to a local Integration Control Plane instance. diff --git a/en/docs/develop/understand-ide/views/project-view.md b/en/docs/develop/understand-ide/views/project-view.md index 3c127de5858..cb0dbe7b948 100644 --- a/en/docs/develop/understand-ide/views/project-view.md +++ b/en/docs/develop/understand-ide/views/project-view.md @@ -44,7 +44,7 @@ The deployment options panel appears on the right sidebar and provides shortcuts |---|---| | [**Deploy to WSO2 Cloud**](../../../deploy/cloud/overview.md) | Fully managed cloud platform for hosting and running integrations. | | [**Containerized Deployment**](../../../deploy/self-hosted/containerized-deployment.md) | Build Docker images and deploy integrations to Docker, Kubernetes, or OpenShift. | -| [**Deploy on a VM**](../../../deploy-operate/deploy/vm-based-deployment.md) | Run integrations as standalone JAR files on virtual machines. | +| [**Local and VM deployment**](../../../deploy/self-hosted/local-and-vm-deployment.md) | Run integrations locally during development or as standalone JAR files on virtual machines. | | [**Integration Control Plane (ICP)**](../../../deploy-operate/observe/integration-control-plane-icp.md) | Monitor and manage running integrations from a centralized dashboard. | At the project level, click **Enable ICP for all integrations** to activate ICP monitoring for every integration in the project at once. diff --git a/en/docs/reference/project/ballerinatoml-reference.md b/en/docs/reference/project/ballerinatoml-reference.md index 9ac74cdb6e6..777413cd800 100644 --- a/en/docs/reference/project/ballerinatoml-reference.md +++ b/en/docs/reference/project/ballerinatoml-reference.md @@ -229,6 +229,6 @@ options.mode = "client" ## What's next -- [Run locally](../../deploy/self-hosted/run-locally.md) — build and run the package you just configured. +- [Local and VM deployment](../../deploy/self-hosted/local-and-vm-deployment.md) — build and run the package you just configured. - [Cloud.toml reference](./cloudtoml-reference.md) — add Kubernetes and Docker deployment descriptors when you deploy. - [Configuration management](../config/configuration-management.md) — supply runtime values, override via environment variables, and target per-environment configuration. diff --git a/en/sidebars.ts b/en/sidebars.ts index 9fae68edfa0..53b19933d73 100644 --- a/en/sidebars.ts +++ b/en/sidebars.ts @@ -1904,9 +1904,8 @@ const sidebars: SidebarsConfig = { type: 'category', label: 'Self-Hosted', items: [ - 'deploy/self-hosted/run-locally', + 'deploy/self-hosted/local-and-vm-deployment', 'deploy/self-hosted/containerized-deployment', - 'deploy-operate/deploy/vm-based-deployment', 'deploy-operate/deploy/serverless-deployment', 'deploy-operate/deploy/aws-azure-gcp', 'deploy-operate/deploy/graalvm-native-images',