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
- 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
- Go (1.22 or higher)
- Ansible (2.9 or higher)
- SSH key pair for instance access
- Cloud Credentials:
- For DigitalOcean: Personal Access Token in
DIGITALOCEAN_TOKEN
environment variable - For Linode: Coming soon
- For Vultr: Comming soon
- For DataPacket: Coming soon
- For DigitalOcean: Personal Access Token in
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
- main.go: Application entry point with server setup
- handlers/: HTTP request handlers
- middleware/: API middleware (logging, auth, etc.)
- routes/: API route definitions
- job/: Job service implementation with business logic
- compute.go: Defines the
ComputeProvider
interface and common types - digitalocean.go:
ComputeProvider
implementation for DigitalOcean - ansible.go: Ansible configuration and provisioning
- job/: Job database models and operations
- job/: Job domain models, interfaces and business rules
- persistence/postgres/: PostgreSQL implementations of repositories
- models.go: Main data structure definitions
- validation.go: Request validation
- infrastructure.go: Main infrastructure management logic
- playbook.yml: Main Ansible playbook
- inventory_*_ansible.ini: Generated inventory files
- Copy
.env.example
to.env
:
cp .env.example .env
- Configure environment variables:
# DigitalOcean
DIGITALOCEAN_TOKEN=your_digitalocean_token_here
SSH_KEY_ID=your_key_id_here
- Ensure your SSH key is available:
# The default path is /root/.ssh/id_rsa
# You can specify a different path in the request
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
{
"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"
}
]
}
# Create infrastructure
talis infra create -f config.json
# Delete infrastructure
talis infra delete -f config.json
# 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>
When provision: true
is set in the instance configuration, Talis will:
- Wait for the instance to be accessible via SSH
- Create an Ansible inventory file
- 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
.
{
"name": "talis",
"project_name": "talis-pulumi-ansible",
"instances": [
{
"provider": "digitalocean",
"number_of_instances": 1,
"region": "nyc3",
"size": "s-1vcpu-1gb"
}
]
}
- Create new file in
internal/compute/
(e.g.,aws.go
) - Implement the
ComputeProvider
interface - Add the provider in
NewComputeProvider
incompute.go
Modify files in ansible/
:
playbook.yml
: Main Ansible playbook- Add new roles in
ansible/roles/
for modular configurations
- More Ansible playbook options
- AWS support
- Webhook notification system
- 100 Light Nodes deployment