Skip to content

Conversation

@ColonelThirtyTwo
Copy link
Contributor

@ColonelThirtyTwo ColonelThirtyTwo commented Dec 5, 2025

Adds and makes default a mode that writes the Ghostwriter compose file to the XDG/Windows app data directory and pull containers from the ghcr registry rather than requiring a local checkout of the Ghostwriter source.

This simplifies installation in two ways. First, administrators will only need to download the gw-cli binary rather than checking out the source. Second, since the compose file refers to pre-built images, the image building step doesn't need to run, cutting out a lot of potential issues (such as not being able to download packages).

Instead of specifying a --dev flag, a --mode=X argument has been added, where X can be either prod (the default, GWCLI managed docker), local-prod (old default, local directory in prod mode) and local-dev (same as --dev, local directory in dev mode).

This also includes a lot of refactoring around how the CLI internally manages docker and env var info, to help with managing compose projects in arbitrary directories.

The docker-compose.yml file is fetched from the Ghostwriter GitHub releases (see GhostManager/Ghostwriter#803).

This also adds update checking functionality - compose up will check for updates after running by default (set GWCLI_AUTO_CHECK_UPDATES to disable) and the check-version subcommand will manually do a check. install can be used to update to the latest (or a selected) version.

Instead of using global variables and repeating some of the logic in
subcommands, move the state into a DockerInterface object and use
methods to interact with it.

Makes interfacing with docker a bit more flexible, for eventual
supporting of docker files outside of the executable's directory.
Implement a GetDaemonClient method that lazily initializes the daemon
client, that also avoids repeating the initialization logic in modules.
Move env vars from a global to a field on the docker interface. Cleans
up a bunch of `if dev` branches.
More reliable than looking for the container label, especially when
multiple instances of Ghostwriter are running.
There is now a `--mode` argument at the root level, which can one of
the following:

* `prod` (the default): In this new mode, Ghostwriter-CLI will write
  an embedded docker-compose.yml file that points to the published
  GW images to the XDG/Windows app data directories. With this, GW-CLI
  no longer needs to run inside of the GW source repo, simplifying
  installation
* `local-prod`: Equivalent to the previous default, runs the GW checkout
  in the exe's directory in production mode
* `local-dev`: Equivalent to the `--dev` flag, runs the GW checkout in
  the exe's directory in development mode

Currently this uses an embedded docker-compose.yml that points to GW
images that I have published. Once official GW images are published,
the compose file should be updated to use them.
@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 18.74272% with 698 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.25%. Comparing base (2c03e3f) to head (afde3ff).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/internal/docker.go 9.57% 229 Missing and 7 partials ⚠️
cmd/healthcheck.go 0.00% 67 Missing ⚠️
cmd/install.go 0.00% 65 Missing ⚠️
cmd/internal/latest_release.go 0.00% 55 Missing ⚠️
cmd/restore.go 0.00% 51 Missing ⚠️
cmd/pgUpgrade.go 0.00% 42 Missing ⚠️
cmd/containersBuild.go 0.00% 23 Missing ⚠️
cmd/backup.go 0.00% 16 Missing ⚠️
cmd/checkVersion.go 0.00% 14 Missing ⚠️
cmd/test.go 0.00% 13 Missing ⚠️
... and 20 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
- Coverage   25.57%   21.25%   -4.33%     
==========================================
  Files          37       39       +2     
  Lines        1294     1407     +113     
==========================================
- Hits          331      299      -32     
- Misses        914     1063     +149     
+ Partials       49       45       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add `--pull` flag to `build` so that it also pulls containers for system
managed builds
Add missing `--rm` flag to the `run` command
Remove embedded docker compose file for production mode, and instead
download the `gh-cli.yml` file from the latest Ghostwriter release.

Currently pointing at my fork since the main repo doesn't have a release
with the file yet.
Checks the current version of ghostwriter (from the docker-compose.yml
file for production or the VERSION file for local modes) with the latest
available release from Github.
After running `containers up`, fetch the current and latest versions,
and print an upgrade reminder message if they differ. Only check once
every 24 hours to prevent excessive network requests.
Forgot to remove this when we switched GW-CLI to downloading it instead.
If `GWCLI_AUTO_CHECK_UPDATES` is set to false in the env file, the
automatic update checks will be skipped. It defaults to true.
Now that the workflow that generates it has been published, switch
from my fork to the main repo.
@ColonelThirtyTwo ColonelThirtyTwo changed the title DRAFT: Mode to manage compose file and fetch docker images from registry Mode to manage compose file and fetch docker images from registry Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant