Skip to content

Commit 053f6d8

Browse files
JohnMcLearclaude
andauthored
fix(#7570): bundle DB drivers, add regression CI (#7572)
* docs: design spec for issue #7570 (ueberdb2 driver bundling) Spec for the upstream ueberDB fix (move 10 drivers back from optional peer deps to dependencies) plus downstream etherpad-lite safety net (explicit driver list + build-test-db-drivers CI job covering all 10 via presence check and MySQL+Postgres smoke tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: implementation plan for issue #7570 ueberdb2 driver bundling Covers upstream ueberDB PR (move drivers from optional peer deps back to dependencies, publish 5.0.46) and downstream etherpad-lite PR (bump ueberdb2, defensive driver list, build-test-db-drivers CI job with presence + MySQL + Postgres stages gating publish). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#7570): bundle DB drivers, add regression CI - Bump ueberdb2 to ^5.0.47 (upstream ueberDB PR #939 re-bundles drivers as real dependencies instead of optional peer deps, fixing the class of Docker-prod "Cannot find module" failures). - Declare all 10 ueberdb2 DB drivers as direct src dependencies as a defensive safety net against a future upstream drift. - Add build-test-db-drivers CI job that blocks the publish job: * all-10-drivers presence check in the built prod image * end-to-end MySQL smoke (reproduces the #7570 repro) * end-to-end Postgres smoke Any stage failure blocks Docker Hub / GHCR publish. Supersedes #7571. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ci): run driver presence test from src/ so node_modules resolves The presence test ran node from the default cwd (/opt/etherpad-lite), but the drivers are installed under /opt/etherpad-lite/src/node_modules by the monorepo workspace. Adding `-w /opt/etherpad-lite/src` makes Node resolve modules from src/node_modules where pnpm places them. Matches how the production container itself runs: `pnpm run prod` is invoked from src/ (cross-env + node --require tsx/cjs node/server.ts). --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f553cdf commit 053f6d8

File tree

5 files changed

+2392
-11
lines changed

5 files changed

+2392
-11
lines changed

.github/workflows/docker.yml

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,130 @@ jobs:
7777
(cd src && gnpm run test-container)
7878
git clean -dxf .
7979
80+
build-test-db-drivers:
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: read
84+
services:
85+
mysql:
86+
image: mysql:8
87+
env:
88+
MYSQL_ROOT_PASSWORD: password
89+
MYSQL_DATABASE: etherpad
90+
MYSQL_USER: etherpad
91+
MYSQL_PASSWORD: password
92+
ports:
93+
- 3306:3306
94+
options: >-
95+
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -ppassword"
96+
--health-interval=5s
97+
--health-timeout=5s
98+
--health-retries=20
99+
postgres:
100+
image: postgres:16
101+
env:
102+
POSTGRES_DB: etherpad
103+
POSTGRES_USER: etherpad
104+
POSTGRES_PASSWORD: password
105+
ports:
106+
- 5432:5432
107+
options: >-
108+
--health-cmd="pg_isready -U etherpad -d etherpad"
109+
--health-interval=5s
110+
--health-timeout=5s
111+
--health-retries=20
112+
steps:
113+
-
114+
name: Check out
115+
uses: actions/checkout@v6
116+
with:
117+
path: etherpad
118+
-
119+
name: Set up Docker Buildx
120+
uses: docker/setup-buildx-action@v4
121+
-
122+
name: Build production image
123+
uses: docker/build-push-action@v7
124+
with:
125+
context: ./etherpad
126+
target: production
127+
load: true
128+
tags: ${{ env.TEST_TAG }}
129+
cache-from: type=gha
130+
cache-to: type=gha,mode=max
131+
-
132+
name: Driver presence test (all 10 ueberdb2 drivers must resolve)
133+
run: |
134+
docker run --rm -w /opt/etherpad-lite/src "$TEST_TAG" node -e "
135+
const mods = [
136+
'@elastic/elasticsearch','cassandra-driver','mongodb','mssql',
137+
'mysql2','nano','pg','redis','rethinkdb','surrealdb'
138+
];
139+
let fail = false;
140+
for (const m of mods) {
141+
try { require(m); console.log('ok', m); }
142+
catch (e) { console.error('MISSING', m, e.message); fail = true; }
143+
}
144+
if (fail) process.exit(1);
145+
"
146+
-
147+
name: MySQL smoke — start Etherpad against mysql service
148+
run: |
149+
docker run --rm -d \
150+
--network host \
151+
-e NODE_ENV=production \
152+
-e ADMIN_PASSWORD=admin \
153+
-e DB_TYPE=mysql \
154+
-e DB_HOST=127.0.0.1 \
155+
-e DB_PORT=3306 \
156+
-e DB_NAME=etherpad \
157+
-e DB_USER=etherpad \
158+
-e DB_PASS=password \
159+
-e DB_CHARSET=utf8mb4 \
160+
-e DEFAULT_PAD_TEXT="Test " \
161+
--name et-mysql "$TEST_TAG"
162+
for i in $(seq 1 60); do
163+
if curl -sf http://127.0.0.1:9001/ >/dev/null; then
164+
echo "mysql smoke: Etherpad is serving /"
165+
docker rm -f et-mysql
166+
exit 0
167+
fi
168+
sleep 2
169+
done
170+
echo "mysql smoke: timed out waiting for Etherpad"
171+
docker logs et-mysql || true
172+
docker rm -f et-mysql || true
173+
exit 1
174+
-
175+
name: Postgres smoke — start Etherpad against postgres service
176+
run: |
177+
docker run --rm -d \
178+
--network host \
179+
-e NODE_ENV=production \
180+
-e ADMIN_PASSWORD=admin \
181+
-e DB_TYPE=postgres \
182+
-e DB_HOST=127.0.0.1 \
183+
-e DB_PORT=5432 \
184+
-e DB_NAME=etherpad \
185+
-e DB_USER=etherpad \
186+
-e DB_PASS=password \
187+
-e DEFAULT_PAD_TEXT="Test " \
188+
--name et-postgres "$TEST_TAG"
189+
for i in $(seq 1 60); do
190+
if curl -sf http://127.0.0.1:9001/ >/dev/null; then
191+
echo "postgres smoke: Etherpad is serving /"
192+
docker rm -f et-postgres
193+
exit 0
194+
fi
195+
sleep 2
196+
done
197+
echo "postgres smoke: timed out waiting for Etherpad"
198+
docker logs et-postgres || true
199+
docker rm -f et-postgres || true
200+
exit 1
201+
80202
publish:
81-
needs: build-test
203+
needs: [build-test, build-test-db-drivers]
82204
if: github.event_name == 'push'
83205
runs-on: ubuntu-latest
84206
permissions:

0 commit comments

Comments
 (0)