Setting up Kimai

I want to set up kimai on my server. There is services.kimai and it works fine, however I am unsure how to create a user and/or log in. If I check the DB it is created but contains no users. Once installed I can see bunch of files:

-rw------- 1 kimai nginx  20 Oct 20 08:29 .app_secret
drwxr-xr-x 1 kimai nginx   8 Oct 20 12:14 cache
-rw------- 1 kimai nginx 242 Oct 20 12:13 .env
drwxr-xr-x 1 kimai nginx  16 Oct 20 09:11 log

So my instinct was to add
ADMINMAIL and ADMINPASS as seen in the documentation for the docker:
Docker – Kimai That does not work. No user is created. If I add it to the .env it gets removed.

There is a commands section in the documentation as well, but I have no idea how to run it properly. I can see that I can run it like this:

$(nix-build '<nixpkgs>' -A kimai --no-out-link)/bin/console kimai:user:create but this tries to write to nix store (and does not have the correct env. It gives me:

[1] 1071700
Please enter the password: 
13:03:35 WARNING   [cache] Failed to save key "709ebab940de604ddeb0524bc71b94b7" of type Doctrine\ORM\Query\ParserResult: fopen(/nix/store/a7fkg8lniib0drx4l9mgjyh32adv5l7s-kimai-2.40.0/share/php/kimai/var/cache/prod/pools/system/tOg2GcLAzs/PEjWuPeW): Failed to open stream: Read-only file system ["key" => "709ebab940de604ddeb0524bc71b94b7","exception" => ErrorException { …},"cache-adapter" => "Symfony\Component\Cache\Adapter\PhpFilesAdapter"] ["channel" => "cache"]

In StreamHandler.php line 156:
                                                                                                                                                                                                   
  The stream or file "/nix/store/a7fkg8lniib0drx4l9mgjyh32adv5l7s-kimai-2.40.0/share/php/kimai/var/log/prod.log" could not be opened in append mode: Failed to open stream: Read-only file system  
  The exception occurred while attempting to log: Lock acquired, now computing item "configurations"                                                                                               
  Context: {"key":"configurations"}                                                                                                                                                                
  Extra: {"channel":"cache"}                                                                                                                                                                       
                                                                                                                                                                                                   

kimai:user:create [--request-password] [--] <username> <email> [<role> [<password>]]

[1]+  Done                       DATABASE_URL=mysql://kimai@localhost:3306/kimai?charset=utf8mb4

I think I managed to solve it… The correct command to run is not the one earlier but this one:

sudo -u kimai /nix/store/<hash>-kimai-<yoursite>-2.40.0/bin/console  kimai:user:create -- admin admin@kimai.com ROLE_SUPER_ADMIN
1 Like