Skip to content

Commit 9fc161e

Browse files
committed
fix(docker): volume permissions and su-exec drop to marchat
Keep docker-compose.yml to port/DB only; document MARCHAT_ADMIN_KEY and MARCHAT_USERS via .env in README. chore: v0.10.0-beta.2
1 parent 05ab9ae commit 9fc161e

9 files changed

Lines changed: 67 additions & 57 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
workflow_dispatch:
77
inputs:
88
version:
9-
description: 'Version to build (e.g., v0.10.0-beta.1)'
9+
description: 'Version to build (e.g., v0.10.0-beta.2)'
1010
required: true
11-
default: 'v0.10.0-beta.1'
11+
default: 'v0.10.0-beta.2'
1212

1313
permissions:
1414
contents: read

Dockerfile

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,20 @@ RUN apk update && apk upgrade --no-cache
2929
ARG USER_ID=1000
3030
ARG GROUP_ID=1000
3131

32-
# Install necessary packages for user management
33-
RUN apk add --no-cache shadow
32+
# shadow: marchat user; su-exec: drop root after fixing volume permissions in entrypoint
33+
RUN apk add --no-cache shadow su-exec
3434

3535
# Create marchat user with specified UID/GID
3636
RUN groupadd -g ${GROUP_ID} marchat && \
3737
useradd -u ${USER_ID} -g marchat -s /bin/sh -m marchat
3838

39-
# Create config directory with proper ownership
40-
RUN mkdir -p /marchat/config && \
41-
chown -R marchat:marchat /marchat
42-
43-
# Switch to marchat user
44-
USER marchat
4539
WORKDIR /marchat
4640

4741
# Copy the binary from builder stage (server only; release zips ship a separate client binary).
4842
COPY --from=builder /marchat/marchat-server .
49-
50-
# Diagnostics: override the entrypoint to run `-doctor` or `-doctor-json` for an env/config summary without starting the HTTP server.
51-
52-
# Copy entrypoint script
53-
COPY --chown=marchat:marchat entrypoint.sh /marchat/entrypoint.sh
54-
RUN chmod +x /marchat/entrypoint.sh
43+
COPY entrypoint.sh /marchat/entrypoint.sh
44+
RUN chmod +x /marchat/entrypoint.sh && \
45+
chown marchat:marchat /marchat/marchat-server /marchat/entrypoint.sh
5546

