Overview
Dockhand’s Git integration enables automatic deployment of Docker Compose stacks directly from Git repositories. Connect to GitHub, GitLab, or any Git server and automatically sync changes, trigger deployments via webhooks, and maintain version-controlled infrastructure.Key Features
- Repository Management: Connect to any Git repository (GitHub, GitLab, Bitbucket, self-hosted)
- Automatic Sync: Schedule periodic syncs to check for updates
- Webhook Support: Instant deployments triggered by Git push events
- Credential Management: Secure storage for SSH keys and access tokens
- Multi-Stack Support: Deploy multiple stacks from a single repository
- Branch Selection: Deploy from any branch (main, develop, feature branches)
- Environment Files: Automatic
.envfile handling from repository
Repository Configuration
Creating a Git Repository Connection
- Navigate to Git → Repositories
- Click Add Repository
- Configure the repository settings:
Authentication Methods
Dockhand supports multiple authentication methods:SSH Key Authentication
HTTPS with Token
Public Repositories
Git Stacks
What are Git Stacks?
Git stacks are Docker Compose stacks that are automatically deployed from a Git repository. They maintain synchronization with the repository and can be configured for automatic updates.Creating a Git Stack
Stack Deployment Process
When a Git stack is deployed, Dockhand:- Clones or pulls the latest changes from the repository
- Checks out the specified branch
- Loads environment variables from the
.envfile (if specified) - Applies stack variables from Dockhand’s variable management
- Runs docker compose up with the specified compose file
- Records deployment logs for audit and troubleshooting
Webhook Integration
GitHub Webhooks
-
Get your webhook URL from Dockhand:
- In your GitHub repository, go to Settings → Webhooks → Add webhook
-
Configure the webhook:
- Payload URL: Your Dockhand webhook URL
- Content type:
application/json - Secret: Generate a secret in Dockhand and paste it here
- Events: Select “Just the push event”
GitLab Webhooks
- In your GitLab project, go to Settings → Webhooks
-
Configure the webhook:
- URL: Your Dockhand webhook URL
- Secret token: Your Dockhand webhook secret
- Trigger: Check “Push events”
- SSL verification: Enable for production
Webhook Security
Dockhand verifies webhook signatures to ensure authenticity:Automatic Sync
Scheduled Synchronization
Configure automatic sync with cron expressions:Sync Behavior
The scheduler implements intelligent sync behavior:Environment Variables
Repository .env Files
Dockhand can automatically load environment variables from files in your repository:Stack Variable Override
Variables defined in Dockhand take precedence over repository files:- Repository
.envfile (lowest priority) - Stack-specific variables in Dockhand
- Environment variables set at deploy time (highest priority)
Manual Operations
Sync Repository
Manually trigger a sync to check for updates:Deploy Stack
Manually deploy a Git stack:Best Practices
Repository Structure
Security Recommendations
- Never commit secrets to your repository
- Use webhook secrets to verify authenticity
- Rotate credentials periodically
- Use read-only deploy keys when possible
- Enable SSL verification for webhooks
- Store sensitive env vars in Dockhand, not in repository files
Deployment Strategies
Blue-Green Deployments
Use Git branches for zero-downtime deployments:Multi-Environment Setup
Troubleshooting
Common Issues
Authentication Failed
Webhook Not Triggering
- Check webhook secret matches in both GitHub/GitLab and Dockhand
- Verify webhook URL is accessible from the internet
- Check webhook delivery logs in your Git provider
- Ensure SSL certificate is valid (or disable verification for testing)
