dokku-compose 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ Like Docker Compose, but for Dokku.
30
30
  npm install -g dokku-compose
31
31
  ```
32
32
 
33
- Requires Node.js >= 20 and a server running Dokku >= 0.38.29 (every server command stops on an older one; dokku-compose never installs or upgrades Dokku). See the [Installation Reference](docs/reference/install.md) for details.
33
+ Requires Node.js >= 20 and a server running Dokku >= 0.38.32 (every server command stops on an older one; dokku-compose never installs or upgrades Dokku). See the [Installation Reference](docs/reference/install.md) for details.
34
34
 
35
35
  ### 1. Export your existing server
36
36
 
@@ -58,7 +58,7 @@ dokku-compose diff
58
58
  1 resource(s) out of sync.
59
59
  ```
60
60
 
61
- When `diff` says a box is in sync, `up` runs no command on it. `diff` also covers the top-level `domains:`, `logs:` and `nginx:` (under `global`; log sinks are masked), shared networks missing on the server, and a replaced `ssl.certfile` (compared with the installed certificate). `diff --verbose` prints `Everything in sync.` when nothing differs. `diff` also notes, by name only, each app env key the file does not declare (a key set by hand or by a script); a note is not drift and never changes the exit code. List the keys something else sets under the app's `env_external:` and `diff` stops noting them ([config](docs/reference/config.md#keys-set-elsewhere-appsappenv_external)).
61
+ When `diff` says a box is in sync, `up` runs no command on it. `diff` also covers the top-level `domains:`, `env:`, `nginx:`, `logs:`, `scheduler:`, `registry:`, `checks:`, `ps:`, `build:`, `network:`, `proxy:` and `git:` (under `global`; log sinks are masked), shared networks and storage entries (`volumes:`) missing or different on the server, and a replaced `ssl.certfile` (compared with the installed certificate). `diff --verbose` prints `Everything in sync.` when nothing differs. `diff` also notes, by name only, each app env key the file does not declare (a key set by hand or by a script); a note is not drift and never changes the exit code. List the keys something else sets under the app's `env_external:` and `diff` stops noting them ([config](docs/reference/config.md#keys-set-elsewhere-appsappenv_external)).
62
62
 
63
63
  ### 3. Preview changes
64
64
 
@@ -100,11 +100,16 @@ dokku ps:restart worker # env, storage
100
100
  | `docker_options` deploy and run | yes | docker-options docs: applies "only to containers created after" the change |
101
101
  | `links` link or unlink | yes | applied with `--no-restart` |
102
102
  | `network` `tld`, `bind_all_interfaces` | yes | read when containers start |
103
+ | top-level `network:` `tld`, `bind_all_interfaces` | yes, every app the run processes | as above |
103
104
  | `networks`, `network` `attach_post_create`, `initial_network` | rebuild: `dokku ps:rebuild <app>` | network docs (network.md:210): "A change in these values will require an app deploy or rebuild" |
105
+ | top-level `network:` `attach_post_create`, `attach_post_deploy`, `initial_network` | rebuild, every app the run processes | as above |
104
106
  | `docker_options` build, `build.args`, `build.dockerfile`, `app_json`, `context` | rebuild | read by a build, which a restart does not run |
107
+ | top-level `build:` `selected`, `context`, `dockerfile`, `app_json` | rebuild, every app the run processes | as above |
105
108
  | `ports` | no | `ports:set` fires `post-proxy-ports-update`, which rebuilds the nginx config |
106
- | `domains`, `nginx`, `proxy`, `certs`, `logs`, `checks`, `registry`, `scheduler` | no | applied live or read at deploy |
107
- | `scale`, `ps` | no | `--skip-deploy`: takes effect on the next deploy |
109
+ | `domains`, `nginx`, `proxy`, `certs`, `logs`, `checks`, `registry`, `scheduler`, `git`, and their top-level blocks | no | applied live or read at deploy |
110
+ | `scale`, `ps`, top-level `ps:` | no | `--skip-deploy`: takes effect on the next deploy |
111
+
112
+ A top-level (global) change also reaches apps that are not in the file or that the run filtered out. The summary lists only the apps the run processes, so restart or rebuild the others yourself.
108
113
 
