Repository navigation
Conversation
A new Docker install was: clone (undocumented), copy .env.example by hand, fix an Unraid data path and a Perth time zone, replace `changeme`, run the start script, and then guess when the server was up. Start-Codeman.sh now does all of it from a fresh clone: - Preflight names the fix for a missing docker CLI, a missing or too-old Compose plugin (config --environment needs 2.27.2, docker/compose#11891), and an unreachable daemon (docker group, never sudo). - With no docker/.env, it asks three questions (data folder, port, password; Enter takes each default: ~/codeman-docker, 3000 or the next free port, a generated password) and writes docker/.env FROM the example, so every key the updater's diffRequiredEnvKeys expects is present. Mode 0600, host time zone, values Compose would interpolate single-quoted. Refuses $HOME, ~/.codeman (a native install's state dir) and anything inside the checkout (the image build context). --yes / no TTY take the defaults, --setup-only stops after writing the file. An existing .env is never edited, and root never runs the setup (Unraid keeps the hand route). - After `up`, it waits until the server answers (docker exec probe, crash loop caught by the restart count) and prints the URL, the LAN URL, the generated password and the logs/stop commands; --no-wait skips the wait. - `changeme` is refused before anything starts (the container publishes on every interface and holds the Docker socket); Update-Codeman.sh checks it before its build and down so the stack is never left stopped. - Compose settings are read with ONE config --environment call, with its error reported, instead of three silent ones. docker-compose.yaml and server.Dockerfile are untouched (their hashes gate the in-app updater), and .env.example changes values and comments only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What this is
Codeman ships a Docker Compose deployment in
docker/: the server runs in a container and starts Docker cases as sibling containers through the host's Docker socket. Until now a new user had to know to clone the repo first, copydocker/.env.exampletodocker/.envby hand, and replace three values in it: an Unraid data path (/mnt/user/appdata/codeman), anAustralia/Perthtime zone and the passwordchangeme. Then they randocker/Start-Codeman.shand had to guess when the server was ready. A missing Docker, an old Compose or a socket permission problem showed up as a raw Compose error.This PR turns that into two commands from a fresh clone:
Not touched:
docker-compose.yamlandserver.Dockerfile. Neither is edited and.env.examplegains no new key (only values and comments change). All three feed the in-app updater's environment gate, so changing them would make every existing Docker install's next in-app update refuse until its owner reruns the script on the host. There are no server, API or frontend changes.What
Start-Codeman.shdoes nowPreflight. Before anything else it checks that the
dockercommand exists, that the Compose v2 plugin exists and is at least 2.27.2, and that the daemon answers.docker compose config --environment, which first shipped in Compose 2.27.2 (config --environment docker/compose#11891). On older versions it used to die onunknown flag.sudo usermod -aG docker $USER, not at sudo.First-run setup, only when
docker/.envdoes not exist. It asks three questions, and Enter takes each default:~/codeman-docker.It writes
docker/.envby rewriting fiveKEY=lines of.env.example(time zone from the host, data path, cases path, port, password). Every key the example sets is therefore present, which is the checkdiffRequiredEnvKeysruns before an update. The file is mode 0600, and values containing characters Compose would interpolate are single-quoted.It refuses three locations for the data folder:
$HOMEand~/.codeman: the data folder becomes the container's home, so its.codemanwould sharestate.jsonwith a native install.Other behaviour:
--yes, or no terminal attached, takes the defaults.CODEMAN_APPDATA_PATH,CODEMAN_PORTandCODEMAN_PASSWORDin the environment preset them.--setup-onlywrites the file and stops..envroute) and never edits an existing.env.Wait and summary. After
up -dit sends the compose healthcheck's own/api/statusrequest throughdocker execevery 2 s. The healthcheck itself first runs only after its 30 s interval.--no-waitskips the wait.One settings read. Settings come from a single
config --environmentcall whose failure is reported, instead of three unchecked ones.changemeis refused before anything is built or started, because the container publishes on every interface and holds the Docker socket.Update-Codeman.shruns the same check before its build anddown, so it can never leave the stack stopped.The README,
docker/README.md,docs/docker-compose.mdand the wiki's Installation page now lead with the clone-and-run flow. The manual.envroute stays documented for Unraid and PowerShell.Behaviour changes for existing installs
changeme. An empty password only gets a warning.Start-Codeman.shno longer returns right afterup -d. It waits until the server answers (up to 180 s) and exits 1 on a crash loop or timeout. Scripts that want the old behaviour can pass--no-wait.docker/.envis never prompted for or rewritten.Reviewing the diff
Start-Codeman.shgrows from 309 to 920 lines, and most of the growth is user-facing text:printflines go from 28 to 153.docker/.env)config --environmentread plus thechangemecheck, a clearermkdirerror and aDOCKER_SOCKEThintcompose_failed(new)exec ... uplines becameupfollowed byreport_when_readyThe override-file block and
owner_of()are unchanged;test/docker-entrypoint.test.tscompares both byte for byte againstUpdate-Codeman.sh.Update-Codeman.shgains only thechangemecheck (16 lines).Testing
New tests:
test/docker-start-setup.test.tshas 39 tests that run the real scripts against a stubdocker, with stdin not a terminal. They cover:.envthat passesdiffRequiredEnvKeysand matches the example line for line except the five keys;.envleft byte-identical;changemerefused by both scripts with nothing built or stopped.With a real Unix socket they also run the whole start, wait and summary path, plus a crash loop, a failed
upand--no-wait.Test runs: all Docker test files pass (93 tests). The full gate in the worktree had 10,373 passing and one failure,
frontend-public-tooling, which needs generated spreadsheet assets that a worktree withoutnpm installlacks. It passes in the main checkout.bash 3.2 (the
bash:3.2image, the version macOS ships as/bin/bash): syntax, the setup flow, quoting and the helper functions.Real Docker (Compose 5.5.0):
Update-Codeman.shhandoff.Real Compose reads the quoted
.envvalues ('pa$$ #w0rd!', a path with a space) literally.Not verified
npm cifails inside every container withERR_SSL_CIPHER_OPERATION_FAILED, on the Node 22.22 and 22.23 images, with bridge and host networking, while nativenpm ciworks. So the real-Docker runs used a stand-in image through a gitignored override:build: !reset nullplus a tiny Node server on the same port. The script's Docker calls are identical either way; the real image's own startup was not exercised.Risk
changemeon existing installs is deliberate: a known password on a published port that holds the Docker socket is host root. Anyone who kept the example password now has to change it before the next start.