devnomads-cli 0.14.0__tar.gz → 0.16.0__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 (26) hide show
  1. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/PKG-INFO +58 -11
  2. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/README.md +57 -10
  3. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/PKG-INFO +58 -11
  4. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/SOURCES.txt +1 -0
  5. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/dncli.py +1024 -212
  6. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/pyproject.toml +1 -1
  7. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_generate.py +36 -0
  8. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_sites_publish.py +267 -24
  9. devnomads_cli-0.16.0/tests/test_sites_ssh.py +187 -0
  10. devnomads_cli-0.16.0/tests/test_ssh_keys.py +309 -0
  11. devnomads_cli-0.14.0/tests/test_sites_ssh.py +0 -124
  12. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/LICENSE +0 -0
  13. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/dependency_links.txt +0 -0
  14. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/entry_points.txt +0 -0
  15. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/requires.txt +0 -0
  16. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/devnomads_cli.egg-info/top_level.txt +0 -0
  17. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/setup.cfg +0 -0
  18. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_agent_features.py +0 -0
  19. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_cert.py +0 -0
  20. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_cli.py +0 -0
  21. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_config.py +0 -0
  22. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_generated_cli.py +0 -0
  23. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_helpers.py +0 -0
  24. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_hook.py +0 -0
  25. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_transfer.py +0 -0
  26. {devnomads_cli-0.14.0 → devnomads_cli-0.16.0}/tests/test_versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.14.0
3
+ Version: 0.16.0
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -111,7 +111,8 @@ the full detail for one group, for scripts and AI agents.
111
111
  ## Logging in to a site
112
112
 
113
113
  `dncli sites ssh` opens an SSH session as the site's system user,
114
- `site<service_id>`, so you don't need to know that name:
114
+ `site` + the service id padded to five digits (service 2467 is
115
+ `site02467`), so you don't need to know that name:
115
116
 
116
117
  ```sh
117
118
  dncli sites ssh example.com
@@ -119,16 +120,30 @@ dncli sites ssh example.com -- ls -la # run one command
119
120
  dncli sites ssh example.com --dry-run # print the ssh command
120
121
  ```
121
122
 
122
- The API doesn't say which host to SSH into, so the first time for a
123
- site cluster dncli asks for it and remembers the answer per cluster in
124
- `ssh-hosts` in its config directory. Pass `--host` to give or change
125
- it without the question, for example in a script. Anything after `--`
123
+ dncli logs in on the host the API lists for the site. A site that runs
124
+ on several hosts (an HA cluster) asks which one; pick it with `--host`
125
+ to skip the question, for example in a script. Anything after `--`
126
126
  goes to ssh: extra options (`-- -p 2222`) or a remote command.
127
127
 
128
- ssh logs in with your SSH key when the site has it (`dncli sites keys
129
- attach`); otherwise ssh itself asks for the site's password. dncli never
130
- sees or stores that password. Scripts and other runs without a terminal
131
- cannot answer a password prompt, so they need key login.
128
+ ssh logs in with your SSH key when the site has it; otherwise ssh itself
129
+ asks for the site's password. dncli never sees or stores that password.
130
+ Scripts and other runs without a terminal cannot answer a password
131
+ prompt, so they need key login.
132
+
133
+ dncli helps with the key. Before it connects, it compares the public
134
+ keys you have here (the ssh agent's, and the `~/.ssh/id_*` files ssh
135
+ would use) with the keys attached to the site. When none of yours is
136
+ attached, it offers to attach one, adding it to your DevNomads account
137
+ first if it isn't there yet. `--attach-key` does that without asking
138
+ (for scripts), `--no-attach-key` skips the check. Only public keys are
139
+ read and sent; your private key never leaves `~/.ssh`. You can also do
140
+ it on its own:
141
+
142
+ ```sh
143
+ dncli sites keys attach-local example.com # add to the account if needed, then attach
144
+ dncli keys add-local # only add it to your account
145
+ dncli keys add-local --key ~/.ssh/deploy.pub --name ci
146
+ ```
132
147
 
133
148
  ## Publishing a site
134
149
 
@@ -141,7 +156,7 @@ dncli sites publish example.com ./dist # new and changed files
141
156
  dncli sites publish example.com ./dist --delete # also remove files not in ./dist
