docker-stack 2.1.0__tar.gz → 2.1.2__tar.gz

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.
Files changed (34) hide show
  1. {docker_stack-2.1.0 → docker_stack-2.1.2}/PKG-INFO +78 -8
  2. {docker_stack-2.1.0 → docker_stack-2.1.2}/README.md +76 -6
  3. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/cli.py +566 -134
  4. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/helpers.py +2 -6
  5. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/login.py +31 -5
  6. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/manager_api.py +198 -10
  7. docker_stack-2.1.2/docker_stack/shell_auth.py +742 -0
  8. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/PKG-INFO +78 -8
  9. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/SOURCES.txt +3 -1
  10. {docker_stack-2.1.0 → docker_stack-2.1.2}/setup.py +2 -2
  11. {docker_stack-2.1.0 → docker_stack-2.1.2}/tests/test_docker_stack.py +378 -31
  12. {docker_stack-2.1.0 → docker_stack-2.1.2}/tests/test_login.py +27 -0
  13. docker_stack-2.1.2/tests/test_manager_api.py +467 -0
  14. docker_stack-2.1.2/tests/test_shell_auth.py +389 -0
  15. docker_stack-2.1.0/tests/test_manager_api.py +0 -208
  16. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/__init__.py +0 -0
  17. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/command_runner.py +0 -0
  18. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/compose.py +0 -0
  19. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/docker_objects.py +0 -0
  20. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/envsubst.py +0 -0
  21. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/envsubst_merge.py +0 -0
  22. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/markers.py +0 -0
  23. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/merge_conf.py +0 -0
  24. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/registry.py +0 -0
  25. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack/url_parser.py +0 -0
  26. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/dependency_links.txt +0 -0
  27. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/entry_points.txt +0 -0
  28. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/requires.txt +0 -0
  29. {docker_stack-2.1.0 → docker_stack-2.1.2}/docker_stack.egg-info/top_level.txt +0 -0
  30. {docker_stack-2.1.0 → docker_stack-2.1.2}/pyproject.toml +0 -0
  31. {docker_stack-2.1.0 → docker_stack-2.1.2}/setup.cfg +0 -0
  32. {docker_stack-2.1.0 → docker_stack-2.1.2}/tests/test_docker_objects.py +0 -0
  33. {docker_stack-2.1.0 → docker_stack-2.1.2}/tests/test_load_env.py +0 -0
  34. {docker_stack-2.1.0 → docker_stack-2.1.2}/tests/test_node_ls.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docker-stack
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: CLI for deploying and managing Docker stacks.
5
5
  Home-page: https://github.com/mesudip/docker-stack
6
6
  Author: Sudip Bhattarai
@@ -8,7 +8,7 @@ Author-email: sudip@bhattarai.me
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
11
+ Requires-Python: >=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: PyYAML
14
14
  Provides-Extra: dev
@@ -47,6 +47,8 @@ Typical daemon-only workflow:
47
47
  ```bash
48
48
  docker-stack deploy my-stack docker-compose.yml
49
49
  docker-stack ls
50
+ docker-stack ls -n team-a
51
+ docker-stack ls -A
50
52
  docker-stack versions my-stack
51
53
  docker-stack cat my-stack
52
54
  docker-stack checkout my-stack v2
@@ -78,12 +80,49 @@ steps:
78
80
  - run: docker-stack deploy my-stack docker-compose.yml
79
81
  ```
80
82
 
81
- This uses the normal Docker CLI path and runs `docker config` / `docker stack deploy` against the configured daemon.
83
+ Use this option when CI can connect directly to the target Docker daemon.
82
84
 
83
85
  #### 2. Docker-Manager
84
86
 
85
87
  Use the bundled action when deploying through Docker-Manager:
86
88
 
89
+ For a full compose deployment directly from CI, use the action to configure
90
+ Docker-Manager authentication and then run the normal `docker-stack deploy`
91
+ command:
92
+
93
+ ```yaml
94
+ permissions:
95
+ contents: read
96
+ id-token: write
97
+
98
+ steps:
99
+ - uses: actions/checkout@v4
100
+ - uses: mesudip/docker-stack@v2
101
+ with:
102
+ manager: https://manager.example.com:2378
103
+ - run: docker-stack deploy --namespace team-a --with-registry-auth my-stack docker-compose.yml
104
+ ```
105
+
106
+ You can also deploy the full compose file through action inputs:
107
+
108
+ ```yaml
109
+ permissions:
110
+ contents: read
111
+ id-token: write
112
+
113
+ steps:
114
+ - uses: actions/checkout@v4
115
+ - uses: mesudip/docker-stack@v2
116
+ with:
117
+ manager: https://manager.example.com:2378
118
+ stack: my-stack
119
+ compose-file: docker-compose.yml
120
+ namespace: team-a
121
+ with-registry-auth: "true"
122
+ ```
123
+
124
+ To release new service images without submitting the compose file again:
125
+
87
126
  ```yaml
88
127
  permissions:
89
128
  contents: read
@@ -94,10 +133,39 @@ steps:
94
133
  - uses: mesudip/docker-stack@v2
95
134
  with:
96
135
  manager: https://manager.example.com:2378
97
- - run: docker-stack deploy --with-registry-auth my-stack docker-compose.yml
136
+ stack: my-stack
137
+ namespace: team-a
138
+ with-registry-auth: "true"
139
+ images: |
140
+ api=ghcr.io/acme/api:${{ github.sha }}
141
+ worker=ghcr.io/acme/worker:${{ github.sha }}
98
142
  ```