109
114
  ## Commands
110
115
 
@@ -115,26 +120,28 @@ dokku ps:restart worker # env, storage
115
120
  | `dokku-compose diff` | Show what's out of sync between config and server |
116
121
  | `dokku-compose export` | Export current server state to YAML |
117
122
  | `dokku-compose ps [apps...]` | Show status of configured apps |
118
- | `dokku-compose validate` | Validate config file offline (no server contact) |
123
+ | `dokku-compose validate [file]` | Validate config file offline (no server contact); an unknown key anywhere in the file is an error |
119
124
  | `dokku-compose init [apps...]` | Create a starter `dokku-compose.yml` |
120
125
 
121
126
  ### Options
122
127
 
123
128
  | Option | Description |
124
129
  |--------|-------------|
125
- | `--file <path>` | Config file (default: `dokku-compose.yml`) |
126
- | `--dry-run` | Print commands without executing |
127
- | `--sensitive` | Show sensitive values in output (masked by default) |
128
- | `--fail-fast` | Stop on first error (default: continue to next app) |
130
+ | `-f, --file <path>` | Config file (default: `dokku-compose.yml`); `validate` takes the file as an argument instead |
131
+ | `--dry-run` | `up` only: print commands without executing |
132
+ | `--sensitive` | `up`, `diff` and `export`: show sensitive values in output (masked by default) |
133
+ | `--fail-fast` | `up` and `down`: stop on first error (default: continue to next app) |
129
134
  | `--prune` | `up` only: also reset settings the file no longer declares (read `diff` first) |
130
- | `--remove-orphans` | Destroy services and networks not in config |
135
+ | `--force` | `down` only: required to destroy anything |
136
+ | `--app <app>` | `export` only: export one app |
137
+ | `-o, --output <path>` | `export` only: write to a file instead of stdout |
131
138
  | `--verbose` | Show git-style +/- diff (diff command only) |
132
139
 
133
140
  ### Settings removed from the file
134
141
 
135
142
  `diff` marks with a red `-` every setting the server still has that the file no longer declares
136
143
  (managed env keys, nginx, logs, registry, scheduler, checks, `ps`, network, proxy and git
137
- properties, build settings and args, and entries missing from a declared list), including when the whole block is gone. Only
144
+ properties, build settings and args, postgres/redis `properties`, and entries missing from a declared list), including when the whole block is gone. A key set globally on the server that a declared top-level block (`nginx:`, `logs:`, `scheduler:`, `registry:`, `checks:`, `ps:`, `build:`, `network:`, `proxy:`, `git:`) no longer lists is shown too, under `global`; a top-level block that is absent from the file is never read, so settings made outside the file stay. Only
138
145
  settable keys count, never read-only report lines, and a `-` counts as drift. It also warns when
139
146
  an app has no `links:` but has services linked on the server, because `up` unlinks them.
140
147
 
@@ -144,23 +151,30 @@ an app has no `links:` but has services linked on the server, because `up` unlin
144
151
 
145
152
  | Resource | Reset command |
146
153
  |----------|---------------|