142
157
  ```
143
158
 
144
- Files go to `/home/site<service_id>/domains/<domain>/public_html`. `.git/`
159
+ Files go to `/home/site<NNNNN>/domains/<domain>/public_html`. `.git/`
145
160
  is never uploaded; `--exclude` leaves out more (repeat it). You need
146
161
  rsync locally and on the server.
147
162
 
@@ -166,6 +181,38 @@ into its own folder (uploads, caches) are not carried over. Switching
166
181
  mode changes the live site, so dncli asks first (`--yes` skips the
167
182
  question); the old mode's files stay on the server, no longer served.
168
183
 
184
+ **Commands after the upload.** `--run` runs a command on the server in
185
+ the uploaded folder, such as `composer install`; repeat it for more, they
186
+ run in the order given. In release mode the commands run in the new
187
+ release before it goes live, so a failing command stops the publish and
188
+ the site keeps serving the previous release. `--run-once` is for what
189
+ must happen only once, like a database migration: on a site with several
190
+ hosts it runs on the first host only, after all `--run` commands:
191
+
192
+ ```sh
193
+ dncli sites publish example.com . --exclude vendor/ \
194
+ --run 'composer install --no-dev --optimize-autoloader' \
195
+ --run-once 'php artisan migrate --force'
196
+ ```
197
+
198
+ **Sites on several hosts.** A site that runs on several hosts (an HA
199
+ cluster) gets every publish on all of them: dncli uploads to and runs
200
+ the commands on every host first, and only then switches them, so the
201
+ hosts serve different releases only for the moment the switches take.
202
+ `rollback` switches every host too. `--host` limits a command to one
203
+ of them.
204
+
205
+ **From a CI pipeline.** A pipeline has no terminal, so ssh cannot ask
206
+ for a password or whether to trust a host it has not seen before. Give
207
+ the pipeline an SSH key that is attached to the site (attach it once with
208
+ `dncli sites keys attach-local example.com --key deploy.pub`), the hosts'
209
+ keys in `known_hosts` and the API key in `DN_API_KEY`:
210
+
211
+ ```sh
212
+ mkdir -p ~/.ssh && ssh-keyscan web01.example.com >> ~/.ssh/known_hosts
213
+ dncli sites publish example.com . --run 'composer install --no-dev'
214
+ ```
215
+
169
216
  ## Managing DNS
170
217
 
171
218
  ```sh
@@ -95,7 +95,8 @@ the full detail for one group, for scripts and AI agents.
95
95
  ## Logging in to a site
96
96
 
97
97
  `dncli sites ssh` opens an SSH session as the site's system user,
98
- `site<service_id>`, so you don't need to know that name:
98
+ `site` + the service id padded to five digits (service 2467 is
99
+ `site02467`), so you don't need to know that name:
99
100
 
100
101
  ```sh
101
102
  dncli sites ssh example.com
@@ -103,16 +104,30 @@ dncli sites ssh example.com -- ls -la # run one command
103
104
  dncli sites ssh example.com --dry-run # print the ssh command
104
105
  ```
105
106
 
106
- The API doesn't say which host to SSH into, so the first time for a
107
- site cluster dncli asks for it and remembers the answer per cluster in
108
- `ssh-hosts` in its config directory. Pass `--host` to give or change
109
- it without the question, for example in a script. Anything after `--`
107
+ dncli logs in on the host the API lists for the site. A site that runs
108
+ on several hosts (an HA cluster) asks which one; pick it with `--host`
109
+ to skip the question, for example in a script. Anything after `--`
110
110
  goes to ssh: extra options (`-- -p 2222`) or a remote command.
111
111
 
112
- ssh logs in with your SSH key when the site has it (`dncli sites keys
113
- attach`); otherwise ssh itself asks for the site's password. dncli never
114
- sees or stores that password. Scripts and other runs without a terminal
115
- cannot answer a password prompt, so they need key login.
112
+ ssh logs in with your SSH key when the site has it; otherwise ssh itself
113
+ asks for the site's password. dncli never sees or stores that password.
114
+ Scripts and other runs without a terminal cannot answer a password
115
+ prompt, so they need key login.
116
+
117
+ dncli helps with the key. Before it connects, it compares the public
118
+ keys you have here (the ssh agent's, and the `~/.ssh/id_*` files ssh
119
+ would use) with the keys attached to the site. When none of yours is
120
+ attached, it offers to attach one, adding it to your DevNomads account
121
+ first if it isn't there yet. `--attach-key` does that without asking
122
+ (for scripts), `--no-attach-key` skips the check. Only public keys are
123
+ read and sent; your private key never leaves `~/.ssh`. You can also do
124
+ it on its own:
125
+
126
+ ```sh
127
+ dncli sites keys attach-local example.com # add to the account if needed, then attach
128
+ dncli keys add-local # only add it to your account
129
+ dncli keys add-local --key ~/.ssh/deploy.pub --name ci
130
+ ```
116
131
 
