|
| 1 | +# shimkit 0.15.0 |
| 2 | + |
| 3 | +Sixth engine in the `shimkit db` registry: Redis. For the full |
| 4 | +machine-readable changelog, see [`CHANGELOG.md`](../../CHANGELOG.md). |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## TL;DR |
| 9 | + |
| 10 | +``` |
| 11 | +shimkit db redis up # redis:7-alpine on 127.0.0.1:16379 |
| 12 | +shimkit db redis shell # redis-cli with AUTH |
| 13 | +shimkit db redis down # stop + remove the container |
| 14 | +shimkit db redis status # state + port |
| 15 | +shimkit db redis reset # SEVERE — drop the container AND its volume |
| 16 | +``` |
| 17 | + |
| 18 | +`dump` and `--on-host` are intentionally **not** supported on |
| 19 | +Redis (see below). |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Why Redis |
| 24 | + |
| 25 | +Local Redis is the standard cache + queue backend for Laravel |
| 26 | +(`CACHE_DRIVER=redis` / queue worker), Symfony (`CacheItemPool` via |
| 27 | +Redis), Django (Channels), and just about everything else. Adding |
| 28 | +it to the `db` registry means one command brings up an authed |
| 29 | +Redis container alongside your SQL DB: |
| 30 | + |
| 31 | +```bash |
| 32 | +shimkit db postgres up |
| 33 | +shimkit db redis up |
| 34 | +shimkit framework symfony env --yes --db postgres ./my-app |
| 35 | +echo "REDIS_URL=redis://default:shimkit-dev@127.0.0.1:16379/0" >> ./my-app/.env.local |
| 36 | +``` |
| 37 | + |
| 38 | +No `apt install redis-server`, no systemd config, no AUTH file |
| 39 | +to maintain — same lifecycle as the other engines. |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## What's new |
| 44 | + |
| 45 | +### `Engine.up_command(password)` (new ABC method) |
| 46 | + |
| 47 | +Default returns `None` (use image's default `CMD`). Redis overrides |
| 48 | +to return: |
| 49 | + |
| 50 | +```python |
| 51 | +["redis-server", "--requirepass", PASSWORD, "--appendonly", "yes"] |
| 52 | +``` |
| 53 | + |
| 54 | +The official `redis:7-alpine` image doesn't read a `REDIS_PASSWORD` |
| 55 | +env var (that's a Bitnami convention). The clean way to configure |
| 56 | +AUTH is to pass `--requirepass` as the container command. The new |
| 57 | +ABC method is available to any future engine that needs argv-passed |
| 58 | +config. |
| 59 | + |
| 60 | +### Redis specifics |
| 61 | + |
| 62 | +- **Port**: `127.0.0.1:16379` (shimkit's `:1` prefix on the |
| 63 | + upstream port — keeps a system-installed Redis from colliding). |
| 64 | +- **Volume**: `~/.shimkit/data/db/redis-dev/` mounts at `/data` |
| 65 | + inside. AOF + RDB live here. |
| 66 | +- **Persistence**: AOF enabled by default (`--appendonly yes`). |
| 67 | +- **AUTH**: mandatory. Default password `shimkit-dev`; override |
| 68 | + via `--password` or `tools.db.default_password`. |
| 69 | +- **Image**: `redis:7-alpine` (~30 MB). |
| 70 | + |
| 71 | +### Why no `dump` |
| 72 | + |
| 73 | +Redis dumps are RDB snapshots — binary, version-tied to the |
| 74 | +server. The right backup story is volume-level (just `cp` the |
| 75 | +`/data/dump.rdb` file inside the managed volume), not a stream |
| 76 | +piped to stdout. shimkit returns `supports_dump=False` rather |
| 77 | +than emitting half-broken bytes. |
| 78 | + |
| 79 | +To trigger an RDB write: |
| 80 | + |
| 81 | +```bash |
| 82 | +shimkit db redis shell |
| 83 | +# 127.0.0.1:16379> SAVE (synchronous, blocks) |
| 84 | +# 127.0.0.1:16379> BGSAVE (background) |
| 85 | +``` |
| 86 | + |
| 87 | +The file lands at `~/.shimkit/data/db/redis-dev/dump.rdb` on the |
| 88 | +host. |
| 89 | + |
| 90 | +### Why no `--on-host` |
| 91 | + |
| 92 | +Same charter as mongo and phpmyadmin: shimkit doesn't install host |
| 93 | +packages. Users wanting host Redis run `brew install redis` / |
| 94 | +`apt install redis-server` themselves and manage it via systemd |
| 95 | +/ brew services directly. The `--on-host` mode for mysql / |
| 96 | +mariadb / postgres (v0.9.0) exists because those are the engines |
| 97 | +where users frequently switch between host + container; Redis |
| 98 | +isn't. |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## `stack lemp` interaction |
| 103 | + |
| 104 | +The LEMP recipe is SQL-only. Trying to use `--db redis` now |
| 105 | +returns a clear error: |
| 106 | + |
| 107 | +``` |
| 108 | +✗ `stack lemp` only supports SQL backing DBs (mariadb, mysql, |
| 109 | + postgres); got 'redis'. Run `shimkit db redis up` separately |
| 110 | + to add a cache / non-relational backend. |
| 111 | +``` |
| 112 | + |
| 113 | +Run them side-by-side: |
| 114 | + |
| 115 | +```bash |
| 116 | +shimkit stack lemp up --db postgres --project myapp |
| 117 | +shimkit db redis up |
| 118 | +``` |
| 119 | + |
| 120 | +Both bind 127.0.0.1; the framework container reaches Redis via |
| 121 | +`host.docker.internal:16379` on Docker Desktop or |
| 122 | +`172.17.0.1:16379` on Linux (`host-gateway`). |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Stats |
| 127 | + |
| 128 | +- Tests: 1070 → 1086 (+16) |
| 129 | +- Gates: pytest, ruff, mypy strict — all green |
| 130 | +- New optional extras: 0 |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## Upgrading |
| 135 | + |
| 136 | +```bash |
| 137 | +uv tool upgrade shimkit |
| 138 | +pipx upgrade shimkit |
| 139 | +``` |
| 140 | + |
| 141 | +Existing db engines see no behavioural change. To start using |
| 142 | +Redis, `shimkit db redis up`. |
0 commit comments