Files
website/apps/docs-new/content/docs/core/auto-deploy.mdx
Mauricio Siu 95682a01c2 feat: add new documentation and assets for the website
- Introduced new MDX components and configuration files for the documentation site.
- Added various images and icons to enhance the visual representation of the documentation.
- Updated package.json and pnpm-lock.yaml to include new dependencies for the documentation.
- Created a .gitignore file for the new docs app to manage ignored files effectively.
- Enhanced README with instructions for restarting the dev server after adding new MDX files.
2025-12-07 05:12:07 -06:00

112 lines
3.5 KiB
Plaintext

---
title: Auto Deploy
description: Automatically deploying your application to Dokploy can be achieved through two primary methods using Webhooks or the Dokploy API. Each method supports various platforms and provides a streamlined deployment process.
---
## Supported Services:
Auto deploy is only valid for the following services:
- Applications
- Docker Compose
## Github
For Github, we provide autodeploy without any configuration. This will automatically deploy your application whenever you push to your repository.
## Webhook URL
Webhooks allow you to automatically deploy your application whenever changes are made in your source repository.
- GitHub
- GitLab
- Bitbucket
- Gitea
- DockerHub (Only for Applications)
### Configuration Steps
1. **Enable Auto Deploy**: Toggle the 'Auto Deploy' button found in the general tab of your application settings in Dokploy.
2. **Obtain Webhook URL**: Locate the Webhook URL from the deployment logs.
<ImageZoom
src="/assets/webhook-url.png"
alt="Webhook URL"
width={1000}
height={500}
/>
3. **Configure Your Repository**:
- Navigate to your repository settings on your chosen platform.
- Add the webhook URL provided by Dokploy.
- Ensure the settings match the configuration necessary for triggering the webhook.
<ImageZoom
src="/assets/webhook-github.png"
alt="Webhook URL"
width={1000}
height={500}
/>
#### Important Notes
- **Branch Matching**: When using Git-based providers (GitHub, GitLab, Gitea, etc.), ensure that the branch configured in Dokploy matches the branch you intend to push to. Misalignment will result in a "Branch Not Match" error.
- **Docker Tags**: For deployments using DockerHub, ensure the tag pushed matches the one specified in Dokploy.
- The steps are the same for all the providers.
<Callout type="info">
The steps are almost the same for all the Git providers, GitHub, GitLab, Bitbucket, Gitea.
</Callout>
## Dockerhub (Only Applications)
To setup auto deploys for Dockerhub, follow the steps below:
1. Go to your application and select `Deployments` tab.
2. Copy the `Webhook URL`.
3. Go to your Dockerhub repository and select `Webhooks` tab.
4. Set a name for the webhook and paste the `Webhook URL` copied in step 2.
5. That's it, now every time you push to your repository, your application will trigger a deployment in dokploy.
The deployment will trigger only if the `Tag` matches the one specified in Dokploy.
## API Method
Deploy your application programmatically using the Dokploy API from anywhere, this is useful when you want to trigger a deployment from a CI/CD pipeline or from a script.
### Steps to Deploy Using API
Steps:
1. **Generate a Token**: Create an API token in your profile settings on Dokploy.
2. **Retrieve Application ID**:
```http
curl -X 'GET' \
'https://your-domain/api/project.all' \
-H 'accept: application/json' \
-H 'x-api-key: <token>'
```
This command lists all projects and services. Identify the applicationId for the application you wish to deploy.
3. **Trigger Deployment**:
```http
curl -X 'POST' \
'https://your-domain/api/application.deploy' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: <token>' \
-d '{
"applicationId": "string"
}'
```
This API method allows for flexible, scriptable deployment options, suitable for automated systems or situations where direct repository integration is not feasible.
In this way you can deploy your application from anywhere, you can use the webhook URL or the API.