mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
Fix embedded Postgres initdb failure in Docker slim containers
The embedded-postgres library hardcodes --lc-messages=en_US.UTF-8 and strips the parent process environment when spawning initdb/postgres. In slim Docker images (e.g. node:20-bookworm-slim), the en_US.UTF-8 locale isn't installed, causing initdb to exit with code 1. Two fixes applied: 1. Add --lc-messages=C to all initdbFlags arrays (overrides the library's hardcoded locale since our flags come after in the spread) 2. pnpm patch on embedded-postgres to preserve process.env in spawn calls, preventing loss of PATH, LD_LIBRARY_PATH, and other vars Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
59e29afab5
commit
5602576ae1
11 changed files with 38 additions and 11 deletions
22
patches/embedded-postgres@18.1.0-beta.16.patch
Normal file
22
patches/embedded-postgres@18.1.0-beta.16.patch
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/dist/index.js b/dist/index.js
|
||||
index ccfe17a82f4879bf20cc345c579a987d9eba5309..dd689f5908f625f49b4785318daea736aa88927f 100644
|
||||
--- a/dist/index.js
|
||||
+++ b/dist/index.js
|
||||
@@ -133,7 +133,7 @@ class EmbeddedPostgres {
|
||||
`--pwfile=${passwordFile}`,
|
||||
`--lc-messages=${LC_MESSAGES_LOCALE}`,
|
||||
...this.options.initdbFlags,
|
||||
- ], Object.assign(Object.assign({}, permissionIds), { env: { LC_MESSAGES: LC_MESSAGES_LOCALE } }));
|
||||
+ ], Object.assign(Object.assign({}, permissionIds), { env: Object.assign(Object.assign({}, process.env), { LC_MESSAGES: LC_MESSAGES_LOCALE }) }));
|
||||
// Connect to stderr, as that is where the messages get sent
|
||||
(_a = process.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (chunk) => {
|
||||
// Parse the data as a string and log it
|
||||
@@ -177,7 +177,7 @@ class EmbeddedPostgres {
|
||||
'-p',
|
||||
this.options.port.toString(),
|
||||
...this.options.postgresFlags,
|
||||
- ], Object.assign(Object.assign({}, permissionIds), { env: { LC_MESSAGES: LC_MESSAGES_LOCALE } }));
|
||||
+ ], Object.assign(Object.assign({}, permissionIds), { env: Object.assign(Object.assign({}, process.env), { LC_MESSAGES: LC_MESSAGES_LOCALE }) }));
|
||||
// Connect to stderr, as that is where the messages get sent
|
||||
(_a = this.process.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (chunk) => {
|
||||
// Parse the data as a string and log it
|
||||
Loading…
Add table
Add a link
Reference in a new issue