Storage Backends
Manage where deployment scripts and artifacts are stored.
What is a Storage Backend?
Section titled “What is a Storage Backend?”Storage backends define where Mantis retrieves scripts and artifacts for deployments:
Storage Types
Section titled “Storage Types”Mantis supports three storage backend types:
| Type | Best For | Features |
|---|---|---|
| Local | Development, single-server | Simple paths, fast access |
| Git | Version control, GitOps | Branch tracking, audit trail |
| S3 | Large artifacts, distributed | Multi-region, immutable storage |
Choosing a Storage Type
Section titled “Choosing a Storage Type”Local Storage
Section titled “Local Storage”Best when:
- Development and testing
- Single-server deployments
- Air-gapped environments without network storage
- Quick setup without external dependencies
Git Storage
Section titled “Git Storage”Best when:
- Scripts need version control
- GitOps workflows with PR-based changes
- Audit trails via Git history are required
- Multiple teams collaborate on deployment scripts
S3 Storage
Section titled “S3 Storage”Best when:
- Large deployment artifacts
- Multi-region deployments
- Immutable artifact storage
- Cloud-native infrastructure
Storage List View
Section titled “Storage List View”┌─────────────────────────────────────────────────────────────┐│ Storage Backends │├─────────────────────────────────────────────────────────────┤│ ││ Search: [____________________________] [+ New Storage] ││ ││ ┌────────────────┬────────┬─────────────────┬───────────┐ ││ │ Name │ Type │ Location │ Actions │ ││ ├────────────────┼────────┼─────────────────┼───────────┤ ││ │ scripts │ Local │ /var/mantis/... │ [View] │ ││ │ deploy-repo │ Git │ github.com/... │ [View] │ ││ │ artifacts │ S3 │ s3://bucket/... │ [View] │ ││ └────────────────┴────────┴─────────────────┴───────────┘ ││ │└─────────────────────────────────────────────────────────────┘How Scripts Use Storage
Section titled “How Scripts Use Storage”Actions reference scripts from storage backends:
Script Reference Example
Section titled “Script Reference Example”When creating an action, you specify the storage and filename:
┌─────────────────────────────────────────────────────────────┐│ Create Action │├─────────────────────────────────────────────────────────────┤│ ││ Name: [deploy-app ] ││ ││ Payload Type: ● Script ○ Command ││ ││ Storage: [scripts ▼] ││ Filename: [deploy.sh ] ││ ││ ┌───────────────────────────────────────────────────────┐ ││ │ Script will be read from: │ ││ │ /var/mantis/scripts/deploy.sh │ ││ └───────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────┘Security
Section titled “Security”Path Traversal Protection
Section titled “Path Traversal Protection”All storage backends implement path traversal protection:
| Protection | Description |
|---|---|
| Null bytes | Rejected |
| Absolute paths | Rejected |
| Parent traversal | ../ sequences rejected |
| Canonicalization | Paths verified within storage root |
| Symlink protection | Files read with O_NOFOLLOW (Unix) |
Example: Blocked Access
Section titled “Example: Blocked Access”# These filenames are blocked:../../../etc/passwd # Parent traversal/etc/passwd # Absolute pathscript�.sh # Null byte injectionCredential Security
Section titled “Credential Security”Sensitive credentials are encrypted at rest:
| Storage Type | Encrypted Fields |
|---|---|
| Git | SSH private key, SSH passphrase, password |
| S3 | Access key ID, secret access key |
Encryption uses AES-256-GCM with AAD binding.
Creating a Storage Backend
Section titled “Creating a Storage Backend”Via Lens UI
Section titled “Via Lens UI”- Navigate to Storage in the sidebar (under Infrastructure)
- Click New Storage
- Click the tab for your storage type
- Configure backend-specific settings
- Click Create
Via REST API
Section titled “Via REST API”Storage sources are managed in Lens or through the /api/v1/storage/* endpoints
(there is no mantisctl storage subcommand). Each backend has its own endpoint:
# Create local storagecurl -X POST "$MANTIS_URL/api/v1/storage/local" \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"name": "scripts", "path": "/var/mantis/scripts"}'
# Create git storage (auth_id references a git auth credential)curl -X POST "$MANTIS_URL/api/v1/storage/git" \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{ "name": "deploy-repo", "path": "/var/mantis/git/deploy-repo", "url": "https://github.com/org/scripts.git", "reference": "main", "auth_id": "<git-auth-id>" }'
# Create S3 storage (static credentials)curl -X POST "$MANTIS_URL/api/v1/storage/s3" \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{ "name": "artifacts", "bucket": "my-artifacts-bucket", "region": "us-west-2", "path_prefix": "deployments/", "auth_type": "static", "access_key_id": "AKIA...", "secret_access_key": "..." }'Storage Configuration
Section titled “Storage Configuration”Common Settings
Section titled “Common Settings”| Setting | Required | Description |
|---|---|---|
| Name | Yes | Unique identifier |
| Type | Yes | Local, Git, or S3 |
Type-Specific Settings
Section titled “Type-Specific Settings”See detailed configuration guides:
Best Practices
Section titled “Best Practices”1. Use Git for Version Control
Section titled “1. Use Git for Version Control”Store deployment scripts in Git for:
- Change history and audit trails
- PR-based review workflows
- Rollback to previous versions
2. Use S3 for Large Artifacts
Section titled “2. Use S3 for Large Artifacts”Use S3 for binary artifacts:
- Application packages
- Container images
- Large data files
3. Use Local for Development
Section titled “3. Use Local for Development”Local storage is ideal for:
- Quick iteration during development
- Testing new scripts
- Air-gapped environments
4. Organize by Purpose
Section titled “4. Organize by Purpose”Create separate storages for different purposes:
Storage Backends:├── scripts-local # Development scripts├── scripts-git # Production scripts (version controlled)├── artifacts-dev # Development artifacts└── artifacts-prod # Production artifactsTroubleshooting
Section titled “Troubleshooting”Cannot Read Script from Storage
Section titled “Cannot Read Script from Storage”Cause: File doesn’t exist or path is incorrect
Solution:
- Verify file exists in storage location
- Check filename spelling (case-sensitive)
- Ensure storage backend is accessible
Git Storage Not Updating
Section titled “Git Storage Not Updating”Cause: Cache or authentication issues
Solution:
- Check last fetch time
- Verify authentication credentials
- Manually trigger refresh
S3 Access Denied
Section titled “S3 Access Denied”Cause: Insufficient permissions
Solution:
- Check IAM policy allows required actions
- Verify bucket policy
- Confirm credential configuration
Next Steps
Section titled “Next Steps”- Local Storage - Configure local file storage
- Git Storage - Set up Git repositories
- S3 Storage - Configure S3 buckets
- Authentication - Manage storage credentials
