Skip to content

enopax/provider-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Enopax Git Provider

Git Repository Provisioning and Management


Purpose

The Git Provider enables provisioning and management of bare Git repositories with SSH access. This provider integrates with the Enopax Resource API to offer Git repository hosting as a service.

Status

✅ Production Ready - Fully implemented in Provider-API

Overview

The Git Provider allows users to:

  • Create bare Git repositories
  • Configure SSH access for repositories
  • Organise repositories by organisation and project
  • Manage repository lifecycle (create, update, delete)
  • Soft delete with configurable retention periods

Features

Core Capabilities

  • Bare Repository Creation - Standard Git bare repositories
  • SSH Access - Secure SSH access with user-provided keys
  • Organisation/Project Hierarchy - Structured storage by org/project
  • Soft Delete - 30-day retention period before permanent deletion
  • Metrics - Repository size, commit count, branch information

Integration

  • Resource API - Fully integrated with Enopax Resource API
  • Platform Integration - Seamless provisioning from Enopax Platform
  • SSH URL Generation - Automatic SSH access URLs
  • Status Monitoring - Repository health and metadata

Architecture

Technology Stack

  • Bash Scripts - Resource API integration scripts
  • Git - Repository management
  • SSH - Secure access
  • File System - Local storage with organisation structure

Resource API Integration

The Git Provider follows the standard Enopax Resource API pattern:

Discovery:

GET /providers/info
# Returns Git provider metadata and configuration schema

Provision:

POST /v1/git
# Input: repository name, SSH keys, org/project identifiers
# Output: repository ID, SSH URL, status

List:

GET /v1/git?org=My%20Org&project=My%20Project
# Returns: all repositories for the specified org/project

Status:

GET /v1/git/:id
# Returns: repository status, size, metadata

Metrics:

GET /v1/git/:id/metrics
# Returns: storage size, commit count, branches, last activity

Update:

PUT /v1/git/:id
# Update: repository name or configuration

Delete:

DELETE /v1/git/:id
# Soft delete: moves to .deleted/ folder with 30-day retention

Implementation

Directory Structure

provider-git/
├── README.md                  # This file
├── CLAUDE.md                  # AI assistant guidance
└── (scripts integrated in resource-api/scripts/git-repo/)

Note: The actual implementation scripts are located in the resource-api repository at scripts/git-repo/:

resource-api/scripts/git-repo/
├── config.json                # Provider configuration
├── common.sh                  # Shared configuration
├── provision.sh               # Create repository
├── list.sh                    # List repositories
├── status.sh                  # Get repository status
├── metrics.sh                 # Get repository metrics
├── update.sh                  # Update repository
└── deprovision.sh             # Delete repository (soft delete)

Repository Storage

Repositories are stored in a hierarchical structure:

/data/repos/
├── org_slug/
│   └── project_slug/
│       ├── repo1.git/         # Bare repository
│       ├── repo2.git/         # Bare repository
│       └── .deleted/          # Soft-deleted repositories
│           └── repo_old.git/  # Deleted, 30-day retention

ID Format

Repository IDs follow the pattern: orgslug-projectslug-reponame-randomstring

Example: acme_corp-web_app-backend_api-abc123de

  • Hyphens separate components (org, project, repo, random)
  • Underscores allowed within slugs
  • Random string ensures uniqueness (8 characters)

Configuration

Provider Configuration (resource-api/scripts/git-repo/config.json)

{
  "typeId": "git-repository",
  "displayName": "Git Repository",
  "description": "Bare Git repository with SSH access",
  "category": "VERSION_CONTROL",
  "providerId": "git-provider",
  "providerName": "Git Provider",
  "version": "1.0.0",
  "supportedRegions": ["local"],
  "status": "operational",
  "configSchema": {
    "type": "object",
    "properties": {
      "repositoryName": {
        "type": "string",
        "title": "Repository Name"
      }
    },
    "required": ["repositoryName"]
  },
  "estimatedProvisioningTime": 5
}

Common Configuration (resource-api/scripts/git-repo/common.sh)

# Repository storage base path
REPOS_BASE="/data/repos"

# SSH access configuration
SSH_HOST="git.enopax.io"
DEFAULT_BRANCH="main"

# Retention period for deleted repositories (days)
RETENTION_DAYS=30

Usage Examples

Create Repository

