Skip to main content

Overview

Dokploy’s API enables powerful automation capabilities, allowing you to integrate deployments into your existing CI/CD pipelines, automate infrastructure management, and create custom deployment workflows.

CI/CD Integration

GitHub Actions

Automate deployments when code is pushed to your repository:
.github/workflows/deploy.yml
Store your API tokens and sensitive information in GitHub Secrets, not in your workflow files.

GitLab CI/CD

Integrate with GitLab pipelines:
.gitlab-ci.yml

Jenkins Pipeline

Create a Jenkins pipeline for Dokploy deployments:
Jenkinsfile

Bitbucket Pipelines

bitbucket-pipelines.yml

Webhook-Based Automation

Dokploy supports webhooks for triggering deployments without requiring API tokens in your repository.

Setting Up Webhooks

  1. Navigate to your application in Dokploy
  2. Go to Settings > Webhooks
  3. Click Generate Webhook URL
  4. Copy the webhook URL

Using Webhooks

.github/workflows/deploy.yml
Webhooks are specific to each application and don’t require authentication, making them ideal for public repositories.

Automated Infrastructure Provisioning

Infrastructure as Code Script

Create a script to provision your entire infrastructure:
provision.sh

Scheduled Tasks

Automated Backups with Cron

Schedule regular database backups:
backup.sh
Add to crontab for daily backups at 2 AM:

Health Check Automation

Monitor and restart unhealthy applications:
healthcheck.sh

Multi-Environment Deployments

Deploy to Multiple Environments

deploy-multi-env.sh
Usage:

Integration with Development Tools

VS Code Task

Create a VS Code task for quick deployments:
.vscode/tasks.json

Make Commands

Simplify deployments with a Makefile:
Makefile
Usage:

Advanced Automation Examples

Blue-Green Deployments

blue-green-deploy.sh

Canary Deployments

Gradually roll out updates:
canary-deploy.sh

Best Practices

  • Store API tokens in environment variables or secret management systems
  • Never commit tokens to version control
  • Rotate tokens regularly
  • Use different tokens for different environments
  • Always check API response status codes
  • Implement retry logic for transient failures
  • Log all automation activities
  • Set up alerts for failed deployments
  • Test automation scripts in staging before production
  • Implement rollback mechanisms
  • Verify deployments with health checks
  • Monitor application metrics post-deployment
  • Document your automation workflows
  • Keep scripts version-controlled
  • Include usage examples and prerequisites
  • Maintain a deployment runbook

Monitoring Automation

Track automation success with monitoring tools:

Resources

API Reference

Complete API endpoint documentation

CLI Commands

Available CLI commands reference

Deployment Guide

Learn about deployment strategies

Monitoring

Set up monitoring and alerts