tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 96 forks source link

[FEATURE] docker-compose examples and documentation #406

Closed l8gravely closed 1 year ago

l8gravely commented 1 year ago

I've been trying to setup kimai2 using the sample docker-compose.yml file, but I'm missing some steps because I can't seem to login. It would be nice to have some steps documented in the actual docker-compose.yml file for a first time user on what to change. And how to maybe blow things away if you get into a total mess.

I'd really like to self host this as a test, so having the pointers on what I need to change to make it accessible by more than localhost users would be awesome.

Describe the solution you'd like Some more pointers in the docker-compose.yml file on what needs to change for your own setup.

Describe alternatives you've considered I'm new to docker and such, so i was hoping to use the docker-compose method to make things simpler.

Additional context Add any other context or screenshots about the feature request here.

tobybatch commented 1 year ago

Can you outline what you have tried and what error you got?

I just ran

docker-compose up

And logged in using the superadmin and changemeplease.

If you like to raise a PR to add a quick start page with more detailed instructions, then I'd be happy to review and add it. Else it'll go on the end on my (very long) todo list. That probably wants to be docs/quick-start.md or something like that.

Thanks for trying Kimai, and sorry it was a bit difficult for you.

l8gravely commented 1 year ago

"Toby" == Toby Batch @.***> writes:

Can you outline what you have tried and what error you got? I just ran

docker-compose up

And logged in using the superadmin and changemeplease.

I had tried to edit the docker-compose.yml file ahead of time to replace the 'changemeplease' password with something more secure.

But what I now see was probably my error was the 'superadmin' username.

But I also think it would be good to note in the docker-compose.yml file more of these assumptions. Or expand the README.md to mention.

Hmm....

Looking at it more, I just pulled down the docker-compose.yml, and without making any changes did:

docker-compose up

and now I'm seeing the following messages in the log:

kimai_1 | [OK] Kimai config was reloaded kimai_1 | kimai_1 | [22-Sep-2022 17:06:08] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root kimai_1 | [22-Sep-2022 17:06:08] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root kimai_1 | [22-Sep-2022 17:06:08] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root kimai_1 | [22-Sep-2022 17:06:08] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root kimai_1 | [22-Sep-2022 17:06:08] NOTICE: fpm is running, pid 1 kimai_1 | [22-Sep-2022 17:06:08] NOTICE: ready to handle connections nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:06:08 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-"

sqldb_1 | 2022-09-22T15:06:27.596924Z 11 [Note] Access denied for user 'root'@'localhost' (using password: YES) kimai_1 | 127.0.0.1 - 22/Sep/2022:17:06:28 +0200 "GET /ping" 404 nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:06:28 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-" sqldb_1 | 2022-09-22T15:06:47.687324Z 12 [Note] Access denied for user 'root'@'localhost' (using password: YES) kimai_1 | 127.0.0.1 - 22/Sep/2022:17:06:48 +0200 "GET /ping" 404 nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:06:48 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-" sqldb_1 | 2022-09-22T15:07:07.789903Z 13 [Note] Access denied for user 'root'@'localhost' (using password: YES) kimai_1 | 127.0.0.1 - 22/Sep/2022:17:07:08 +0200 "GET /ping" 404 nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:07:08 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-" sqldb_1 | 2022-09-22T15:07:27.893474Z 14 [Note] Access denied for user 'root'@'localhost' (using password: YES) kimai_1 | 127.0.0.1 - 22/Sep/2022:17:07:28 +0200 "GET /ping" 404 nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:07:28 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-" sqldb_1 | 2022-09-22T15:07:47.981287Z 15 [Note] Access denied for user 'root'@'localhost' (using password: YES) kimai_1 | 127.0.0.1 - 22/Sep/2022:17:07:48 +0200 "GET /ping" 404 nginx_1 | 172.25.0.5 - - [22/Sep/2022:15:07:48 +0000] "GET /health HTTP/1.1" 200 5 "-" "Wget" "-"

So it looks like it's not able to connect. So just to make sure, I did:

docker-compose down --rmi all

to make sure I had a perfectly clean setup. Then I re-did the 'docker-compose up' and I still got the same error about root access.

So then I removed the '/var/lib/docker/volumes/*' and it bombs again, probably because I nuked too much... or not in the proper way since I'm a docker noob.

Also, the links on https://tobybatch.github.io/kimai2/examples.html are broken as well.

If you like to raise a PR to add a quick start page with more detailed instructions, then I'd be happy to review and add it. Else it'll go on the end on my (very long) todo list. That probably wants to be docs/quick-start.md or something like that.

Ok, I'll give that a shot and get you something soon.

Thanks for trying Kimai, and sorry it was a bit difficult for you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.*Message ID: <tobybatch/kimai2/issues/406/ @.***>

tobybatch commented 1 year ago

Your error message shows that the DB set in the docker compose is not correct.

I just ran this. >>> Is snipped content

tobias@tobias-XPS-15-9570:~/tmp$ mkdir xxx
tobias@tobias-XPS-15-9570:~/tmp$ cd xxx
tobias@tobias-XPS-15-9570:~/tmp/xxx$ wget https://raw.githubusercontent.com/tobybatch/kimai2/main/docker-compose.yml
--2022-09-22 17:25:33--  https://raw.githubusercontent.com/tobybatch/kimai2/main/docker-compose.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1511 (1.5K) [text/plain]
Saving to: ‘docker-compose.yml’

docker-compose.yml      100%[==============================>]   1.48K  --.-KB/s    in 0s      

2022-09-22 17:25:33 (10.8 MB/s) - ‘docker-compose.yml’ saved [1511/1511]

