feat: add Mattermost Docker deployment with user provisioning (#143)#151
Open
t0kubetsu wants to merge 3 commits into
Open
feat: add Mattermost Docker deployment with user provisioning (#143)#151t0kubetsu wants to merge 3 commits into
t0kubetsu wants to merge 3 commits into
Conversation
- Two-stage Dockerfile: golang:alpine builder + mattermost/mattermost-team-edition:latest runtime - compose.yml: db (postgres:16-alpine), mattermost, provisioner services with healthchecks - provisioning/init.sh: CLI user creation + REST API for team, membership, and PAT generation - provisioning/users.yml: declarative user manifest (admins + trainees) - Makefile: build/up/down/logs/tokens/reprovision targets matching gitea pattern - .env.example, .dockerignore, README.md included
- Fix reprovision: remove stamp via docker run against named volume, not docker exec on wrong container - Fix make tokens: use docker run against named volume (docker exec fails on stopped container) - Fix token leak: write tokens to file only, not stdout/logs - Fix yq: explicitly install mikefarah/yq v4.44.1 - Add --email-verified to mattermost user create - Fix make clean: scope to project only - Replace fixed sleep with retry loop for REST login
Author
Code review — fixes appliedFix commit: PR descriptionFixed the raw Critical fixes applied
Open items (non-blocking for lab)
|
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.
Summary
Closes #143
mattermostCLI, then creates a default team, adds members, and generates personal access tokens via the REST APImattermost-tokens) and accessible viamake tokensChanges
Dockerfilegolang:alpinebuilder (yq/jq) →mattermost/mattermost-team-edition:latestruntimecompose.ymldb,mattermost,provisioner; all with healthchecks anddepends_onorderingprovisioning/init.shprovisioning/users.ymladmins[]+users[])Makefilebuild-up,logs-provisioner,tokens,reprovision,clean,termtargets.env.example.dockerignore.env,*.key,*.pem,README.mdfrom build contextREADME.mdDesign Notes
golang:alpine— matches the "use official project base image" requirement since Mattermost is written in Gomattermost/mattermost-team-edition:latest— Alpine-based, ships themattermostbinary needed for CLI user creationmattermost --config /mattermost/config/config.json user createwrites directly to the DB; no HTTP auth needed at this stepPOST /api/v4/users/{id}/tokens) with admin bearer token; admin creates tokens on behalf of all users/tokens/.provisionedstamp file prevents double-provisioning on container restartTesting
make build-up— all three services start cleanlymake logs-provisioner— provisioner completes without errorsmake tokens— printsusername:tokenlines for all 4 userscurl -H "Authorization: Bearer <token>" http://localhost:8065/api/v4/users/me— returns user objectmake reprovision— re-runs provisioner without duplicating usersRelated Issues