117
132
  ## Publishing a site
118
133
 
@@ -125,7 +140,7 @@ dncli sites publish example.com ./dist # new and changed files
125
140
  dncli sites publish example.com ./dist --delete # also remove files not in ./dist
126
141
  ```
127
142
 
128
- Files go to `/home/site<service_id>/domains/<domain>/public_html`. `.git/`
143
+ Files go to `/home/site<NNNNN>/domains/<domain>/public_html`. `.git/`
129
144
  is never uploaded; `--exclude` leaves out more (repeat it). You need
130
145
  rsync locally and on the server.
131
146
 
@@ -150,6 +165,38 @@ into its own folder (uploads, caches) are not carried over. Switching
150
165
  mode changes the live site, so dncli asks first (`--yes` skips the
151
166
  question); the old mode's files stay on the server, no longer served.
152
167
 
168
+ **Commands after the upload.** `--run` runs a command on the server in
169
+ the uploaded folder, such as `composer install`; repeat it for more, they
170
+ run in the order given. In release mode the commands run in the new
171
+ release before it goes live, so a failing command stops the publish and
172
+ the site keeps serving the previous release. `--run-once` is for what
173
+ must happen only once, like a database migration: on a site with several
174
+ hosts it runs on the first host only, after all `--run` commands:
175
+
176
+ ```sh
177
+ dncli sites publish example.com . --exclude vendor/ \
178
+ --run 'composer install --no-dev --optimize-autoloader' \
179
+ --run-once 'php artisan migrate --force'
180
+ ```
181
+
182
+ **Sites on several hosts.** A site that runs on several hosts (an HA
183
+ cluster) gets every publish on all of them: dncli uploads to and runs
184
+ the commands on every host first, and only then switches them, so the
185
+ hosts serve different releases only for the moment the switches take.
186
+ `rollback` switches every host too. `--host` limits a command to one
187
+ of them.
188
+
189
+ **From a CI pipeline.** A pipeline has no terminal, so ssh cannot ask
190
+ for a password or whether to trust a host it has not seen before. Give
191
+ the pipeline an SSH key that is attached to the site (attach it once with
192
+ `dncli sites keys attach-local example.com --key deploy.pub`), the hosts'
193
+ keys in `known_hosts` and the API key in `DN_API_KEY`:
194
+
195
+ ```sh
196
+ mkdir -p ~/.ssh && ssh-keyscan web01.example.com >> ~/.ssh/known_hosts
197
+ dncli sites publish example.com . --run 'composer install --no-dev'
198
+ ```
199
+
153
200
  ## Managing DNS
154
201
 
155
202
  ```sh
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.14.0
3
+ Version: 0.16.0
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -111,7 +111,8 @@ the full detail for one group, for scripts and AI agents.
111
111
  ## Logging in to a site
112
112
 
113
113
  `dncli sites ssh` opens an SSH session as the site's system user,
114
- `site<service_id>`, so you don't need to know that name:
114
+ `site` + the service id padded to five digits (service 2467 is
115
+ `site02467`), so you don't need to know that name:
115
116
 
116
117
  ```sh
117
118
  dncli sites ssh example.com
@@ -119,16 +120,30 @@ dncli sites ssh example.com -- ls -la # run one command
119
120
  dncli sites ssh example.com --dry-run # print the ssh command
120
121
  ```
121
122
 
122
- The API doesn't say which host to SSH into, so the first time for a
123
- site cluster dncli asks for it and remembers the answer per cluster in
124
- `ssh-hosts` in its config directory. Pass `--host` to give or change
125
- it without the question, for example in a script. Anything after `--`
123
+ dncli logs in on the host the API lists for the site. A site that runs
124
+ on several hosts (an HA cluster) asks which one; pick it with `--host`
125
+ to skip the question, for example in a script. Anything after `--`
126
126
  goes to ssh: extra options (`-- -p 2222`) or a remote command.
