Laconic

Step 1: Clone the Repository

git clone https://github.com/cerc-io/stack-orchestrator.git
cd stack-orchestrator

Step 2: Build the Project

Ensure Go is properly set up on your machine and the GOPATH is configured. Then build the project:

go build -o stack-orchestrator

This creates an executable named stack-orchestrator.

Step 3: Run the Binary

After building, you can execute the orchestrator:

./stack-orchestrator

3. Configuration

The Stack Orchestrator requires configuration files to define clusters, services, and resources. The configuration is generally provided in a config.yaml file.

Example config.yaml

version: "1.0"

cluster:
  name: "example-cluster"
  nodes:
    - address: "192.168.1.100"
    - address: "192.168.1.101"

services:
  - name: "web-service"
    image: "nginx:latest"
    replicas: 3
    ports:
      - 80:8080
  - name: "api-service"
    image: "my-api:latest"
    replicas: 2
    environment:
      - "ENV=production"
      - "DEBUG=false"

Place this file in the root directory or specify its path when running the orchestrator.


4. Usage

Starting the Orchestrator

To run the orchestrator with your configuration:

Deploy Services

The orchestrator reads the services defined in the configuration file and deploys them automatically. It will:

  1. Pull the required Docker images.

  2. Distribute workloads across the cluster nodes.

  3. Manage replication and load balancing.

Scaling Services

You can scale a service dynamically using the CLI:

Listing Services

Check the status of all running services:

Logs

Fetch logs for a specific service:


5. Example Code

Below is a basic implementation snippet that shows how you might use the orchestrator's internal logic to deploy a service programmatically:

Example Deployment Code

Running the Code

  1. Save the file as main.go.

  2. Build and execute:



Last updated