99
143
 
100
- The action uses `actions/setup-python@v6`, installs `docker-stack`, defaults to GitHub OIDC auth and the `dm-proxy` context, exports `DOCKER_CONFIG`, `DOCKER_CONTEXT`, and `DOCKER_MANAGER_URL` for later steps, and removes its generated Docker config directory in the post-action cleanup phase.
144
+ Use a full compose deployment when the workflow owns the complete stack
145
+ definition. Use an image-only deployment when the stack is already managed and
146
+ the workflow only needs to release new images. Both forms support namespaces;
147
+ the namespace defaults to `default` when omitted.
148
+
149
+ ### Authenticated Docker-Manager shell
150
+
151
+ Open an isolated Bash or Zsh session for a manager context:
152
+
153
+ ```bash
154
+ docker-stack shell office
155
+ ```
156
+
157
+ If `office` does not exist yet, the CLI asks for its Docker-Manager URL, creates
158
+ the context, authenticates, and opens the shell. You can also provide everything
159
+ non-interactively with `docker-stack shell --context office <manager-url>`.
160
+
161
+ Stack commands use the `default` namespace unless `-n/--namespace` is supplied.
162
+ Listings print the selected namespace; `docker-stack ls -A` (or
163
+ `--all-namespaces`) lists every visible namespace.
164
+
165
+ The prompt displays `(docker:office)`, keeps the selected manager context active,
166
+ and refreshes authentication when needed. The session supports `docker` and
167
+ `docker compose`; legacy `docker-compose` is not supported. If authentication
168
+ expires, run `docker-stack login` again.
101
169
 
102
170
  ## Core Capabilities
103
171
 
@@ -176,9 +244,6 @@ Vanilla Docker Stack deployments can sometimes lack the flexibility needed for d
176
244
  ### Stored Source Metadata
177
245
  Versioned stack configs include a top-level `x-files` list with base64-encoded source material for recovery and auditing. This includes the original compose file as `compose.yml`, a generated `.env` containing referenced non-secret environment values, and config files referenced by `configs.*.file` or `configs.*.x-template-file`. Secret source files and variables used by `secrets.*.environment` are not stored in `x-files`.
178
246
 
179
- ### Known Issues
180
- Stored `x-files` metadata is written into Docker configs during local deploys. Docker config content is limited to 500 KB, and base64-encoded source files add roughly 33% overhead, so stacks with large compose/config source files can exceed the Docker config payload limit even when the rendered compose is valid.
181
-
182
247
  ### `x-generate`: Dynamic Secret Generation (Secrets Only)
183
248
  This powerful feature allows you to automatically generate random secrets based on specified criteria, eliminating the need to manually create and manage them. This is particularly useful for passwords, API keys, and other sensitive data.
184
249
 
@@ -282,6 +347,11 @@ Vanilla Docker Stack deployments can sometimes lack the flexibility needed for d
282
347
  uppercase: false
283
348
  ```
284
349
 
350
+ ## Known Limitations
351
+
352
+ Docker limits config content to 500 KB. Stack history includes encoded source
353
+ files, so stacks with large compose or config files can exceed that limit.
354
+
285
355
  ## Development
286
356
 
287
357
  Install runtime and test dependencies with either:
@@ -21,6 +21,8 @@ Typical daemon-only workflow:
21
21
  ```bash
22
22
  docker-stack deploy my-stack docker-compose.yml
23
23
  docker-stack ls
24
+ docker-stack ls -n team-a
25
+ docker-stack ls -A
24
26
  docker-stack versions my-stack
25
27
  docker-stack cat my-stack
26
28
  docker-stack checkout my-stack v2
@@ -52,12 +54,49 @@ steps:
52
54
  - run: docker-stack deploy my-stack docker-compose.yml