tobias@tobias-XPS-15-9570:~/tmp/xxx$ docker-compose up
Creating network "xxx_default" with the default driver
Creating volume "xxx_var" with default driver
Creating volume "xxx_public" with default driver
Creating volume "xxx_mysql" with default driver
Creating xxx_postfix_1 ... done
Creating xxx_kimai_1   ... done
Creating xxx_sqldb_1   ... done
Creating xxx_nginx_1   ... done
Attaching to xxx_postfix_1, xxx_sqldb_1, xxx_kimai_1, xxx_nginx_1
kimai_1    | 
kimai_1    | Wait for MySQL DB connection ...
kimai_1    | Testing DB:** new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);*SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
postfix_1  | find: '/etc/postfix/certs': No such file or directory

>>> POSTFIX AND DB SETUP, Kimai checks if the DB is ready, then waits for a bit

kimai_1    | Testing DB:** new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);*SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
postfix_1  | 2022-09-22 16:25:48,753 INFO success: postfix entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

>>> MORE DB SETUP, Kimai checks again to see if the DB is ready

sqldb_1    | 2022-09-22 16:25:51+00:00 [Note] [Entrypoint]: Temporary server started.
kimai_1    | Testing DB:** new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);*SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
sqldb_1    | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. 

>>> MORE DB SETUP, Kimai checks again to see if the DB is ready

sqldb_1    | 2022-09-22 16:25:54+00:00 [Note] [Entrypoint]: Giving user kimaiuser access to schema kimai
kimai_1    | Testing DB:** new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);*SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
sqldb_1    | 

>>> MORE DB SETUP, the next message show the DB is ready for connections

sqldb_1    | 2022-09-22T16:25:56.776807Z 0 [Note] mysqld: ready for connections.
sqldb_1    | Version: '5.7.37'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

>>> KIMAI CHECK AGAIN, Kimai checks again to see if the DB is ready, and it is

kimai_1    | Testing DB:** new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);*Connection established
kimai_1    | 
kimai_1    | Kimai installation running ...
kimai_1    | ==============================
kimai_1    | 
kimai_1    | Database `kimai` for connection named default already exists. Skipped.

>>> NORMAL STARTUP PROCEEDS
l8gravely commented 1 year ago

"Toby" == Toby Batch @.***> writes:

Your error message shows that the DB set in the docker compose is not correct. I just ran this. >>> Is snipped content

Thanks for your help. I blew it all away and re-installed and it's going. I'm still going to ask that there be more documentation and tips/tricks on getting this going.

I do appreciate your work.

Also, should the postscript install be updated to be able to point to an upstream SMTP server, since I don't want to bother having to setup a full postscript system here. I looked at the docs of the source postfix image, but they're pretty limited.

Thanks, John

@.:~/tmp$ mkdir xxx @.:~/tmp$ cd xxx @.***:~/tmp/xxx$ wget https://raw.githubusercontent.com/tobybatch/kimai2/main/docker-compose.yml --2022-09-22 17:25:33-- https://raw.githubusercontent.com/tobybatch/kimai2/main/docker-compose.yml Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.109.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1511 (1.5K) [text/plain] Saving to: ‘docker-compose.yml’

docker-compose.yml 100%[==============================>] 1.48K --.-KB/s in 0s

2022-09-22 17:25:33 (10.8 MB/s) - ‘docker-compose.yml’ saved [1511/1511]

@.:~/tmp/xxx$ docker-compose up Creating network "xxx_default" with the default driver Creating volume "xxx_var" with default driver Creating volume "xxx_public" with default driver Creating volume "xxx_mysql" with default driver Creating xxx_postfix_1 ... done Creating xxx_kimai_1 ... done Creating xxx_sqldb_1 ... done Creating xxx_nginx_1 ... done Attaching to xxx_postfix_1, xxx_sqldb_1, xxx_kimai_1, xxx_nginx_1 kimai_1 | kimai_1 | Wait for MySQL DB connection ... kimai_1 | Testing DB: new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10 postfix_1 | find: '/etc/postfix/certs': No such file or directory

POSTFIX AND DB SETUP, Kimai checks if the DB is ready, then waits for a bit

kimai_1 | Testing DB:* new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10 postfix_1 | 2022-09-22 16:25:48,753 INFO success: postfix entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

MORE DB SETUP, Kimai checks again to see if the DB is ready

sqldb_1 | 2022-09-22 16:25:51+00:00 [Note] [Entrypoint]: Temporary server started. kimai_1 | Testing DB:* new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10 sqldb_1 | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone.

MORE DB SETUP, Kimai checks again to see if the DB is ready

sqldb_1 | 2022-09-22 16:25:54+00:00 [Note] [Entrypoint]: Giving user kimaiuser access to schema kimai kimai_1 | Testing DB:* new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10 sqldb_1 |

MORE DB SETUP, the next message show the DB is ready for connections

sqldb_1 | 2022-09-22T16:25:56.776807Z 0 [Note] mysqld: ready for connections. sqldb_1 | Version: '5.7.37' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)

KIMAI CHECK AGAIN, Kimai checks again to see if the DB is ready, and it is

kimai_1 | Testing DB:* new \PDO(mysql:host=sqldb;dbname=kimai;port=3306, kimaiuser, kimaipassword, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);Connection established kimai_1 | kimai_1 | Kimai installation running ... kimai_1 | ============================== kimai_1 | kimai_1 | Database kimai for connection named default already exists. Skipped.

NORMAL STARTUP PROCEEDS

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.*Message ID: <tobybatch/kimai2/issues/406/ @.***>

tobybatch commented 1 year ago

The postfix service is used to send password resets and stuff like that if you wanted to use an upstream SMTP server you can just override the mail server config by mounting your own local.yml and override it,

https://www.kimai.org/documentation/emails.html

I'll add a review of the docs to my to do list but I'm just a volunteer and don't as much time as I'd like to keep this repo running. I have a day job too.