Skip to content

Local Storage

Store deployment scripts on the local filesystem.

Local storage provides direct access to scripts stored on the Mantis server’s filesystem:

Use CaseRecommendation
DevelopmentIdeal for quick iteration
Single serverWorks well without external dependencies
Air-gappedOnly option without network storage
TestingFast access for test scripts
MigrationTemporary storage during system migration
PropertyRequiredDescription
NameYesUnique identifier for the storage
PathYesAbsolute path to scripts directory
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Create Local Storage β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ Name * β”‚
β”‚ [scripts ] β”‚
β”‚ β”‚
β”‚ Path * β”‚
β”‚ [/var/mantis/scripts ] β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Path must be an absolute path accessible by the β”‚ β”‚
β”‚ β”‚ Mantis server process. β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ [Cancel] [Create] β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Navigate to Storage in the sidebar (under Infrastructure)
  2. Click New Storage
  3. Click the Local Storage tab
  4. Enter a unique name
  5. Enter the absolute path
  6. Click Create
Terminal window
# Create local storage
curl -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 with a different base path
curl -X POST "$MANTIS_URL/api/v1/storage/local" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name": "dev-scripts", "path": "/home/deploy/scripts"}'

Organize scripts within the storage directory:

/var/mantis/scripts/
β”œβ”€β”€ deploy/
β”‚ β”œβ”€β”€ web-app.sh
β”‚ β”œβ”€β”€ api-service.sh
β”‚ └── database.sh
β”œβ”€β”€ configure/
β”‚ β”œβ”€β”€ nginx.sh
β”‚ β”œβ”€β”€ ssl-certs.sh
β”‚ └── firewall.sh
β”œβ”€β”€ health/
β”‚ β”œβ”€β”€ check-web.sh
β”‚ └── check-database.sh
└── rollback/
└── restore-backup.sh

When creating actions, reference scripts relative to the storage path:

Storage PathFilenameFull Path
/var/mantis/scriptsdeploy/web-app.sh/var/mantis/scripts/deploy/web-app.sh
/var/mantis/scriptsconfigure/nginx.sh/var/mantis/scripts/configure/nginx.sh
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Local Storage: scripts β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ Type: Local β”‚
β”‚ Path: /var/mantis/scripts β”‚
β”‚ Created: January 15, 2024 β”‚
β”‚ β”‚
β”‚ ───────────────────────────────────────────────────────── β”‚
β”‚ β”‚
β”‚ Used By (3 actions): β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Action β”‚ Filename β”‚ β”‚
β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ deploy-web β”‚ deploy/web-app.sh β”‚ β”‚
β”‚ β”‚ configure-nginx β”‚ configure/nginx.sh β”‚ β”‚
β”‚ β”‚ health-check β”‚ health/check-web.sh β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ [Edit] [Delete] β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The Mantis server process must have read access to the storage directory:

Terminal window
# Check current permissions
ls -la /var/mantis/scripts/
# Set appropriate ownership
chown -R mantis:mantis /var/mantis/scripts/
# Set appropriate permissions
chmod -R 755 /var/mantis/scripts/
ActionPermission Needed
Read scriptsr (read)
List directoryr and x (read + execute on directory)

If using SELinux or AppArmor, ensure the Mantis process has access:

Terminal window
# SELinux example
semanage fcontext -a -t mantis_script_t "/var/mantis/scripts(/.*)?"
restorecon -Rv /var/mantis/scripts/

Scripts can be added directly to the filesystem:

Terminal window
# Copy script to storage
cp deploy.sh /var/mantis/scripts/deploy/
# Set executable permission
chmod +x /var/mantis/scripts/deploy/deploy.sh

Update scripts in place:

Terminal window
# Edit script
vim /var/mantis/scripts/deploy/web-app.sh
# Or copy updated version
cp ~/new-deploy.sh /var/mantis/scripts/deploy/web-app.sh
Terminal window
# Remove script
rm /var/mantis/scripts/deploy/old-script.sh

Local storage doesn’t automatically sync across multiple Mantis servers:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Mantis Server 1β”‚ β”‚ Mantis Server 2β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ /scripts/ β”‚ β”‚ ? β”‚ β”‚ /scripts/ β”‚ β”‚
β”‚ β”‚ deploy.sh β”‚ β”‚ ───── β”‚ β”‚ (empty) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
SolutionDescription
Shared filesystemNFS, EFS, or similar network filesystem
Configuration managementAnsible, Puppet, Chef to sync scripts
Git storageUse Git storage instead for automatic sync
S3 storageUse S3 storage for centralized access
Terminal window
# Mount NFS share for scripts
mount -t nfs storage-server:/exports/scripts /var/mantis/scripts
# Add to fstab for persistence
echo "storage-server:/exports/scripts /var/mantis/scripts nfs defaults 0 0" >> /etc/fstab

Always configure with absolute paths:

GoodAvoid
/var/mantis/scripts./scripts
/home/deploy/scripts~/scripts
/opt/mantis/scriptsscripts/

Organize scripts logically:

/var/mantis/scripts/
β”œβ”€β”€ by-solution/ # Organized by solution
β”‚ β”œβ”€β”€ customer-portal/
β”‚ └── auth-service/
β”œβ”€β”€ by-action/ # Organized by action type
β”‚ β”œβ”€β”€ deploy/
β”‚ β”œβ”€β”€ configure/
β”‚ └── rollback/
└── shared/ # Common scripts
└── utilities.sh

If using local storage, maintain version control separately:

Terminal window
# Keep scripts in Git repository
cd /var/mantis/scripts
git init
git add .
git commit -m "Initial scripts"

Include local storage in backup strategy:

Terminal window
# Backup scripts
tar -czvf scripts-backup-$(date +%Y%m%d).tar.gz /var/mantis/scripts/

Cause: Script doesn’t exist at specified path

Solution:

  1. Verify file exists: ls -la /var/mantis/scripts/deploy.sh
  2. Check filename is correct (case-sensitive)
  3. Ensure path includes subdirectories if used

Cause: Mantis process lacks read permission

Solution:

  1. Check file permissions: ls -la /var/mantis/scripts/
  2. Fix ownership: chown mantis:mantis /var/mantis/scripts/*
  3. Fix permissions: chmod 755 /var/mantis/scripts/*

Cause: Path changed or mount point not restored

Solution:

  1. Verify mount is active: mount | grep scripts
  2. Check fstab for persistent mounts
  3. Remount if needed: mount -a