127
127
 
128
- ssh logs in with your SSH key when the site has it (`dncli sites keys
129
- attach`); otherwise ssh itself asks for the site's password. dncli never
130
- sees or stores that password. Scripts and other runs without a terminal
131
- cannot answer a password prompt, so they need key login.
128
+ ssh logs in with your SSH key when the site has it; otherwise ssh itself
129
+ asks for the site's password. dncli never sees or stores that password.
130
+ Scripts and other runs without a terminal cannot answer a password
131
+ prompt, so they need key login.
132
+
133
+ dncli helps with the key. Before it connects, it compares the public
134
+ keys you have here (the ssh agent's, and the `~/.ssh/id_*` files ssh
135
+ would use) with the keys attached to the site. When none of yours is
136
+ attached, it offers to attach one, adding it to your DevNomads account
137
+ first if it isn't there yet. `--attach-key` does that without asking
138
+ (for scripts), `--no-attach-key` skips the check. Only public keys are
139
+ read and sent; your private key never leaves `~/.ssh`. You can also do
140
+ it on its own:
141
+
142
+ ```sh
143
+ dncli sites keys attach-local example.com # add to the account if needed, then attach
144
+ dncli keys add-local # only add it to your account
145
+ dncli keys add-local --key ~/.ssh/deploy.pub --name ci
146
+ ```
132
147
 
133
148
  ## Publishing a site
134
149
 
@@ -141,7 +156,7 @@ dncli sites publish example.com ./dist # new and changed files
141
156
  dncli sites publish example.com ./dist --delete # also remove files not in ./dist
142
157
  ```
143
158
 
144
- Files go to `/home/site<service_id>/domains/<domain>/public_html`. `.git/`
159
+ Files go to `/home/site<NNNNN>/domains/<domain>/public_html`. `.git/`
145
160
  is never uploaded; `--exclude` leaves out more (repeat it). You need
146
161
  rsync locally and on the server.
147
162
 
@@ -166,6 +181,38 @@ into its own folder (uploads, caches) are not carried over. Switching
166
181
  mode changes the live site, so dncli asks first (`--yes` skips the
167
182
  question); the old mode's files stay on the server, no longer served.
168
183
 
184
+ **Commands after the upload.** `--run` runs a command on the server in
185
+ the uploaded folder, such as `composer install`; repeat it for more, they
186
+ run in the order given. In release mode the commands run in the new
187
+ release before it goes live, so a failing command stops the publish and
188
+ the site keeps serving the previous release. `--run-once` is for what
189
+ must happen only once, like a database migration: on a site with several
190
+ hosts it runs on the first host only, after all `--run` commands:
191
+
192
+ ```sh
193
+ dncli sites publish example.com . --exclude vendor/ \
194
+ --run 'composer install --no-dev --optimize-autoloader' \
195
+ --run-once 'php artisan migrate --force'
196
+ ```
197
+
198
+ **Sites on several hosts.** A site that runs on several hosts (an HA
199
+ cluster) gets every publish on all of them: dncli uploads to and runs
200
+ the commands on every host first, and only then switches them, so the
201
+ hosts serve different releases only for the moment the switches take.
202
+ `rollback` switches every host too. `--host` limits a command to one
203
+ of them.
204
+
205
+ **From a CI pipeline.** A pipeline has no terminal, so ssh cannot ask
206
+ for a password or whether to trust a host it has not seen before. Give
207
+ the pipeline an SSH key that is attached to the site (attach it once with
208
+ `dncli sites keys attach-local example.com --key deploy.pub`), the hosts'
209
+ keys in `known_hosts` and the API key in `DN_API_KEY`:
210
+
211
+ ```sh
212
+ mkdir -p ~/.ssh && ssh-keyscan web01.example.com >> ~/.ssh/known_hosts
213
+ dncli sites publish example.com . --run 'composer install --no-dev'
214
+ ```
215
+
169
216
  ## Managing DNS
170
217
 
171
218
  ```sh
@@ -18,5 +18,6 @@ tests/test_helpers.py
18
18
  tests/test_hook.py
19
19
  tests/test_sites_publish.py
20
20
  tests/test_sites_ssh.py
21
+ tests/test_ssh_keys.py
21
22
  tests/test_transfer.py
22
23
  tests/test_versions.py