kreteshq / kretes

A Programming Environment for TypeScript & Deno
https://kretes.dev/
Other
676 stars 35 forks source link

Postgres config generates config that it later cannot handle on Ubuntu #107

Closed michaelKurowski closed 4 years ago

michaelKurowski commented 4 years ago

Kretes CLI: 0.71.0 OS: Ubuntu 18.04.4 LTS

Problem: kretes start ceased to work out of the sudden. After debugging it came out that nix-shell --run 'pg_ctl restart' that's being run underneath fails. Running the command manually outputs:

mkurowsk:~/OSS/kretes-example-app/kretes_demo$ nix-shell --run 'pg_ctl restart'
pg_ctl: old server process (PID: 30974) seems to be gone
starting server anyway
waiting for server to start....2020-10-16 13:36:13.569 CEST [27995] LOG:  invalid value for parameter "lc_messages": "en_US.UTF-8"
2020-10-16 13:36:13.569 CEST [27995] LOG:  invalid value for parameter "lc_monetary": "en_US.UTF-8"
2020-10-16 13:36:13.569 CEST [27995] LOG:  invalid value for parameter "lc_numeric": "en_US.UTF-8"
2020-10-16 13:36:13.569 CEST [27995] LOG:  invalid value for parameter "lc_time": "en_US.UTF-8"
2020-10-16 13:36:13.569 CEST [27995] FATAL:  configuration file "/home/mkurowski/OSS/kretes-example-app/kretes_demo/./db/content/postgresql.conf" contains errors
 stopped waiting
pg_ctl: could not start server
Examine the log output.

Above variables are being generated by kretes CLI, and written to kretes_demo/db/content/postgresql.conf, which is later being read by postgress.

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'en_US.UTF-8'         # locale for system error message
                    # strings
lc_monetary = 'en_US.UTF-8'         # locale for monetary formatting
lc_numeric = 'en_US.UTF-8'          # locale for number formatting
lc_time = 'en_US.UTF-8'             # locale for time formatting

# default configuration for text search
default_text_search_config = 'pg_catalog.english'

Expected behavior: Kretes CLI, should generate config that doesn't crash the application later on.

Note: Removing lines setting the env variables from the config lets the database start, but makes kretes unable to connect it later on:

mkurowski@mkurowski-Latitude-5480:~/OSS/kretes-example-app/kretes_demo$ kretes start
  Starting... (it may take few seconds)
2020-10-16 13:50:58.800 CEST [29580] LOG:  received fast shutdown request
2020-10-16 13:50:58.805 CEST [29580] LOG:  aborting any active transactions
2020-10-16 13:50:58.805 CEST [29580] LOG:  background worker "logical replication launcher" (PID 29588) exited with exit code 1
2020-10-16 13:50:58.806 CEST [29583] LOG:  shutting down
2020-10-16 13:50:58.846 CEST [29580] LOG:  database system is shut down
error code:  0
┌ Kretes 0.71.0 on localhost:5544
└ Started: 1:51:08 PM
  Error database locale is incompatible with operating system
  Explanation 
  (missing)

  Stack trace
  - Parser.parseErrorMessage
    /home/mkurowski/.nvm/versions/node/v12.19.0/lib/node_modules/kretes/node_modules/pg-protocol/dist/parser.js:278
  - Parser.handlePacket
    /home/mkurowski/.nvm/versions/node/v12.19.0/lib/node_modules/kretes/node_modules/pg-protocol/dist/parser.js:126
  - Parser.parse
    /home/mkurowski/.nvm/versions/node/v12.19.0/lib/node_modules/kretes/node_modules/pg-protocol/dist/parser.js:39
  - Socket.<anonymous>
    /home/mkurowski/.nvm/versions/node/v12.19.0/lib/node_modules/kretes/node_modules/pg-protocol/dist/index.js:10
  - Socket.emit
    events.js:314
  - addChunk
    _stream_readable.js:298
  - readableAddChunk
    _stream_readable.js:273
  - Socket.Readable.push
    _stream_readable.js:214
  - TCP.onStreamRead
    internal/stream_base_commons.js:188
zaiste commented 4 years ago

@michaelKurowski would you mind updating to 0.72.3 ? Some of those things were handled in between of these versions.

zaiste commented 4 years ago

@michaelKurowski This should be resolved. Please reopen if the errors persists on your side