|
| 1 | +--- |
| 2 | +title: Watch Paths |
| 3 | +description: Learn how to use watch paths in your application or docker compose. |
| 4 | +--- |
| 5 | + |
| 6 | +Watch paths are a feature that allows you to monitor specific directories or files for changes and automatically trigger actions when modifications occur. |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Watch paths functionality is available for both standalone applications and Docker Compose configurations. This feature helps automate deployments based on file changes in your repository. |
| 11 | + |
| 12 | +## Supported Source Providers |
| 13 | + |
| 14 | +The following source control providers are supported: |
| 15 | + |
| 16 | +- GitHub |
| 17 | +- GitLab |
| 18 | +- Bitbucket |
| 19 | +- Git (works with Bitbucket, Github, and GitLab repositories) |
| 20 | + |
| 21 | +## Basic Usage |
| 22 | + |
| 23 | +Let's say you have a project with the following directory structure: |
| 24 | + |
| 25 | +``` |
| 26 | +my-app/ |
| 27 | +├── src/ |
| 28 | +│ ├── index.js |
| 29 | +├── public/ |
| 30 | +``` |
| 31 | + |
| 32 | +By default, dokploy accepts an array of paths, allowing you to monitor multiple locations. For example: |
| 33 | + |
| 34 | +- To trigger deployments when any file in the `src/` directory changes, use the pattern: `src/*` |
| 35 | +- To monitor a specific file, simply specify its path: `src/index.js` |
| 36 | + |
| 37 | +## Configuration |
| 38 | + |
| 39 | +Watch Paths works out of the box with zero configuration when using GitHub as your provider. For other providers, you'll need to first set up auto-deploys as explained in: |
| 40 | + |
| 41 | +- [Auto Deploy](/docs/core/auto-deploy) |
| 42 | +- [Bitbucket Integration](/docs/core/bitbucket) |
| 43 | +- [GitLab Integration](/docs/core/gitlab) |
| 44 | +- [GitHub Integration](/docs/core/github) |
| 45 | + |
| 46 | +Note: When using the Git provider, the functionality will only work with GitHub, GitLab, or Bitbucket repositories. |
| 47 | + |
| 48 | +## Pattern Matching Features |
| 49 | + |
| 50 | +We support a wide range of pattern matching features: |
| 51 | + |
| 52 | +- Multiple glob patterns |
| 53 | +- Wildcards: |
| 54 | + - `**` (matches any number of directories) |
| 55 | + - `*.js` (matches all JavaScript files) |
| 56 | +- Negation patterns: |
| 57 | + - `!a/*.js` (excludes JavaScript files in directory 'a') |
| 58 | + - `*!(b).js` (matches all JavaScript files except those ending with 'b') |
| 59 | +- Extended glob patterns: |
| 60 | + - `+(x|y)` (matches 'x' or 'y' one or more times) |
| 61 | + - `!(a|b)` (matches anything except 'a' or 'b') |
| 62 | +- POSIX character classes: |
| 63 | + - `[[:alpha:][:digit:]]` (matches any letter or number) |
| 64 | +- Brace expansion: |
| 65 | + - `foo/{1..5}.md` (matches foo/1.md through foo/5.md) |
| 66 | + - `bar/{a,b,c}.js` (matches bar/a.js, bar/b.js, bar/c.js) |
| 67 | +- Regex character classes: |
| 68 | + - `foo-[1-5].js` (matches foo-1.js through foo-5.js) |
| 69 | +- Regex logical "or": |
| 70 | + - `foo/(abc|xyz).js` (matches foo/abc.js or foo/xyz.js) |
| 71 | + |
0 commit comments