Skip to content

Latest commit

 

History

History
142 lines (103 loc) · 3.86 KB

File metadata and controls

142 lines (103 loc) · 3.86 KB

shimkit 0.15.0

Sixth engine in the shimkit db registry: Redis. For the full machine-readable changelog, see CHANGELOG.md.


TL;DR

shimkit db redis up         # redis:7-alpine on 127.0.0.1:16379
shimkit db redis shell      # redis-cli with AUTH
shimkit db redis down       # stop + remove the container
shimkit db redis status     # state + port
shimkit db redis reset      # SEVERE — drop the container AND its volume

dump and --on-host are intentionally not supported on Redis (see below).


Why Redis

Local Redis is the standard cache + queue backend for Laravel (CACHE_DRIVER=redis / queue worker), Symfony (CacheItemPool via Redis), Django (Channels), and just about everything else. Adding it to the db registry means one command brings up an authed Redis container alongside your SQL DB:

shimkit db postgres up
shimkit db redis up
shimkit framework symfony env --yes --db postgres ./my-app
echo "REDIS_URL=redis://default:shimkit-dev@127.0.0.1:16379/0" >> ./my-app/.env.local

No apt install redis-server, no systemd config, no AUTH file to maintain — same lifecycle as the other engines.


What's new

Engine.up_command(password) (new ABC method)

Default returns None (use image's default CMD). Redis overrides to return:

["redis-server", "--requirepass", PASSWORD, "--appendonly", "yes"]

The official redis:7-alpine image doesn't read a REDIS_PASSWORD env var (that's a Bitnami convention). The clean way to configure AUTH is to pass --requirepass as the container command. The new ABC method is available to any future engine that needs argv-passed config.

Redis specifics

  • Port: 127.0.0.1:16379 (shimkit's :1 prefix on the upstream port — keeps a system-installed Redis from colliding).
  • Volume: ~/.shimkit/data/db/redis-dev/ mounts at /data inside. AOF + RDB live here.
  • Persistence: AOF enabled by default (--appendonly yes).
  • AUTH: mandatory. Default password shimkit-dev; override via --password or tools.db.default_password.
  • Image: redis:7-alpine (~30 MB).

Why no dump

Redis dumps are RDB snapshots — binary, version-tied to the server. The right backup story is volume-level (just cp the /data/dump.rdb file inside the managed volume), not a stream piped to stdout. shimkit returns supports_dump=False rather than emitting half-broken bytes.

To trigger an RDB write:

shimkit db redis shell
# 127.0.0.1:16379> SAVE       (synchronous, blocks)
# 127.0.0.1:16379> BGSAVE     (background)

The file lands at ~/.shimkit/data/db/redis-dev/dump.rdb on the host.

Why no --on-host

Same charter as mongo and phpmyadmin: shimkit doesn't install host packages. Users wanting host Redis run brew install redis / apt install redis-server themselves and manage it via systemd / brew services directly. The --on-host mode for mysql / mariadb / postgres (v0.9.0) exists because those are the engines where users frequently switch between host + container; Redis isn't.


stack lemp interaction

The LEMP recipe is SQL-only. Trying to use --db redis now returns a clear error:

✗ `stack lemp` only supports SQL backing DBs (mariadb, mysql,
  postgres); got 'redis'. Run `shimkit db redis up` separately
  to add a cache / non-relational backend.

Run them side-by-side:

shimkit stack lemp up --db postgres --project myapp
shimkit db redis up

Both bind 127.0.0.1; the framework container reaches Redis via host.docker.internal:16379 on Docker Desktop or 172.17.0.1:16379 on Linux (host-gateway).


Stats

  • Tests: 1070 → 1086 (+16)
  • Gates: pytest, ruff, mypy strict — all green
  • New optional extras: 0

Upgrading

uv tool upgrade shimkit
pipx upgrade shimkit

Existing db engines see no behavioural change. To start using Redis, shimkit db redis up.