diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-02 01:47:15 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-02 01:47:15 +0300 |
| commit | 462e4ac6995760646b53e110f2662a6cd14fc882 (patch) | |
| tree | 3acf0a34361cd4c48dfb27164eadf1d51823c1ca /README.md | |
| parent | 5c744e37b6375f3f6842cdf3758a180a649bafea (diff) | |
ychat: add Mode B - embedded SQLite backend for real user accounts (task cs0)
Adds a second database backend alongside the (already-broken/dormant) MySQL
one: --enable-sqlite (configure.ac/configure, mirrors --enable-mysql),
USE_SQLITE (glob.h, mirrors USE_MYSQL), and a con/data implementation using
sqlite3_prepare_v2/bind/step (parameterized queries - safer than the MySQL
path's hand-rolled character-transliteration escaping). chat.database.dbname
doubles as the SQLite file path; the "user" table is created on first
connect (CREATE TABLE IF NOT EXISTS) since SQLite has no separate schema-
provisioning step. New Dockerfile.sqlite (Mode B) builds and runs this in
Rocky Linux 9; DOCKER-SQLITE.md documents everything in detail.
DATABASE had never actually been compiled before this (Mode A always
disables it, and --enable-mysql doesn't work - configure.ac registers it as
AC_ARG_ENABLE(mysqlclient,...) but the gating check tests a third, never-set
$enable_mysql - left alone, this task is about moving away from MySQL, not
fixing it). Getting DATABASE to compile and actually run for the first time
surfaced two real, previously-undetectable bugs, both fixed:
- class data collided with std::data() (C++17) under "using namespace std"
("reference to 'data' is ambiguous") - renamed to ychatdb throughout
(data.h/cpp, wrap.h/cpp, yc_register.cpp). Same bug class as the
function->mod_func_t rename already made in glob.h.
- data_base.cpp's config-query parser used "unsigned i_pos" for a
string::npos comparison - truncating npos to 32-bit makes the
"no more tokens" check never true, and i_pos+1 wraps back to 0, so the
loop never advances: an infinite loop that OOM-killed the container within
seconds of startup. Fixed to size_t (same bug class already fixed
repeatedly in ../yhttpd).
Verified in Docker: register creates a row, wrong password is rejected,
correct password succeeds, and - the actual point of this task - a second
user's login still works identically after a full container restart with
the db file on a bind-mounted volume, proving persistence. Independently
reproduced by a fresh-context review agent, which also rebuilt +
re-verified the whole flow itself.
Not deployed to f3s - this is a local proof of concept alongside the live
Mode A (in-memory guest chat) deployment.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -6,13 +6,15 @@ are kept here as historical/revival code. | Subproject | What it is | Status | |------------|------------|--------| -| [`./ychat`](ychat/) | An HTTP-based web chat server (browsers are the clients; CSS/HTML/JS only). | **Revived & deployed** — builds in Docker, runs on the f3s k3s cluster. | -| [`./yhttpd`](yhttpd/) | A tiny standalone http server derived from ychat's socket/threading engine. | Unrevived (see its own tree). | -| [`./ycurses`](ycurses/) | A curses front-end experiment. | Unrevived (see its own tree). | +| [`./ychat`](ychat/) | An HTTP-based web chat server (browsers are the clients; CSS/HTML/JS only). | **Revived & deployed** — Mode A (in-memory guest chat) builds in Docker, runs on the f3s k3s cluster. Mode B (embedded SQLite, real persistent accounts) builds and works locally — see [`ychat/DOCKER-SQLITE.md`](ychat/DOCKER-SQLITE.md) — but isn't deployed. | +| [`./yhttpd`](yhttpd/) | A tiny standalone http server derived from ychat's socket/threading engine. | Builds and serves reliably in Docker (verified under concurrent load) — not deployed. See [`./yhttpd/DOCKER.md`](yhttpd/DOCKER.md). | +| [`./ycurses`](ycurses/) | A curses front-end experiment. | Builds and runs in Docker (a demo, not a service, so nothing to deploy) — see [`./ycurses/BUILD.md`](ycurses/BUILD.md). | The detailed, up-to-date build/deploy notes for the chat live in -[`./ychat/DOCKER.md`](ychat/DOCKER.md). The rest of this file is a quickstart -for running **ychat** locally in Docker and accessing it. +[`./ychat/DOCKER.md`](ychat/DOCKER.md) (Mode A) and +[`./ychat/DOCKER-SQLITE.md`](ychat/DOCKER-SQLITE.md) (Mode B). The rest of +this file is a quickstart for running **ychat** locally in Docker and +accessing it. > The ychat tree has been substantially fixed during this revival (legacy-C++ > build fixes, a from-scratch streaming-chat layer, and a security/bug sweep). |
