@haakco/hostingctl 1.0.832 → 1.0.834

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,26 @@ 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`. `--preview` runs bisync's dry run and lists what would be added, updated and deleted, each
297
+ named by the side it changed on (`here:` or `environment:`), and changes nothing; a first run lists only its
298
+ counts. `--dry-run` describes the run and contacts nothing.
299
+
300
+ **Mount.** `files mount env:/path ./empty-folder --environment <uuid> --user <login>` shows the environment
301
+ folder read-only in an empty local folder until Ctrl-C unmounts it; it writes nothing, so it needs no
302
+ `--confirm`. New remote files appear within 30 seconds. If the environment becomes unreachable, listings already
303
+ read stay visible and reading a file fails until it is back; Ctrl-C still unmounts cleanly.
304
+ It needs macFUSE or FUSE-T on macOS and FUSE (`/dev/fuse` and `fusermount3`) on Linux; without
305
+ them, and on Windows for now, it refuses with what to install and exits 2 (`mount-unavailable`).
306
+
287
307
  **The copy engine.** The first local `files` command fetches the official rclone 1.75.2 release (about
288
308
  32 MB) from `downloads.rclone.org`, checks it against its pinned SHA-256, and keeps only the program, about
289
309
  86 MB, in the cache folder. Both CLIs share it, every launch re-checks its checksum, an rclone on `PATH` is
@@ -303,6 +323,32 @@ arm64) with kernel 3.2 or newer, macOS 12 or newer (Intel or Apple silicon), or
303
323
  Server 2016 or newer. On an older Mac they refuse with that floor before anything is fetched. `files import`
304
324
  runs on the server and has no such floor.
305
325
 
326
+ ## A local copy of a WordPress site
327
+
328
+ `hostingctl dev` makes and runs a local copy of one WordPress site with its database, using Docker:
329
+
330
+ ```bash
331
+ hostingctl dev prepare ./acme-site --company acme --environment <uuid> --database <database-uuid> \
332
+ --from env:/wordpress --user <login> --key-file ~/.ssh/acme --confirm
333
+ hostingctl dev start ./acme-site # http://localhost:<port>; mail is caught by Mailpit
334
+ hostingctl dev status ./acme-site # where it came from, when files and database were taken, what runs
335
+ hostingctl dev stop | refresh | delete ./acme-site
336
+ ```
337
+
338
+ `prepare` pulls the site's files into `files/` with the same engine as `files pull`, asks for a fresh
339
+ database export (the one `environment database-export-create` makes), waits for it, downloads it into
340
+ `database/` and checks it is the whole gzip file the platform measured. It then replaces the site's
341
+ `wp-config.php` with a local one (new database settings and salts, cron and automatic updates off,
342
+ `WP_HTTP_BLOCK_EXTERNAL`, mail to Mailpit) and writes `compose.yaml`: MariaDB 12.3, the public
343
+ `wordpress:6.8.3-php8.3-apache` image and Mailpit, with the site and Mailpit published on `127.0.0.1` only
344
+ and no database port. The first `start` imports the database and runs WP-CLI `search-replace` from the
345
+ site's address to the local one, skipping GUIDs. `refresh` prepares a sibling copy (starting from the
346
+ current files, so the pull fetches only changes), swaps it in when complete and keeps the old copy as
347
+ `<folder>.previous-<time>`; a failed refresh leaves the working copy as it was. `delete` removes the folder
348
+ and its database volume. The copy is unsanitized: it is your own data. The files and the database are
349
+ taken at different moments, and the database is never pushed back; `files push` from `files/` leaves
350
+ `wp-config.php` alone. Without Docker, `start` exits 2.
351
+
306
352
  ## Guided old-host connection setup
307
353
 
308
354
  In the native client, run `hostingctl provider-connections add --company <slug> --confirm` in a terminal.