Last updated: Aug 12, 2025, 01:09 PM UTC

Sliplane API Integration Plan

Generated: 2025-08-11 UTC
Purpose: Future enhancement plan for automating Sliplane deployments via REST API


Overview

Sliplane now offers a REST API (as of June 2025) that enables programmatic control over deployments, volume management, and service configuration. This document outlines how we can enhance our client management system to fully automate the deployment process.


Current vs Future State

Current State (Manual)

  1. Run deploy-client.sh to trigger webhook
  2. Manually create volumes in Sliplane dashboard
  3. Manually configure environment variables
  4. Manually set up service configuration

Future State (Automated)

  1. Run deploy-client.sh with full automation:
    • API creates service if not exists
    • API creates client-specific volumes
    • API configures environment variables
    • API triggers deployment
    • API verifies deployment status

API Documentation

API Endpoint

  • Base URL: https://api.sliplane.io/v1/
  • Documentation: Available at ctrl.sliplane.io
  • Authentication: Bearer token required

Key Endpoints (Based on Research)

Projects & Services

GET    /projects                    # List all projects
POST   /projects                    # Create new project
GET    /projects/{id}/services      # List services in project
POST   /projects/{id}/services      # Create new service

Deployments

POST   /services/{id}/deploy        # Trigger deployment
GET    /services/{id}/status        # Check deployment status
POST   /projects/{id}/builds        # Trigger build

Volumes (Anticipated)

GET    /servers/{id}/volumes        # List volumes on server
POST   /servers/{id}/volumes        # Create new volume
POST   /services/{id}/volumes       # Attach volume to service
DELETE /services/{id}/volumes/{vid} # Detach volume from service

Environment Variables

GET    /services/{id}/env           # Get environment variables
PUT    /services/{id}/env           # Update environment variables

Implementation Plan

Phase 1: API Client Library

Create lib/sliplane-api.sh with functions:

#!/bin/bash

# Sliplane API configuration
SLIPLANE_API_BASE="https://api.sliplane.io/v1"
SLIPLANE_API_TOKEN="${SLIPLANE_API_TOKEN:-}"

# Function: Authenticate and get token
sliplane_auth() {
    local email=$1
    local password=$2
    
    RESPONSE=$(curl -s -X POST "$SLIPLANE_API_BASE/auth/login" \
        -H "Content-Type: application/json" \
        -d "{\"email\": \"$email\", \"password\": \"$password\"}")
    
    SLIPLANE_API_TOKEN=$(echo "$RESPONSE" | jq -r '.token')
    export SLIPLANE_API_TOKEN
}

# Function: Create volume
sliplane_create_volume() {
    local server_id=$1
    local volume_name=$2
    local size=$3
    
    curl -s -X POST "$SLIPLANE_API_BASE/servers/$server_id/volumes" \
        -H "Authorization: Bearer $SLIPLANE_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d "{
            \"name\": \"$volume_name\",
            \"size\": \"$size\"
        }"
}

# Function: Attach volume to service
sliplane_attach_volume() {
    local service_id=$1
    local volume_id=$2
    local mount_path=$3
    
    curl -s -X POST "$SLIPLANE_API_BASE/services/$service_id/volumes" \
        -H "Authorization: Bearer $SLIPLANE_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d "{
            \"volume_id\": \"$volume_id\",
            \"mount_path\": \"$mount_path\"
        }"
}

# Function: Deploy service
sliplane_deploy() {
    local service_id=$1
    local image=$2
    
    curl -s -X POST "$SLIPLANE_API_BASE/services/$service_id/deploy" \
        -H "Authorization: Bearer $SLIPLANE_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d "{
            \"image\": \"$image\",
            \"strategy\": \"rolling\"
        }"
}

Phase 2: Enhanced Client Configuration

Update config.json structure to include API metadata:

{
  "client_id": "hirebest",
  "deployment": {
    "sliplane": {
      "project_id": "project_abc123",
      "service_id": "service_xyz789",
      "server_id": "server_def456",
      "volumes": {
        "data": {"id": null, "size": "1GB"},
        "docs": {"id": null, "size": "5GB"},
        "uploads": {"id": null, "size": "10GB"},
        "config": {"id": null, "size": "100MB"},
        "workspaces": {"id": null, "size": "5GB"}
      }
    }
  }
}

Phase 3: Automated Volume Creation

Add to deploy-client.sh:

# Function: Create volumes via API
create_client_volumes() {
    local client=$1
    local server_id=$2
    
    echo "Creating volumes for $client..."
    
    # Create each volume type
    for volume_type in data docs uploads config workspaces; do
        local volume_name="${client}-${volume_type}"
        local size=$(get_volume_size "$volume_type")
        
        echo "  Creating $volume_name ($size)..."
        VOLUME_ID=$(sliplane_create_volume "$server_id" "$volume_name" "$size" | jq -r '.id')
        
        # Attach to service
        local mount_path="/app/${volume_type}"
        sliplane_attach_volume "$SERVICE_ID" "$VOLUME_ID" "$mount_path"
        
        # Update config with volume ID
        update_config_volume_id "$client" "$volume_type" "$VOLUME_ID"
    done
}

Phase 4: Full Deployment Automation

Complete automated deployment flow:

# Enhanced deployment with API
deploy_client_with_api() {
    local client=$1
    
    # 1. Authenticate
    sliplane_auth "$SLIPLANE_EMAIL" "$SLIPLANE_PASSWORD"
    
    # 2. Check if service exists
    SERVICE_ID=$(get_service_id "$client")
    if [ -z "$SERVICE_ID" ]; then
        # Create new service
        SERVICE_ID=$(create_service "$client")
    fi
    
    # 3. Check and create volumes
    check_and_create_volumes "$client" "$SERVICE_ID"
    
    # 4. Set environment variables
    set_environment_variables "$SERVICE_ID" "$client"
    
    # 5. Deploy
    sliplane_deploy "$SERVICE_ID" "$DOCKER_IMAGE"
    
    # 6. Monitor deployment
    monitor_deployment "$SERVICE_ID"
}

Benefits of API Integration

Immediate Benefits

  1. One-Command Deployment: Complete setup with single command
  2. Eliminate Manual Errors: No risk of wrong volume names
  3. Faster Onboarding: New clients deployed in minutes
  4. Consistent Configuration: Guaranteed proper setup

Long-Term Benefits

  1. CI/CD Integration: Deploy from GitHub Actions
  2. Bulk Operations: Deploy multiple clients simultaneously
  3. Infrastructure as Code: Version control deployment configs
  4. Automated Scaling: Programmatically adjust resources

Implementation Checklist

Prerequisites

  • Obtain Sliplane API documentation from ctrl.sliplane.io
  • Get API authentication credentials
  • Test API endpoints manually
  • Document rate limits and quotas

Development Tasks

  • Create lib/sliplane-api.sh library
  • Add API token to secure configuration
  • Update client config structure
  • Enhance deploy-client.sh with API calls
  • Add --use-api flag for API deployment
  • Create automated tests
  • Document API usage

Testing

  • Test volume creation via API
  • Test service deployment via API
  • Test environment variable setting
  • Test error handling
  • Test rollback procedures

Security Considerations

API Token Management

# Store in .env file (never commit)
SLIPLANE_API_TOKEN=your-secret-token

# Or use environment variable
export SLIPLANE_API_TOKEN="your-secret-token"

# Or use secure credential store
SLIPLANE_API_TOKEN=$(vault read -field=token secret/sliplane)

Best Practices

  1. Never hardcode API tokens
  2. Use separate tokens per environment
  3. Rotate tokens regularly
  4. Implement proper error handling
  5. Log API calls for audit trail

Migration Strategy

For Existing Manual Deployments

  1. Inventory: List all existing deployments
  2. Map Resources: Document volume names and IDs
  3. Update Configs: Add API metadata to configs
  4. Test Migration: Try with one client first
  5. Gradual Rollout: Migrate clients incrementally

Backwards Compatibility

  • Keep manual deployment option with --manual flag
  • Support both webhook and API deployment
  • Graceful fallback if API unavailable

🚦 Example Usage (Future)

Simple Deployment

# Fully automated deployment via API
./deploy-client.sh hirebest --use-api

Bulk Deployment

# Deploy multiple clients
for client in hirebest sasha-main acme-corp; do
    ./deploy-client.sh $client --use-api --parallel
done

CI/CD Integration

# GitHub Actions example
- name: Deploy to Sliplane
  env:
    SLIPLANE_API_TOKEN: ${{ secrets.SLIPLANE_API_TOKEN }}
  run: |
    ./deploy-client.sh ${{ matrix.client }} --use-api

Resources

Sliplane Documentation

Integration Examples

  • GitHub Actions workflows
  • GitLab CI pipelines
  • Jenkins jobs
  • n8n workflows

Success Metrics

Deployment Time

  • Current: 10-15 minutes (manual)
  • Target: 2-3 minutes (automated)

Error Rate

  • Current: 5-10% (human error)
  • Target: <1% (automated validation)

Client Onboarding

  • Current: 30 minutes per client
  • Target: 5 minutes per client

This plan outlines the path to fully automated, API-driven deployments for Sasha Studio multi-client infrastructure.