curl -X POST http://localhost:3001/v1/git \
  -H "Content-Type: application/json" \
  -d '{
    "name": "backend-api",
    "sshKeys": ["ssh-rsa AAAAB3..."],
    "userId": "user_123",
    "projectName": "Web App",
    "organisationName": "ACME Corp"
  }'

Response:

{
  "success": true,
  "id": "acme_corp-web_app-backend_api-abc123de",
  "name": "backend-api",
  "status": "active",
  "message": "Repository created successfully",
  "access": "git@git.enopax.io:acme_corp/web_app/backend_api.git"
}

List Repositories

curl "http://localhost:3001/v1/git?org=ACME%20Corp&project=Web%20App"

Clone Repository

git clone git@git.enopax.io:acme_corp/web_app/backend_api.git

Get Repository Status

curl http://localhost:3001/v1/git/acme_corp-web_app-backend_api-abc123de

Response:

{
  "success": true,
  "id": "acme_corp-web_app-backend_api-abc123de",
  "name": "backend-api",
  "status": "active",
  "size": "15.2 MB",
  "branches": 3,
  "commits": 142,
  "lastActivity": "2025-10-09T14:30:00Z"
}

Security

SSH Key Management

  • User-provided SSH keys are configured per repository
  • No password access allowed
  • Keys stored securely in repository configuration

Access Control

  • Repository access scoped to organisation/project
  • List operations require both org and project parameters
  • Prevents cross-organisation information leakage

Isolation

  • Each repository is isolated
  • Organisation/project-based directory structure
  • Soft delete prevents accidental data loss

Soft Delete & Recovery

Deletion Process

  1. Repository moved to .deleted/ folder within project
  2. Renamed with deletion timestamp
  3. Retained for 30 days
  4. Automatically purged after retention period

Recovery (Manual)

# Move repository back from .deleted/ folder
# Rename to remove deletion timestamp
# Repository becomes active again

Monitoring

Available Metrics

  • Repository storage size
  • Number of commits
  • Number of branches
  • Last activity timestamp
  • Repository health status

Health Checks

  • Repository integrity verification
  • Disk space monitoring
  • Access permission validation

Integration with Enopax Ecosystem

Platform Integration

  • Users provision Git repositories through Enopax Platform UI
  • Repository configuration via simple forms
  • Real-time status display
  • SSH URL provided for cloning

Resource API Integration

  • Git provider registered in Resource API config.json
  • Bash scripts handle repository lifecycle
  • JSON input/output following provider API pattern
  • Multi-provider support (runs alongside other providers)

Development

Testing Scripts

# Test provision
echo '{"name":"test-repo","organizationId":"test_org","projectId":"test_project","sshKeys":[]}' | \
  bash resource-api/scripts/git-repo/provision.sh

# Test status
echo '{"id":"test_org-test_project-test_repo-abc123de"}' | \
  bash resource-api/scripts/git-repo/status.sh

# Test list
echo '{"org":"Test Org","project":"Test Project"}' | \
  bash resource-api/scripts/git-repo/list.sh

Extending Functionality

To add features:

  1. Update resource-api/scripts/git-repo/common.sh for shared configuration
  2. Modify relevant script (provision.sh, status.sh, etc.)
  3. Update config.json if schema changes
  4. Test manually before deploying
  5. Update this documentation

Troubleshooting

Common Issues

Repository creation fails:

  • Check /data/repos/ directory exists and is writable
  • Verify organisation/project slugs are valid
  • Check disk space availability

SSH access denied:

  • Verify SSH keys are correctly formatted
  • Check SSH server configuration
  • Ensure SSH keys are added to repository

Repository not found:

  • Check repository ID format
  • Verify repository hasn't been deleted
  • Check .deleted/ folder for soft-deleted repositories

Roadmap

Current Features (Implemented)

  • ✅ Bare repository creation
  • ✅ SSH access configuration
  • ✅ Organisation/project hierarchy
  • ✅ Soft delete with retention
  • ✅ Repository metrics
  • ✅ Resource API integration

Planned Enhancements

  • 📋 Web-based repository browser
  • 📋 Webhook support
  • 📋 Repository permissions management
  • 📋 Automated backups
  • 📋 Repository mirroring
  • 📋 Git LFS support

License

TBD


Repository: https://github.com/enopax/provider-git Resource API: https://github.com/enopax/resource-api Documentation: See resource-api/scripts/git-repo/ for implementation

About

Git repository provisioning and management provider for Enopax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors