kreteshq / kretes

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

Unable to start project on Ubuntu with CLI 0.71.0 #105

Closed michaelKurowski closed 4 years ago

michaelKurowski commented 4 years ago

OS: The issue has been reproduced in 2 environments:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

Kretes version: 0.71.0

I and my teammate were unable to create a project using CLI.

Reproduction:

  1. During creating new project:

    initdb: error: invalid locale settings; check LANG and LC_* environment variables
    Error: exit code 1

    The error can be then fixed by setting up all LC_ variables, but they have to be set. Expected behaviour: Kretes shouldn't assume these variables are filled, since problem occured on 2 separate Ubuntu instances.

  2. After setting the env variables the user gets another problem:

    Kretes 0.71.0
       new creating a project in kretes_demo
    bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    /nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    initdb: error: invalid locale settings; check LANG and LC_* environment variables
    Error: exit code 1

    After research, we've managed to fix the issue with below fix: nix-shell -E 'with import <nixpkgs> { }; runCommand "dummy" { LOCALE_ARCHIVE_2_27 = "${glibcLocales}/lib/locale/locale-archive"; buildInputs = [ hello ]; } ""' Expected behaviour: Nix "container" should be prepared by Kretes to handle this.

  3. The kretes start task was then failing with exit code 1 and no further information. Expected behaviour: The script from point 4. should output what command failed and error as well.

  4. We've had to add console.log in /home/username/.nvm/versions/node/v10.15.3/lib/node_modules/kretes/dist/util.js:113 because the installation script just throws message that process exited, but doesn't even inform, what command failed.

  5. We were unable to run postgres then:

Michael Kurowski 12:52 PM [nix-shell:~/OSS/kretes-example-app/kretes_demo]$ nix-shell --run 'pg_ctl start' waiting for server to start....2020-10-08 12:52:13.309 CEST [16715] LOG: starting PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 9.3.0, 64-bit 2020-10-08 12:52:13.310 CEST [16715] LOG: listening on IPv4 address "127.0.0.1", port 5454 2020-10-08 12:52:13.311 CEST [16715] FATAL: could not create lock file "/run/postgresql/.s.PGSQL.5454.lock": No such file or directory 2020-10-08 12:52:13.311 CEST [16715] LOG: database system is shut down stopped waiting pg_ctl: could not start server Examine the log output.


Which we've managed to fix by changing `/run/postgresql/` permissions, note - we haven't had postgres installed previously, we've followed instruction from kretes, so the permissions to the directory have been set as a consequence of installation procedure listen in kretes documentation.
Expected behaviour: Kretes should communicate better to the user what should be done with this file.

6. Postgress was able to start, but app was unable to recognize it, as by default the config states `kretes_demo` as postgressql's name, while the db starts as `postgres` by default
Expected behaviour: Default config should work OOTB.

7. Only then we were able to start the project.
zaiste commented 4 years ago

@michaelKurowski thanks for these precise remarks!

1 - it's fixed in 0.72.1. This should also fix 2. I need more time to verify this.

In 5 it seems you are running a Nix shell inside an existing shell. Could you just type pg_ctl start ?

zaiste commented 4 years ago

@michaelKurowski version 0.72.3 should resolve all the issues you mentioned. Let me know if that's not the case.

michaelKurowski commented 4 years ago

In 5 it seems you are running a Nix shell inside an existing shell. Could you just type pg_ctl start ?

I believe I weren't, I were running it from my base, OS shell, not within nix shell. @zaiste, I did it as kretes start was failing, but without any output as to why the command was failing, and after debugging it came out it was failing on this command, so I've ran it in my terminal to check the output as Kretes CLI was hiding the error log from the command it ran.