Commit Graph

74 Commits

Author SHA1 Message Date
15bcaafa85 feat: add exit-code to link check 2026-09-08 11:27:30 +02:00
b2a0c08256 feat: add verbose and dry run 2026-09-08 11:27:26 +02:00
ab93e7ef4f fix: give the readiness wait a timeout 2026-09-08 11:27:22 +02:00
a489d77b0a fix: write the dump to a temporary file first 2026-09-08 11:27:18 +02:00
1bb205bb79 feat: build commands from arguments instead of strings 2026-09-08 11:27:14 +02:00
25f7b7df9d feat: fail when a command fails 2026-09-08 11:27:09 +02:00
0aeecdcb54 feat: remove stop_all 2026-09-08 11:27:03 +02:00
9caf9599b3 merge: postgres dump formats 2026-09-08 11:13:36 +02:00
ad269308cc feat: dump in every format import understands 2026-09-08 11:13:22 +02:00
77703485b9 feat: support custom format, plain sql and cluster dumps 2026-09-08 11:12:49 +02:00
0f16949190 merge: compose subcommand deprecation 2026-09-07 15:14:41 +02:00
6e44527a9a feat: deprecate compose subcommand 2026-09-07 13:11:36 +00:00
d11b0c68cd feat: drop dotenvy 2026-09-07 13:11:36 +00:00
9d63233d9a feat: detect the django and postgres services
ahab guessed that the django service is called django and the postgres one db,
falling back on AHAB_DJANGO_CONTAINER and AHAB_POSTGRES_CONTAINER. The standard
project layout happens to agree, but nothing enforces it, and a stack naming
them web and database could not use ahab without setting both variables.

One `docker compose config --format json` call, roughly 120ms, resolves the
stack even while it is down, and the services are identified from what they
are rather than what they are called:

- postgres is the service whose image is a postgres flavour, matching postg,
  timescale, pgvector or citus. Nothing else counts.
- django is the service that both builds an image and has
  DJANGO_SETTINGS_MODULE in its environment. A celery worker sharing the same
  build and env_file matches too, so published ports break the tie: the service
  answering requests wins.

Neither guess is allowed to be wrong quietly. No match, or two candidates that
cannot be told apart, is an error naming the services it looked at. There is no
variable to fall back on: both container variables are gone, along with the
guessed defaults they backed up, so an ambiguous stack is fixed in the compose
file rather than worked around per developer.

Every service lookup goes through these rules, so `compose exec` and the whole
django group agree on which container they mean.

POSTGRES_USER and POSTGRES_DB come off the detected service, so dropdb,
createdb, pg_restore and pg_dump stop assuming the role and database are both
literally `db`, falling back to that only when the service declares neither.

Note that env_file entries are merged into a service's environment, so
POSTGRES_* is not safe for identifying the database service: one such line in a
project's .env would make the django service match as well. That is why
identification uses the image and only credentials use the environment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 13:11:35 +00:00
836bbaac08 feat: let docker compose find its own file 2026-09-07 15:06:17 +02:00
7d71dd054c docs: bring the readme up to date 2026-09-07 15:06:12 +02:00
d6bf3efb15 merge: completions improvements 2026-09-04 16:03:46 +02:00
ef19f49c63 feat: add completions subcommand 2026-09-04 16:03:35 +02:00
627812029d fix: install completions per shell, and re-run when asked 2026-09-04 16:03:08 +02:00
471169612b merge: maintenance 2026-09-04 11:46:35 +02:00
1afff02ee9 ci: add gitlab pipeline 2026-09-04 11:24:21 +02:00
8751c39cce style: run cargo fmt 2026-09-04 11:24:14 +02:00
e10e1fb017 chore: drop allow(unused) and clear what it hid 2026-09-04 11:24:02 +02:00
ec4168769e fix: keep existing contents in create_file 2026-09-04 11:23:52 +02:00
a301097120 refactor: drop unused CommandBuilder::new 2026-09-04 11:23:46 +02:00
3ed1fad4a7 chore: move to edition 2024 2026-09-04 11:23:42 +02:00
c52683e53c chore: upgrade dependencies 2026-09-04 11:23:08 +02:00
3dc3da4592 merge: link subcommand 2026-09-03 15:58:41 +02:00
54395f83e4 feat: add link command 2026-09-03 15:58:28 +02:00
63d04a9393 chore: release v0.4.2 v0.4.2 2026-03-02 14:51:03 +01:00
f92227a679 chore: generalize build.sh 2026-03-02 14:50:43 +01:00
27a1ec6d2c chore(release): v0.4.1 v0.4.1 2026-02-26 17:45:58 -05:00
1b1f9a31ed feat: add -L to docker cp 2026-02-26 17:45:28 -05:00
e5eddb39f7 chore(release): v0.4.0 v0.4.0 2026-02-24 08:53:28 -05:00
2000204250 feat: update default service names 2026-02-24 08:52:08 -05:00
7912e9a516 chore(release): v0.3.2 v0.3.2 2025-07-01 17:37:36 +02:00
568d126fc2 test: add imports to doc snippets 2025-07-01 17:36:36 +02:00
3ce4cbfad7 chore(release): v0.3.1 v0.3.1 2025-02-12 16:53:28 +01:00
36fcc84881 feat: don't read DJANGO_SETTINGS_MODULE 2025-02-12 16:52:50 +01:00
c8b3a817f0 chore: correctly document env variables in README 2025-02-12 16:52:09 +01:00
f7737ea00d fix: dump from database db 2024-11-27 20:00:37 +01:00
f56965abc2 chore: add completion and configuration to readme 2024-11-27 18:48:20 +01:00
e7308bd5c6 feat: control default services via env vars
Read default postgres compose service name and default django compose
service name from env variables.

AHAB_POSTGRES_CONTAINER - defaults to `appserver`
AHAB_DJANGO_CONATINER - defaults to `postgresdb`

Default values are there for 100% backwards compatibility.
2024-11-27 18:13:12 +01:00
3077420db2 feat!: respect COMPOSE_FILE env and remove docker command
Read COMPOSE_FILE from env and use it if it is set. Default is still
docker/local/docker-compose.yaml.

BREAKING CHANGE: Removed docker subcommand. Added deprecation notice to
compose subcommand.
2024-10-25 09:37:13 +02:00
73a0b87c31 feat: swap println for eprintln or debug_eprintln
Unified expected output to always eprintln so outputs can be piped to
other processes. Added debug_eprintln and switched all occurances of
debug_println.
2024-10-25 09:03:49 +02:00
6fcf48ed61 feat: redirect pg_isready output to /dev/null
Fixed bug where restore commands were called inside pg_isready loop.
Made CommandBuilder::build public. Redirected stdout for pg_isready
calls to /dev/null via Stdio::null().
2023-11-27 20:58:28 +01:00
0b0ca06398 chore: update README with install info
Added install instructions to README; both normal and debug install.
2023-11-27 20:40:37 +01:00
98f02c1c08 feat: pg_isready in postgres import
Fixed issue where arguments passed to `compose stop` weren't passed to
the underlying command. Added pg_isready call between each command call
in restore script.
2023-11-27 20:40:24 +01:00
2754a3bb30 feat: compile time completion generation
Removed `completion` command in favor of compile time completion
generation. This tool will only be build from source for the foreseeable
future so this makes sense for now.
2023-08-09 14:45:07 +02:00
e061d6dc6c feat: add compose ps command
Ps is new command scoped under compose. It is just proxy to `docker
compose ps`.
2023-08-09 13:59:58 +02:00