147
- | `nginx`, `logs`, `registry`, `ps`, `git` (not Dokku-written keys: `ps` `restore`, git `deploy-branch` and `source-image`) | `<plugin>:set <app> <key>` with no value (Dokku's default); nginx then rebuilds the proxy config |
154
+ | `nginx`, `logs`, `registry`, `ps` (not the Dokku-written `ps` key `restore`) | `<plugin>:set <app> <key>` with no value (Dokku's default); nginx then rebuilds the proxy config |
155
+ | top-level `nginx`, `logs`, `scheduler`, `registry`, `checks`, `ps`, `build`, `network`, `proxy`, `git` (only the keys of a block the file declares) | `<plugin>:set --global <key>` with no value (`builder:set`, `builder-dockerfile:set` and `app-json:set` for `build`; `network` never clears `attach_post_deploy`) |
148
156
  | `scheduler` | `scheduler:set <app> selected` or `shell` |
149
157
  | `proxy` properties | `proxy:set <app> type` with no value (`proxy-port` and `proxy-ssl-port` are written by Dokku) |
150
158
  | `network` properties | `network:set <app> <key>` with no value (`attach_post_create` becomes `attach-post-create`, and so on) |
151
159
  | `checks` | `checks:enable <app> <type,type>` for the process types of a removed `disabled`/`skipped` list that the file declares in no list (a type the file does declare is left, with a warning naming the command to run by hand), `checks:set <app> wait-to-retire` |
152
160
  | `build.selected`, `build.skip_cleanup` | `builder:set <app> selected` / `skip-cleanup` with no value |
161
+ | `git` (`keep_git_dir`, and a `deploy_branch` equal to the top-level `git:` one that the app does not declare, which is a copy; `source_image`, `rev_env_var` and any other `deploy_branch` are never reset) | `git:set <app> keep-git-dir` / `deploy-branch` with no value |
162
+ | `postgres`/`redis` `properties` | `<plugin>:set <service> <key>` with no value for a known key the file dropped (never `password`); `mounts` is never cleared because its key is missing, only `mounts: []` clears it |
153
163
  | `build.args` | `docker-options:remove <app> build "--build-arg KEY=VALUE"` for each stale key, by the exact option text (every occurrence); other build options stay |
154
164
 
155
- It covers a block that is gone from the file as well as keys removed from a declared block, and it reads the app once more for a block the file no longer has. `--prune` never destroys an app, service or network, never uninstalls a plugin, never changes `scale`, and does not clear whole `domains`, `ports`, `storage` or `networks` lists because their key is missing (those already prune inside a block the file declares). `proxy` is not a removal. `networks:` owns `attach-post-deploy`: `--prune` does not touch it, and a missing `networks:` key does not clear it (that could detach a running app from its network on the next deploy); `networks: []` does. After `up --prune`, `diff` shows no `-` for the resources above, except for checks that were skipped with a warning (their `-` lines stay).
165
+ It covers a block that is gone from the file as well as keys removed from a declared block, and it reads the app once more for a block the file no longer has. `--prune` never destroys an app, service, network or storage entry, never uninstalls a plugin, never changes `scale`, never clears a `chown` or `mode` removed from a `volumes:` entry, and does not clear whole `domains`, `ports`, `storage` or `networks` lists because their key is missing (those already prune inside a block the file declares). `proxy.enabled` is not a removal (`type` is). `networks:` owns `attach-post-deploy`: `--prune` does not touch it, and a missing `networks:` key does not clear it (that could detach a running app from its network on the next deploy); `networks: []` does. After `up --prune`, `diff` shows no `-` for the resources above, except for checks that were skipped with a warning (their `-` lines stay).
166
+
167
+ ### Order of a run
168
+
169
+ `up` applies the host and global settings first, then each app. The global part runs in this order: version check, plugins and Docker auth, global `domains`, `env`, `logs`, `nginx`, `scheduler`, `registry`, `checks`, `ps`, `build`, `proxy` and `git`, then the shared `networks` are created, the global `network` properties are set and the `volumes:` entries are created, then services. Every app is processed after all of that, so a per-app value, or a `--prune` that clears one, always meets the final global value. The top-level blocks are Dokku's own `--global` settings: Dokku does the inheritance, and a block that is absent from the file is never touched.
156
170
 
157
171
  ### Errors
158
172
 
159
173
  A failing Dokku command (mutation) is never reported as a success. On `up` and `down`, a
160
- global-phase failure (plugins, docker auth, global config, networks, services) aborts the whole
174
+ global-phase failure (plugins, docker auth, global config such as the top-level settings, networks, services) aborts the whole
161
175
  run immediately. A per-app failure is printed with the command and Dokku's error output, and by
162
176
  default the run continues to the next app, exiting non-zero at the end with a summary of which
163
- apps failed; pass `--fail-fast` to stop at the first failure instead. `diff` never reports a
177
+ apps or services failed (a datastore service whose `properties:` the plugin refuses is reported the same way); pass `--fail-fast` to stop at the first failure instead. `diff` never reports a
164
178
  resource as missing when it could not actually read server state — it falls back to a per-app
165
179
  read and, if that's unreadable too, marks the resource `unknown` and exits non-zero with a
166
180
  warning naming what it couldn't read.
@@ -172,26 +186,45 @@ All features are idempotent — running `up` twice produces no changes.
172
186
  | Feature | Description | Reference |
173
187
  |---------|-------------|-----------|
174
188
  | Apps | Create and destroy Dokku apps | [apps](docs/reference/apps.md) |
175
- | Dokku Version | Warn when the server's Dokku version is older than the pinned floor | [dokku](docs/reference/dokku.md) |
189
+ | Dokku Version | Stop when the server runs Dokku older than 0.38.32; `dokku.version` in the file is a hard minimum for `up` | [dokku](docs/reference/dokku.md) |
176
190
  | Environment Variables | Set config vars per app or globally, with full convergence (keys removed from the YAML are unset) | [config](docs/reference/config.md) |
177
- | Build | Dockerfile path, build context, app.json, build args | [builder](docs/reference/builder.md) |
191
+ | Build | Dockerfile path, build context, app.json, builder selection per app or globally, build args | [builder](docs/reference/builder.md) |
178
192
  | Docker Options | Custom Docker options per phase (build/deploy/run) | [docker_options](docs/reference/docker_options.md) |
179
- | Networks | Create shared Docker networks, attach to apps | [network](docs/reference/network.md) |
193
+ | Networks | Create shared Docker networks, attach to apps, set network properties per app or globally | [network](docs/reference/network.md) |
180
194
  | Domains | Configure domains per app or globally | [domains](docs/reference/domains.md) |
181
195
  | Port Mappings | Map external ports to container ports | [ports](docs/reference/ports.md) |
182
196
  | SSL Certificates | Add, replace or remove SSL certs | [certs](docs/reference/certs.md) |
183
- | Proxy | Enable/disable proxy, select implementation | [proxy](docs/reference/proxy.md) |
184
- | Storage | Persistent bind mounts with full convergence (keys removed from the YAML are unset) | [storage](docs/reference/storage.md) |
197
+ | Proxy | Enable/disable proxy, select implementation per app or globally | [proxy](docs/reference/proxy.md) |
198
+ | Storage | Named storage entries (`volumes:`) with owner and mode, mounted into apps by name and converged with `storage:mount --replace` | [storage](docs/reference/storage.md) |
185
199
  | Nginx | Set any nginx property per app or globally | [nginx](docs/reference/nginx.md) |
186
- | Scheduler, Registry, Git | `scheduler` (`selected`, `shell`), `registry` and `git` properties per app; every app-scope `:set` key of Dokku 0.38.31 (audit F5), keys Dokku refuses fail `validate` | [logs](docs/reference/logs.md#removal), [audit](docs/dokku-audit.md) |
187
- | Zero-Downtime Checks | Configure deploy checks, disable per process type | [checks](docs/reference/checks.md) |
200
+ | Scheduler | Select the scheduler and shell per app or globally (`scheduler:set`) | [scheduler](docs/reference/scheduler.md) |
201
+ | Registry | Image repo, template, push and server properties per app or globally (`registry:set`) | [registry](docs/reference/registry.md) |
202
+ | Git | `deploy_branch`, `keep_git_dir`, `rev_env_var`, `source_image` per app; top-level `git:` sets the global `deploy_branch`, `keep_git_dir`, `archive_max_files`, `archive_max_size` (`git:set --global`) | [git](docs/reference/git.md) |
203
+ | Zero-Downtime Checks | Configure deploy checks, disable per process type, set `wait-to-retire` globally | [checks](docs/reference/checks.md) |
188
204
  | Log Management | Log retention and vector sink configuration | [logs](docs/reference/logs.md) |
189
205
  | Plugins | Install Dokku plugins at pinned versions, updating forward only | [plugins](docs/reference/plugins.md) |
190
- | Process Scale & ps | Declare process counts (`ps:scale`) and ps properties (`ps:set`) | [scale](docs/reference/scale.md) |
206
+ | Process Scale & ps | Declare process counts (`ps:scale`) and ps properties per app or globally (`ps:set`) | [scale](docs/reference/scale.md) |
191
207
  | Docker Auth | Authenticate the host docker daemon to private registries (e.g. ghcr.io) for `git:from-image` flows | [docker_auth](docs/reference/docker_auth.md) |
192
- | Postgres | Postgres services with optional S3 backups, read from `postgres:info` so backup drift shows in `diff`; a changed version or image shows in `diff` | [postgres](docs/reference/postgres.md) |
193
- | Redis | Redis service instances | [redis](docs/reference/redis.md) |
194
- | Service Links | Link postgres/redis services to apps, with `alias`, `env_var` or `querystring` | [plugins](docs/reference/plugins.md#linking-services-to-apps-appsapplinks) |
208
+ | Postgres | Postgres services with settings (`properties:`: memory, networks, restart policy, password, custom env, …), mounts and optional S3 backups, encrypted or not, all read from `postgres:info` so drift shows in `diff`; a changed version or image shows in `diff` | [postgres](docs/reference/postgres.md) |
209
+ | Redis | Redis service instances with the same properties, mounts and optional S3 backups | [redis](docs/reference/redis.md) |
210
+ | Service Links | Link postgres/redis services to apps, with `alias`, `env_var` or `querystring` | [links](docs/reference/links.md) |
211
+
212
+ ### Global defaults
213
+
214
+ A top-level `nginx`, `logs`, `scheduler`, `registry`, `checks`, `ps`, `build`, `network`, `proxy` or `git` block is Dokku's own `--global` setting for that namespace: apps without their own value inherit it, and Dokku does the inheriting. The keys are the per-app ones that Dokku accepts globally.
215
+
216
+ ```yaml
217
+ git:
218
+ deploy_branch: main # git:set --global deploy-branch main
219
+ registry:
220
+ server: registry.example.com
221
+ checks:
222
+ wait-to-retire: 30
223
+ network:
224
+ attach_post_deploy: [backend-net] # `networks:` creates networks; `network:` sets properties
225
+ ```
226
+
227
+ `diff` shows these under `global`, `up --prune` clears a key that left a declared block, and a block the file does not declare is never touched. The top-level `git:` used to be copied onto each app; see the [upgrade note](CHANGELOG.md) and [git](docs/reference/git.md#migrating-from-the-old-top-level-git).
195
228
 
196
229
  ## Variable interpolation
197
230
 
@@ -233,26 +266,36 @@ dokku-compose/
233
266
  │ │ ├── config.ts # YAML loading and parsing
234
267
  │ │ ├── dokku.ts # Runner interface and factory
235
268
  │ │ └── logger.ts # Colored output helpers
236
- │ ├── modules/ # One file per Dokku namespace
237
- │ │ ├── apps.ts # dokku apps:*
238
- │ │ ├── builder.ts # dokku builder:*, builder-dockerfile:*, app-json:*
239
- │ │ ├── certs.ts # dokku certs:*
240
- │ │ ├── checks.ts # dokku checks:*
241
- │ │ ├── config.ts # dokku config:*
242
- │ │ ├── docker_options.ts # dokku docker-options:*
243
- │ │ ├── domains.ts # dokku domains:*
244
- │ │ ├── logs.ts # dokku logs:*
245
- │ │ ├── network.ts # dokku network:*
246
- │ │ ├── nginx.ts # dokku nginx:*
269
+ │ ├── resources/ # Per-app resources, reconciled by core/reconcile.ts
270
+ │ │ ├── lifecycle.ts # dokku apps:create/destroy
271
+ │ │ ├── lists.ts # ports:*, domains:*
272
+ │ │ ├── storage.ts # storage:mount --replace, storage:unmount (per app)
273
+ │ │ ├── properties.ts # nginx:*, logs:*, registry:*, scheduler:*
274
+ │ │ ├── toggle.ts # proxy:*
275
+ │ │ ├── network.ts # network:*
276
+ │ │ ├── certs.ts # certs:*
277
+ │ │ ├── checks.ts # checks:*
278
+ │ │ ├── config.ts # config:* (per app)
279
+ │ │ ├── builder.ts # builder:*, builder-dockerfile:*, app-json:*
280
+ │ │ ├── docker-options.ts # docker-options:*
281
+ │ │ ├── git.ts # git:*
282
+ │ │ └── ps.ts # ps:scale, ps:set
283
+ │ ├── modules/ # Global and service steps, and the Dokku version check
284
+ │ │ ├── config.ts # dokku config:* (global)
285
+ │ │ ├── docker-auth.ts # docker login for docker_auth
286
+ │ │ ├── domains.ts # dokku domains:* (global)
287
+ │ │ ├── global.ts # <ns>:set --global for the top-level nginx, logs, scheduler, registry, checks, ps, build, network, proxy and git blocks
288
+ │ │ ├── links.ts # Service link resolution across plugins
289
+ │ │ ├── logs.ts # dokku logs:* (per-app helpers)
290
+ │ │ ├── network.ts # dokku network:create
291
+ │ │ ├── nginx.ts # dokku nginx:* (per-app helpers)
247
292
  │ │ ├── plugins.ts # dokku plugin:*
248
- │ │ ├── ports.ts # dokku ports:*
249
- │ │ ├── proxy.ts # dokku proxy:*
250
- │ │ ├── registry.ts # dokku registry:*
251
- │ │ ├── scheduler.ts # dokku scheduler:*
252
- │ │ ├── postgres.ts # dokku postgres:* (create, backup, export)
293
+ │ │ ├── postgres.ts # dokku postgres:* (create, export)
253
294
  │ │ ├── redis.ts # dokku redis:* (create, export)
254
- │ │ ├── links.ts # Service link resolution across plugins
255
- │ │ └── storage.ts # dokku storage:*
295
+ │ │ ├── service-backup.ts # <plugin>:backup-* and set backup-* (postgres and redis)
296
+ │ │ ├── service-properties.ts # <plugin>:set, mount, unmount, create flags (postgres and redis)
297
+ │ │ ├── service-property-keys.ts # the built-in table of property keys
298
+ │ │ └── version.ts # Dokku version check
256
299
  │ ├── commands/
257
300
  │ │ ├── up.ts # up command orchestration
258
301
  │ │ ├── down.ts # down command orchestration
@@ -265,7 +308,7 @@ dokku-compose/
265
308
  └── dokku-compose.yml.example
266
309
  ```
267
310
 
268
- Each `src/modules/*.ts` file maps to one Dokku command namespace and exports `ensure*()`, `destroy*()`, and `export*()` functions. See [CLAUDE.md](CLAUDE.md) for development conventions.
311
+ Each `src/resources/*.ts` file defines resources that `up`, `diff` and `export` share; `src/modules/*.ts` holds the global and service steps. See [CLAUDE.md](CLAUDE.md) for development conventions.
269
312
 
270
313
  </details>
271
314
 
@@ -20,7 +20,7 @@ function logWarn(context, message) {
20
20
  }
21
21
 
22
22
  // src/modules/version.ts
23
- var MIN_DOKKU_VERSION = "0.38.29";
23
+ var MIN_DOKKU_VERSION = "0.38.32";
24
24
  var SEMVER_RE = /^(\d+)\.(\d+)\.(\d+)/;
25
25
  function parseSemver(input) {
26
26
  const m = input.match(SEMVER_RE);
@@ -83,6 +83,7 @@ export {
83
83
  logSkip,
84
84
  logError,
85
85
  logWarn,
86
+ SEMVER_RE,
86
87
  assertDokkuSupported,
87
88
  compareToFile,
88
89
  enforceFileVersion