@haakco/hostingctl 1.0.832 → 1.0.833

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
@@ -274,7 +274,7 @@ which is what joins a failed command to the log line that explains it.
274
274
 
275
275
  ## Environment files from this computer
276
276
 
277
- `files ls|copy|mkdir|move|rm|pull|push` work on an environment's files over its SFTP login, and
277
+ `files ls|copy|mkdir|move|rm|pull|push|sync|mount` work on an environment's files over its SFTP login, and
278
278
  `files connect` prints that login as a `known_hosts` line, an `ssh_config` Host block and an rclone remote
279
279
  for your own `ssh`, `sftp` and `rclone` (it needs `--user`, names `--key-file` when given, otherwise your SSH
280
280
  agent, and never prints a password). Every connection is checked against the SSH host key the platform
@@ -284,6 +284,22 @@ and, after two minutes and 20 files, the time left as a range ("about 11–16 mi
284
284
  the per-file and the per-byte rate. Ctrl-C during a transfer stops the copy engine cleanly and prints the
285
285
  same report with the `interrupted` outcome (exit 1); run the command again to finish.
286
286
 
287
+ **Two-way sync.** `files sync env:/path ./folder --two-way --environment <uuid> --user <login> --confirm`
288
+ keeps a local folder and an environment folder the same both ways with rclone `bisync`. The first run (or
289
+ `--resync`) copies each side's missing and newer files to the other and deletes nothing; later runs carry
290
+ changes and deletions across in both directions. A file changed on both sides keeps both copies as
291
+ `name.conflict1` and `name.conflict2`, and the report lists every conflict copy still in the folder. A run
292
+ that would delete more than `--max-delete-percent` (default 50) of either side stops before deleting
293
+ (`too-many-deletes`, exit 1). The folder's `.hostingctl/` keeps which environment folder it is linked to and
294
+ the sync listings; it is never copied by `pull`, `push` or `sync`, and a folder linked to one environment folder
295
+ refuses another (`linked-elsewhere`). Like `push`, `sync` leaves `wp-config.php` alone unless
296
+ `--with-wp-config`. There is no `--preview` yet: `--dry-run` describes the run and contacts nothing.
297
+
298
+ **Mount.** `files mount env:/path ./empty-folder --environment <uuid> --user <login>` shows the environment
299
+ folder read-only in an empty local folder until Ctrl-C unmounts it; it writes nothing, so it needs no
300
+ `--confirm`. It needs macFUSE or FUSE-T on macOS and FUSE (`/dev/fuse` and `fusermount3`) on Linux; without
301
+ them, and on Windows for now, it refuses with what to install and exits 2 (`mount-unavailable`).
302
+
287
303
  **The copy engine.** The first local `files` command fetches the official rclone 1.75.2 release (about
288
304
  32 MB) from `downloads.rclone.org`, checks it against its pinned SHA-256, and keeps only the program, about
289
305
  86 MB, in the cache folder. Both CLIs share it, every launch re-checks its checksum, an rclone on `PATH` is
@@ -303,6 +319,32 @@ arm64) with kernel 3.2 or newer, macOS 12 or newer (Intel or Apple silicon), or
303
319
  Server 2016 or newer. On an older Mac they refuse with that floor before anything is fetched. `files import`
304
320
  runs on the server and has no such floor.
305
321
 
322
+ ## A local copy of a WordPress site
323
+
324
+ `hostingctl dev` makes and runs a local copy of one WordPress site with its database, using Docker:
325
+
326
+ ```bash
327
+ hostingctl dev prepare ./acme-site --company acme --environment <uuid> --database <database-uuid> \
328
+ --from env:/wordpress --user <login> --key-file ~/.ssh/acme --confirm
329
+ hostingctl dev start ./acme-site # http://localhost:<port>; mail is caught by Mailpit
330
+ hostingctl dev status ./acme-site # where it came from, when files and database were taken, what runs
331
+ hostingctl dev stop | refresh | delete ./acme-site
332
+ ```
333
+
334
+ `prepare` pulls the site's files into `files/` with the same engine as `files pull`, asks for a fresh
335
+ database export (the one `environment database-export-create` makes), waits for it, downloads it into
336
+ `database/` and checks it is the whole gzip file the platform measured. It then replaces the site's
337
+ `wp-config.php` with a local one (new database settings and salts, cron and automatic updates off,
338
+ `WP_HTTP_BLOCK_EXTERNAL`, mail to Mailpit) and writes `compose.yaml`: MariaDB 12.3, the public
339
+ `wordpress:6.8.3-php8.3-apache` image and Mailpit, with the site and Mailpit published on `127.0.0.1` only
340
+ and no database port. The first `start` imports the database and runs WP-CLI `search-replace` from the
341
+ site's address to the local one, skipping GUIDs. `refresh` prepares a sibling copy (starting from the
342
+ current files, so the pull fetches only changes), swaps it in when complete and keeps the old copy as
343
+ `<folder>.previous-<time>`; a failed refresh leaves the working copy as it was. `delete` removes the folder
344
+ and its database volume. The copy is unsanitized: it is your own data. The files and the database are
345
+ taken at different moments, and the database is never pushed back; `files push` from `files/` leaves
346
+ `wp-config.php` alone. Without Docker, `start` exits 2.
347
+
306
348
  ## Guided old-host connection setup
307
349
 
308
350
  In the native client, run `hostingctl provider-connections add --company <slug> --confirm` in a terminal.