feat: docker compose support + env var config overrides#40
Merged
msimerson merged 6 commits intoNicTool:mainfrom Apr 10, 2026
Merged
feat: docker compose support + env var config overrides#40msimerson merged 6 commits intoNicTool:mainfrom
msimerson merged 6 commits intoNicTool:mainfrom
Conversation
docker compose up gets the API running against MariaDB 11 on node:22-trixie-slim. generate-env.sh creates .env with random passwords, same convention as NicTool 2's generate-env.sh. config.js now checks env vars (DB_HOST, DB_PASSWORD, HTTP_HOST, etc.) after parsing TOML -- fully backwards compatible, the TOML values are just defaults now. config tests save/clear/restore the env vars so they should pass in both CI and docker. init-mysql.sh picks up MYSQL_ROOT_PASSWORD when running inside the mariadb container, prefers the mariadb client over mysql, and supports DB_USER/DB_NAME/SQL_DIR env vars. quick start: ./generate-env.sh && docker compose up --build Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Move Dockerfile, docker-compose.yml, generate-env.sh, .env.example into docker/ to keep the repo root clean. Namespace all config env var overrides with NICTOOL_ prefix to match NicTool 2 conventions (NICTOOL_DB_HOST, NICTOOL_DB_USER_PASSWORD, NICTOOL_HTTP_HOST, etc). DB_ROOT_PASSWORD stays unprefixed as it's a MariaDB convention shared with NicTool 2. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Is this still a Draft? |
Adds an optional 'server' service behind the 'ui' and 'e2e' profiles. Builds from the sibling NicTool/server repo, configurable via NICTOOL_SERVER_PATH for CI checkouts. docker compose --profile ui up --build # full stack docker compose up --build # db + api only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
i'm knackered, need to test in daylight w/fresh font' of tokens |
- NICTOOL_TLS env var controls TLS (defaults to auto, which preserves existing cert discovery behavior). Set to false in local .env for plain HTTP dev. - Bind-mount server source (index.js, bin/, html/) so edits are live without rebuilding the image - Port mapping uses SERVER_PORT and SERVER_CONTAINER_PORT env vars for flexibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Validate port env vars (NICTOOL_DB_PORT, NICTOOL_HTTP_PORT) via parsePort() — throws on non-numeric or out-of-range values instead of silently passing NaN to the connection layer. - Add comment to Dockerfile explaining why --omit=dev is safe for running tests (node:test is stdlib, devDeps are only eslint/prettier). - Add comment to init-mysql.sh explaining SQL_DIR default behavior in Docker vs. bare-metal contexts. - Add trailing newline to init-mysql.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
msimerson
approved these changes
Apr 10, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Matt -- this is my Claw's first crack at #19. The goal was to get from clone to running API in two commands, which worked well once claude and I figured out the mariadb auth dance.
The theme is making the API easy to run locally without touching the existing config files or CI behavior. Everything should be backwards compatible -- if no env vars are set, behavior is identical to today.
The two-command version:
./generate-env.sh && docker compose up --buildThat gets you MariaDB 11 + the API on
node:22-trixie-slim(Debian Trixie, current stable).generate-env.shfollows the same convention as the NicTool 2 one -- random passwords, safe to re-run.The config change is the interesting bit --
lib/config.jsnow checks env vars likeDB_HOST,DB_PASSWORD,HTTP_HOSTafter parsing TOML. The TOML values become defaults that env vars can override. This is what makes docker compose work without maintaining separate config files, but it should also help with any deployment where env vars are easier than editing TOML (k8s, systemd, etc.).init-mysql.shneeded a few tweaks to work inside the mariadb container -- it picks upMYSQL_ROOT_PASSWORD, prefers themariadbclient overmysql(mariadb 11 dropped the symlink), and usesCREATE DATABASE IF NOT EXISTSso it plays nice with the container's own init. All 339 tests pass in docker.Two questions for you --
.-- but NicTool 2 useddist/docker/. Want me to move it?DB_HOST/DB_PASSWORD/HTTP_HOST-- should these be namespaced likeNICTOOL_DB_HOSTinstead?Let me know if anything needs rework or looks OK to merge as-is.