SSH Manager uses profiles to provide project-specific configurations. Profiles define command aliases and hooks tailored to different project types.
- default - Basic SSH operations (minimal setup)
- frappe - Frappe/ERPNext framework commands
- docker - Docker container management
- nodejs - Node.js application deployment
- Environment Variable:
export SSH_MANAGER_PROFILE=frappe- Configuration File:
Create
.ssh-manager-profilein project root:
frappe
- Via Claude Code:
"Switch to frappe profile"
"Show current profile"
"List available profiles"
Command aliases are shortcuts for frequently used commands. They are loaded from your active profile.
Each profile provides relevant aliases:
check-memory→ Display memory usagecheck-disk→ Display disk usagesystem-info→ System informationtail-logs→ Tail logs with 100 lines
bench-update→ Full bench update with all flagsbench-restart→ Restart all bench servicesbench-migrate→ Run migrationsbench-clear-cache→ Clear cache- And 20+ more Frappe-specific commands
docker-ps→ List all containersdocker-logs→ View container logsdocker-restart→ Restart containersdocker-clean→ Clean unused resources
npm-install→ Production installpm2-restart→ Restart PM2 appsnpm-build→ Build applicationaudit-fix→ Fix security issues
"Execute bench-update on production server"
"Run bench-restart on dmis"
"Execute check-memory on develop"
"List all command aliases"
"Add command alias 'my-backup' for command 'bench --site mysite.com backup --with-files'"
"Remove command alias 'my-backup'"
"Suggest aliases for 'bench'"
Hooks provide automated actions that run before, after, or on error during SSH operations. Like aliases, hooks are loaded from your active profile.
Each profile defines relevant hooks:
- on-error: Logs errors to file
- pre-bench-update: Creates backup, checks disk space
- post-bench-update: Verifies services, clears cache
- pre-deploy: Validates bench status
- post-deploy: Restarts workers, clears cache
- pre-deploy: Checks Docker, backs up volumes
- post-deploy: Verifies containers, restarts if needed
- pre-deploy: Checks Node.js, runs tests
- post-deploy: Installs dependencies, restarts app
"List all SSH hooks"
"Show SSH hooks status"
"Enable pre-connect hook"
"Disable post-connect hook"
- Location:
.ssh-manager-profile - Contains the active profile name
- Location:
.command-aliases.json - Contains custom aliases (overrides profile aliases)
- Location:
.hooks-config.json - Contains custom hook definitions (overrides profile hooks)
- Location:
profiles/directory - JSON files defining profile-specific configurations
- Location:
hooks/directory - Custom scripts can be placed here
Some hooks require environment variables:
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"You can create your own profile for specific project types:
- Create a JSON file in
profiles/directory - Define your aliases and hooks
- Switch to your profile
Example: profiles/my-project.json
{
"name": "my-project",
"description": "Custom profile for my project",
"commandAliases": {
"deploy": "git pull && make install && systemctl restart myapp",
"logs": "journalctl -u myapp -f",
"status": "systemctl status myapp"
},
"hooks": {
"pre-deploy": {
"enabled": true,
"actions": [
{
"type": "validation",
"name": "run-tests",
"command": "make test"
}
]
}
}
}# For a Frappe project
"Switch to frappe profile"
"Execute bench-update on production"
# For a Docker project
"Switch to docker profile"
"Execute docker-logs on staging"
# For a Node.js project
"Switch to nodejs profile"
"Execute pm2-restart on production"
- Deployment with validation
"Deploy config.json to production:/etc/app/config.json"
This will:
- Run
pre-deployhook (check Git status) - Deploy the file
- Run
post-deployhook (log and notify)
- Bench update with safety
"Execute bench-update on production"
This will:
- Run
pre-bench-updatehook (backup and check disk) - Execute the update
- Run
post-bench-updatehook (verify services)
You can combine aliases and hooks for powerful automation:
- Create a custom alias for your deployment command
- Enable appropriate hooks for validation
- Execute with a simple command
Example:
"Add command alias 'safe-deploy' for 'bench --site all migrate && bench build && bench restart'"
"Execute safe-deploy on production"
- Always keep backups enabled for production deployments
- Use aliases for complex commands to avoid errors
- Enable pre-deployment hooks to catch issues early
- Configure notifications for production deployments
- Test hooks on staging before enabling on production
- Check if hook is enabled:
"Show SSH hooks status" - Verify required environment variables are set
- Check
.hooks-config.jsonfor proper configuration
- List aliases to verify:
"List all command aliases" - Check
.command-aliases.jsonfor syntax errors - Ensure the base command is valid
- Check
deployments.logfor history - Review
errors.logfor error details - Verify disk space and permissions on target server