Skip to content

🦍 Talis is a cloud-agnostic infrastructure orchestration platform for w3 to manage VMs at scale.

Notifications You must be signed in to change notification settings

celestiaorg/talis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Talis 🦍

Talis is a multi-cloud infrastructure provisioning and configuration project that uses:

  • API to create cloud instances on the desired cloud provider
  • Ansible for initial system configuration and package installation

Overview

  • Multi-cloud: With a single codebase, you can choose which cloud provider to useβ€”AWS or DigitalOcean
  • Ansible: Provides initial system configuration and package installation

Requirements

  • Go (1.22 or higher)
  • Ansible (2.9 or higher)
  • SSH key pair for instance access
  • Cloud Credentials:

Project Structure

talis/
β”œβ”€β”€ cmd/
β”‚   β”œβ”€β”€ main.go                    # Main entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/                       # API related code
β”‚   β”‚   └── v1/
β”‚   β”‚       β”œβ”€β”€ handlers/         # Request handlers
β”‚   β”‚       β”œβ”€β”€ middleware/       # API middleware
β”‚   β”‚       └── routes/           # Route definitions
β”‚   β”œβ”€β”€ application/              # Application layer
β”‚   β”‚   └── job/                 # Job service implementation
β”‚   β”œβ”€β”€ compute/                   # Cloud provider implementations
β”‚   β”‚   β”œβ”€β”€ compute.go            # ComputeProvider interface and common types
β”‚   β”‚   β”œβ”€β”€ digitalocean.go       # DigitalOcean implementation
β”‚   β”‚   └── ansible.go            # Ansible configuration and provisioning
β”‚   β”œβ”€β”€ db/                        # Database layer
β”‚   β”‚   └── job/                 # Job database models
β”‚   β”œβ”€β”€ domain/                    # Domain layer
β”‚   β”‚   └── job/                 # Job domain models and interfaces
β”‚   β”œβ”€β”€ infrastructure/           # Infrastructure layer
β”‚   β”‚   └── persistence/         # Data persistence implementations
β”‚   β”‚       └── postgres/        # PostgreSQL implementations
β”‚   └── types/
β”‚       └── infrastructure/        # Infrastructure types and logic
β”‚           β”œβ”€β”€ models.go         # Type definitions
β”‚           β”œβ”€β”€ validation.go     # Request validation
β”‚           β”œβ”€β”€ pulumi.go        # Pulumi logic
β”‚           └── infrastructure.go # Main infrastructure logic
β”œβ”€β”€ ansible/                      # Ansible configurations
β”‚   β”œβ”€β”€ playbook.yml             # Main Ansible playbook
β”‚   └── inventory_*_ansible.ini  # Generated inventory files
β”œβ”€β”€ scripts/                      # Utility scripts
└── .env.example                  # Environment variables example
β”œβ”€β”€ Makefile                      # Build and development commands

Key Files

cmd/

  • main.go: Application entry point with server setup

internal/api/v1/

  • handlers/: HTTP request handlers
  • middleware/: API middleware (logging, auth, etc.)
  • routes/: API route definitions

internal/application/

  • job/: Job service implementation with business logic

internal/compute/

  • compute.go: Defines the ComputeProvider interface and common types
  • digitalocean.go: ComputeProvider implementation for DigitalOcean
  • ansible.go: Ansible configuration and provisioning

internal/db/

  • job/: Job database models and operations

internal/domain/

  • job/: Job domain models, interfaces and business rules

internal/infrastructure/

  • persistence/postgres/: PostgreSQL implementations of repositories

internal/types/infrastructure/

  • models.go: Main data structure definitions
  • validation.go: Request validation
  • infrastructure.go: Main infrastructure management logic

ansible/

  • playbook.yml: Main Ansible playbook
  • inventory_*_ansible.ini: Generated inventory files

Setup

  1. Copy .env.example to .env:
cp .env.example .env
  1. Configure environment variables:
# DigitalOcean
DIGITALOCEAN_TOKEN=your_digitalocean_token_here
SSH_KEY_ID=your_key_id_here
  1. Ensure your SSH key is available:
# The default path is /root/.ssh/id_rsa
# You can specify a different path in the request

Usage

Using the CLI

Talis provides a command-line interface for managing infrastructure and jobs.

# Build the CLI
make build-cli

# Create infrastructure using a JSON file
talis infra create -f create.json

# Delete infrastructure using a JSON file
talis infra delete -f delete.json

# List all jobs
talis jobs list

# List jobs with filters
talis jobs list --limit 10 --status running

# Get job status
talis jobs get --id job-20240315-123456

API Usage

Create Instances

{
    "name": "talis",
    "project_name": "talis-pulumi-ansible",
    "instances": [
        {
            "provider": "digitalocean",
            "number_of_instances": 1,
            "provision": true,
            "region": "nyc3",
            "size": "s-1vcpu-1gb",
            "image": "ubuntu-22-04-x64",
            "tags": ["talis-do-instance"],
            "ssh_key_name": "your-ssh-key-name"
        }
    ]
}

CLI Commands

Infrastructure Management

# Create infrastructure
talis infra create -f config.json

# Delete infrastructure
talis infra delete -f config.json

Job Management

# List all jobs
talis jobs list

# List with filters
talis jobs list --limit 10 --status running

# Get specific job
talis jobs get --id <job-id>

Ansible Provisioning

When provision: true is set in the instance configuration, Talis will:

  1. Wait for the instance to be accessible via SSH
  2. Create an Ansible inventory file
  3. Run the Ansible playbook that:
    • Updates system packages
    • Installs required software (nginx, docker, etc.)
    • Configures basic services
    • Sets up firewall rules

The Ansible playbook can be customized by modifying ansible/playbook.yml.

Delete Instances

{
    "name": "talis",
    "project_name": "talis-pulumi-ansible",
    "instances": [
        {
            "provider": "digitalocean",
            "number_of_instances": 1,
            "region": "nyc3",
            "size": "s-1vcpu-1gb"
        }
    ]
}

Extensibility

Adding New Providers

  1. Create new file in internal/compute/ (e.g., aws.go)
  2. Implement the ComputeProvider interface
  3. Add the provider in NewComputeProvider in compute.go

Customizing Ansible

Modify files in ansible/:

  • playbook.yml: Main Ansible playbook
  • Add new roles in ansible/roles/ for modular configurations

Upcoming Features

  • More Ansible playbook options
  • AWS support
  • Webhook notification system
  • 100 Light Nodes deployment

About

🦍 Talis is a cloud-agnostic infrastructure orchestration platform for w3 to manage VMs at scale.

Topics

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published