devnomads-cli 0.14.0__py3-none-any.whl → 0.16.0__py3-none-any.whl

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.
@@ -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
@@ -0,0 +1,7 @@
1
+ dncli.py,sha256=pTAmIydiC7hbr1UbVLJJH4EYK4AwLtljRj4nn_4X9yU,431062
2
+ devnomads_cli-0.16.0.dist-info/licenses/LICENSE,sha256=WPXQ_lmpr3tVzTD9Z6VTiBgFnFey-cEwEYoG4HlmbxY,1066
3
+ devnomads_cli-0.16.0.dist-info/METADATA,sha256=mMpe96WCF-PEV4A2GBRgS9tKwHA-VV_XnWu-uz5SitU,17472
4
+ devnomads_cli-0.16.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ devnomads_cli-0.16.0.dist-info/entry_points.txt,sha256=irLaKiGtIzEKi87exmXAg0srUmoDK31fL0SlqJasAEU,69
6
+ devnomads_cli-0.16.0.dist-info/top_level.txt,sha256=rFWIJDQgL3jA2q6b2GAqZgCknDED4WLxNcHTktuWS1I,6
7
+ devnomads_cli-0.16.0.dist-info/RECORD,,