5647
# Expose port 8080
5748
EXPOSE 8080

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77
[![Go Version](https://img.shields.io/github/go-mod/go-version/Cod-e-Codes/marchat?logo=go)](https://go.dev/dl/)
88
[![GitHub all releases](https://img.shields.io/github/downloads/Cod-e-Codes/marchat/total?logo=github)](https://github.com/Cod-e-Codes/marchat/releases)
99
[![Docker Pulls](https://img.shields.io/docker/pulls/codecodesxyz/marchat?logo=docker)](https://hub.docker.com/r/codecodesxyz/marchat)
10-
[![Version](https://img.shields.io/badge/version-v0.10.0--beta.1-blue)](https://github.com/Cod-e-Codes/marchat/releases/tag/v0.10.0-beta.1)
10+
[![Version](https://img.shields.io/badge/version-v0.10.0--beta.2-blue)](https://github.com/Cod-e-Codes/marchat/releases/tag/v0.10.0-beta.2)
1111

1212
A lightweight terminal chat with real-time messaging over WebSockets, optional E2E encryption, and a flexible plugin ecosystem. Built for developers who prefer the command line.
1313

1414
## Latest Updates
1515

16-
### v0.10.0-beta.1 (Current)
16+
### v0.10.0-beta.2 (Current)
17+
- **CLI diagnostics**: `marchat-client` and `marchat-server` support `-doctor` and `-doctor-json` for environment, paths, and config health
18+
- **Build**: `build-release.ps1` sets `CGO_ENABLED=0` for consistent cross-compilation
19+
- **Dependencies**: `modernc.org/sqlite` 1.47.0 → 1.48.0 (via Dependabot)
20+
- **Docs**: Updated LOC and test coverage figures; streamlined beta.1 feature list in README
21+
- **Docker**: image entrypoint fixes `/data` volume permissions and drops to non-root via `su-exec`; Unix line endings on `entrypoint.sh` for reliable Windows-built images
22+
23+
### v0.10.0-beta.1
1724
- **Message Management**: Edit, delete, pin, search messages by ID
1825
- **Reactions**: React to messages with emoji aliases (`:react 42 +1`, `heart`, `fire`, `party`, etc.)
1926
- **Direct Messages**: Private DM conversations between users
@@ -27,6 +34,7 @@ A lightweight terminal chat with real-time messaging over WebSockets, optional E
2734
- **Plugins**: Full plugin system wiring (message forwarding, user list updates, command responses, init handshake, store UI, license enforcement)
2835

2936
### Recent Releases
37+
- **v0.10.0-beta.2**: Doctor CLI, build-release cross-compile fix, sqlite bump, doc metrics refresh, Docker image entrypoint/volume permission fixes
3038
- **v0.9.0-beta.6**: Rebuilt with Go 1.25.8 to address CVE-2026-25679, CVE-2026-27142, CVE-2026-27139
3139
- **v0.9.0-beta.5**: Automated release workflow, PBKDF2 keystore key derivation, JWT secret auto-generation, race condition fixes, Docker optimizations
3240
- **v0.9.0-beta.4**: Fixed admin metrics, restored plugin commands in encrypted sessions, dependency updates
@@ -129,27 +137,44 @@ Key tables for message tracking and moderation:
129137
**Binary Installation:**
130138
```bash
131139
# Linux (amd64)
132-
wget https://github.com/Cod-e-Codes/marchat/releases/download/v0.10.0-beta.1/marchat-v0.10.0-beta.1-linux-amd64.zip
133-
unzip marchat-v0.10.0-beta.1-linux-amd64.zip && chmod +x marchat-*
140+
wget https://github.com/Cod-e-Codes/marchat/releases/download/v0.10.0-beta.2/marchat-v0.10.0-beta.2-linux-amd64.zip
141+
unzip marchat-v0.10.0-beta.2-linux-amd64.zip && chmod +x marchat-*
134142

135143
# macOS (amd64)
136-
wget https://github.com/Cod-e-Codes/marchat/releases/download/v0.10.0-beta.1/marchat-v0.10.0-beta.1-darwin-amd64.zip
137-
unzip marchat-v0.10.0-beta.1-darwin-amd64.zip && chmod +x marchat-*
144+
wget https://github.com/Cod-e-Codes/marchat/releases/download/v0.10.0-beta.2/marchat-v0.10.0-beta.2-darwin-amd64.zip
145+
unzip marchat-v0.10.0-beta.2-darwin-amd64.zip && chmod +x marchat-*
138146

139147
# Windows - PowerShell
140148
iwr -useb https://raw.githubusercontent.com/Cod-e-Codes/marchat/main/install.ps1 | iex
141149
```
142150

143151
**Docker:**
144152
```bash
145-
docker pull codecodesxyz/marchat:v0.10.0-beta.1
153+
docker pull codecodesxyz/marchat:v0.10.0-beta.2
146154
docker run -d -p 8080:8080 \
147155
-e MARCHAT_ADMIN_KEY=$(openssl rand -hex 32) \
148156
-e MARCHAT_USERS=admin1,admin2 \
149-
codecodesxyz/marchat:v0.10.0-beta.1
157+
codecodesxyz/marchat:v0.10.0-beta.2
150158
```
151159

152160
**Docker Compose (local development):**
161+
162+
The sample `docker-compose.yml` only sets port and database path. You must still provide **`MARCHAT_ADMIN_KEY`** and **`MARCHAT_USERS`** (see [Essential Environment Variables](#essential-environment-variables)). Typical approach: add the two lines below under `server.environment` and keep values in a gitignored `.env` file next to the compose file (Compose substitutes `${VAR}` from that `.env` automatically):
163+
164+
```yaml
165+
- MARCHAT_ADMIN_KEY=${MARCHAT_ADMIN_KEY}
166+
- MARCHAT_USERS=${MARCHAT_USERS}
167+
```
168+
169+
Example `.env` (generate a strong key for anything reachable from a network):
170+
171+
```bash
172+
MARCHAT_ADMIN_KEY=your-secret-here
173+
MARCHAT_USERS=admin1,admin2
174+
```
175+
176+
Then:
177+
153178
```bash
154179
docker compose up -d
155180
```

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Supported Versions
44

5-
`marchat` is currently at **v0.10.0-beta.1**.
5+
`marchat` is currently at **v0.10.0-beta.2**.
66
All security updates and fixes are applied to the `main` branch.
77

88
| Version | Supported |

build-release.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Build script for marchat v0.10.0-beta.1
1+
# Build script for marchat v0.10.0-beta.2
22
# This script builds all platform targets and creates release zips
33

44
$ErrorActionPreference = "Stop"
55

6-
$VERSION = "v0.10.0-beta.1"
6+
$VERSION = "v0.10.0-beta.2"
77
$BUILD_DIR = "build"
88
$RELEASE_DIR = "release"
99

docker-compose.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
services:
2-
server:
3-
build: .
4-
ports:
5-
- "8080:8080"
6-
environment:
7-
- MARCHAT_PORT=8080
8-
- MARCHAT_DB_PATH=/data/marchat.db
9-
volumes:
10-
- marchat-data:/data
11-
12-
volumes:
13-
marchat-data:
1+
services:
2+
server:
3+
build: .
4+
ports:
5+
- "8080:8080"
6+
environment:
7+
- MARCHAT_PORT=8080
8+
- MARCHAT_DB_PATH=/data/marchat.db
9+
volumes:
10+
- marchat-data:/data
11+
12+
volumes:
13+
marchat-data:

entrypoint.sh

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
#!/bin/sh
22
set -e
33

4-
# Ensure base server directory exists
5-
mkdir -p /marchat/server
4+
# When running as root (default), fix ownership of app dirs and common volume
5+
# mount points so the marchat user can write SQLite and config, then drop privileges.
6+
if [ "$(id -u)" = 0 ]; then
7+
mkdir -p /marchat/server /marchat/server/config /marchat/server/db \
8+
/marchat/server/data /marchat/server/plugins /data
9+
chown -R marchat:marchat /marchat /data 2>/dev/null || true
10+
exec su-exec marchat "$0" "$@"
11+
fi
612

7-
# Ensure config directory exists inside server directory
13+
mkdir -p /marchat/server
814
mkdir -p /marchat/server/config
9-
10-
# Ensure db directory exists inside server directory
1115
mkdir -p /marchat/server/db
12-
13-
# Ensure data directory exists inside server directory
1416
mkdir -p /marchat/server/data
15-
16-
# Ensure plugins directory exists inside server directory
1717
mkdir -p /marchat/server/plugins
1818

19-
# Fix ownership if we have write access
20-
if [ -w "/marchat/server" ]; then
21-
chown -R marchat:marchat /marchat/server 2>/dev/null || true
22-
fi
23-
24-
# Execute the main application
2519
exec ./marchat-server "$@"

install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Supports Windows, Linux, macOS, and Android (via PowerShell Core)
55

66
param(
7-
[string]$Version = "v0.10.0-beta.1"
7+
[string]$Version = "v0.10.0-beta.2"
88
)
99

1010
$ErrorActionPreference = "Stop"

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
set -e # Exit on any error
77

8-
VERSION="v0.10.0-beta.1"
8+
VERSION="v0.10.0-beta.2"
99

1010
# Detect OS and architecture
1111
OS=$(uname | tr '[:upper:]' '[:lower:]')

0 commit comments

Comments
 (0)