53
55
  ```
54
56
 
55
- This uses the normal Docker CLI path and runs `docker config` / `docker stack deploy` against the configured daemon.
57
+ Use this option when CI can connect directly to the target Docker daemon.
56
58
 
57
59
  #### 2. Docker-Manager
58
60
 
59
61
  Use the bundled action when deploying through Docker-Manager:
60
62
 
63
+ For a full compose deployment directly from CI, use the action to configure
64
+ Docker-Manager authentication and then run the normal `docker-stack deploy`
65
+ command:
66
+
67
+ ```yaml
68
+ permissions:
69
+ contents: read
70
+ id-token: write
71
+
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+ - uses: mesudip/docker-stack@v2
75
+ with:
76
+ manager: https://manager.example.com:2378
77
+ - run: docker-stack deploy --namespace team-a --with-registry-auth my-stack docker-compose.yml
78
+ ```
79
+
80
+ You can also deploy the full compose file through action inputs:
81
+
82
+ ```yaml
83
+ permissions:
84
+ contents: read
85
+ id-token: write
86
+
87
+ steps:
88
+ - uses: actions/checkout@v4
89
+ - uses: mesudip/docker-stack@v2
90
+ with:
91
+ manager: https://manager.example.com:2378
92
+ stack: my-stack
93
+ compose-file: docker-compose.yml
94
+ namespace: team-a
95
+ with-registry-auth: "true"
96
+ ```
97
+
98
+ To release new service images without submitting the compose file again:
99
+
61
100
  ```yaml
62
101
  permissions:
63
102
  contents: read
@@ -68,10 +107,39 @@ steps:
68
107
  - uses: mesudip/docker-stack@v2
69
108
  with:
70
109
  manager: https://manager.example.com:2378
71
- - run: docker-stack deploy --with-registry-auth my-stack docker-compose.yml
110
+ stack: my-stack
111
+ namespace: team-a
112
+ with-registry-auth: "true"
113
+ images: |
114
+ api=ghcr.io/acme/api:${{ github.sha }}
115
+ worker=ghcr.io/acme/worker:${{ github.sha }}
72
116
  ```
73
117
 
74
- The action uses `actions/setup-python@v6`, installs `docker-stack`, defaults to GitHub OIDC auth and the `dm-proxy` context, exports `DOCKER_CONFIG`, `DOCKER_CONTEXT`, and `DOCKER_MANAGER_URL` for later steps, and removes its generated Docker config directory in the post-action cleanup phase.
118
+ Use a full compose deployment when the workflow owns the complete stack
119
+ definition. Use an image-only deployment when the stack is already managed and
120
+ the workflow only needs to release new images. Both forms support namespaces;
121
+ the namespace defaults to `default` when omitted.
122
+
123
+ ### Authenticated Docker-Manager shell
124
+
125
+ Open an isolated Bash or Zsh session for a manager context:
126
+
127
+ ```bash
128
+ docker-stack shell office
129
+ ```
130
+
131
+ If `office` does not exist yet, the CLI asks for its Docker-Manager URL, creates
132
+ the context, authenticates, and opens the shell. You can also provide everything
133
+ non-interactively with `docker-stack shell --context office <manager-url>`.
134
+
135
+ Stack commands use the `default` namespace unless `-n/--namespace` is supplied.
136
+ Listings print the selected namespace; `docker-stack ls -A` (or
137
+ `--all-namespaces`) lists every visible namespace.
138
+
139
+ The prompt displays `(docker:office)`, keeps the selected manager context active,
140
+ and refreshes authentication when needed. The session supports `docker` and
141
+ `docker compose`; legacy `docker-compose` is not supported. If authentication
142
+ expires, run `docker-stack login` again.
75
143
 
76
144
  ## Core Capabilities
77
145
 
@@ -150,9 +218,6 @@ Vanilla Docker Stack deployments can sometimes lack the flexibility needed for d
150
218
  ### Stored Source Metadata
151
219
  Versioned stack configs include a top-level `x-files` list with base64-encoded source material for recovery and auditing. This includes the original compose file as `compose.yml`, a generated `.env` containing referenced non-secret environment values, and config files referenced by `configs.*.file` or `configs.*.x-template-file`. Secret source files and variables used by `secrets.*.environment` are not stored in `x-files`.
152
220
 
153
- ### Known Issues
154
- Stored `x-files` metadata is written into Docker configs during local deploys. Docker config content is limited to 500 KB, and base64-encoded source files add roughly 33% overhead, so stacks with large compose/config source files can exceed the Docker config payload limit even when the rendered compose is valid.
155
-
156
221
  ### `x-generate`: Dynamic Secret Generation (Secrets Only)
157
222
  This powerful feature allows you to automatically generate random secrets based on specified criteria, eliminating the need to manually create and manage them. This is particularly useful for passwords, API keys, and other sensitive data.
158
223
 
@@ -256,6 +321,11 @@ Vanilla Docker Stack deployments can sometimes lack the flexibility needed for d
256
321
  uppercase: false
257
322
  ```
258
323
 
324
+ ## Known Limitations
325
+
326
+ Docker limits config content to 500 KB. Stack history includes encoded source
327
+ files, so stacks with large compose or config files can exceed that limit.
328
+
259
329
  ## Development
260
330
 
261
331
  Install runtime and test dependencies with either: