linuxserver / docker-kimai

GNU General Public License v3.0
9 stars 3 forks source link

[ERROR] Failed to create database: An exception occurred in the driver:nSQLSTATE[HY000] [2002] Connection refused #10

Closed jabertech closed 8 months ago

jabertech commented 8 months ago

Is there an existing issue for this?

Current Behavior

Facing this issue when deploying a stack using portainer (hosted on OCL)

This is the stack:

---
services:
  kimai:
    image: lscr.io/linuxserver/kimai:latest
    container_name: kimai
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DATABASE_URL=mysql://kimaiuser:kimaipassword@mariadb:3400/mariadb?charset=utf8&serverVersion=10.11.4-MariaDB-log
    volumes:
      - /volume1/docker/kimai/config:/config
    ports:
      - 8001:80
      - 4431:443
    restart: unless-stopped

# This container requires an external application to be run separately.
# MariaDB
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - MYSQL_ROOT_PASSWORD=HdVwMMRsekdm3QS83AZnZK6f
      - MYSQL_DATABASE=mariadb #optional
      - MYSQL_USER=kimaiuser #optional
      - MYSQL_PASSWORD=kimaipassword #optional
    volumes:
      - /var/lib/mysql:/mysql
    ports:
      - 3400:3306
    restart: unless-stopped

This is the error on kimai container:

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support the app dev(s) visit:
Kimai: https://www.kimai.org/donate/
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
Waiting for DB to be available
Kimai installation running ...
==============================

 [ERROR] Failed to create database: An exception occurred in the driver:        
         SQLSTATE[HY000] [2002] Connection refused                              

Kimai updates running ...
=========================

 [ERROR] Database connection could not be established.                          

         An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection 
         refused                                                                

s6-rc: warning: unable to start service init-kimai-config: command exited 1

This is mariadb logs:```

[migrations] no migrations found ─────────────────────────────────────── ██╗ ███████╗██╗ ██████╗ ██║ ██╔════╝██║██╔═══██╗ ██║ ███████╗██║██║ ██║ ██║ ╚════██║██║██║ ██║ ███████╗███████║██║╚██████╔╝ ╚══════╝╚══════╝╚═╝ ╚═════╝ Brought to you by linuxserver.io ─────────────────────────────────────── To support LSIO projects visit: https://www.linuxserver.io/donate/ ─────────────────────────────────────── GID/UID ─────────────────────────────────────── User UID: 1000 User GID: 1000 ─────────────────────────────────────── Setting Up Initial Databases chown: cannot access '/auth_pam_tool_dir/auth_pam_tool': No such file or directory Couldn't set an owner to '/auth_pam_tool_dir/auth_pam_tool'. It must be root, the PAM authentication plugin doesn't work otherwise.. chown: cannot access '/auth_pam_tool_dir': No such file or directory Cannot change ownership of the '/auth_pam_tool_dir' directory to the 'abc' user. Check that you have the necessary permissions and try again. Installing MariaDB/MySQL system tables in '/config/databases' ... 2024-01-16 12:29:48 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory") OK To start mariadbd at boot time you have to copy support-files/mariadb.service to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following command: '/usr/bin/mariadb-secure-installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at https://mariadb.com/kb You can start the MariaDB daemon with: cd '/usr' ; /usr/bin/mariadb-safe --datadir='/config/databases' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/mysql-test' ; perl mariadb-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ 2024-01-16 12:29:50 0 [Note] Starting MariaDB 10.11.5-MariaDB-log source revision 7875294b6b74b53dd3aaa723e6cc103d2bb47b2c as process 191 2024-01-16 12:29:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-01-16 12:29:50 0 [Note] InnoDB: Number of transaction pools: 1 2024-01-16 12:29:50 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions 2024-01-16 12:29:50 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) 2024-01-16 12:29:50 0 [Note] InnoDB: Using Linux native AIO 2024-01-16 12:29:50 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB 2024-01-16 12:29:50 0 [Note] InnoDB: Completed initialization of buffer pool 2024-01-16 12:29:50 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes) 2024-01-16 12:29:50 0 [Note] InnoDB: End of log at LSN=46572 2024-01-16 12:29:51 0 [Note] InnoDB: 128 rollback segments are active. 2024-01-16 12:29:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2024-01-16 12:29:51 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2024-01-16 12:29:51 0 [Note] InnoDB: log sequence number 46572; transaction id 14 2024-01-16 12:29:51 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-01-16 12:29:51 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool 2024-01-16 12:29:51 0 [Note] InnoDB: Buffer pool(s) load completed at 240116 12:29:51 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '::'. 2024-01-16 12:29:51 0 [Note] mariadbd: ready for connections. Version: '10.11.5-MariaDB-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Alpine Linux 2024-01-16 12:29:52 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown 2024-01-16 12:29:52 0 [Note] InnoDB: FTS optimize thread exiting. 2024-01-16 12:29:52 0 [Note] InnoDB: Starting shutdown... 2024-01-16 12:29:52 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool 2024-01-16 12:29:52 0 [Note] InnoDB: Buffer pool(s) dump completed at 240116 12:29:52 2024-01-16 12:29:53 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2024-01-16 12:29:53 0 [Note] InnoDB: Shutdown completed; log sequence number 46572; transaction id 16 2024-01-16 12:29:53 0 [Note] mariadbd: Shutdown complete Database Setup Completed [custom-init] No custom files found, skipping... 240116 12:29:54 mysqld_safe Logging to '/config/databases/c6a83f5f2fa4.err'. 240116 12:29:54 mysqld_safe Starting mariadbd daemon with databases from /config/databases [ls.io-init] done.


### Expected Behavior

Kimai should run correctly

### Steps To Reproduce

Please see all notes above

### Environment

```markdown
- OS:
- How docker service was installed: using portainer

CPU architecture

arm64

Docker creation

Facing this issue when deploying a stack using portainer (hosted on OCL)

**This is the stack:**

---
services:
  kimai:
    image: lscr.io/linuxserver/kimai:latest
    container_name: kimai
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DATABASE_URL=mysql://kimaiuser:kimaipassword@mariadb:3400/mariadb?charset=utf8&serverVersion=10.11.4-MariaDB-log
    volumes:
      - /volume1/docker/kimai/config:/config
    ports:
      - 8001:80
      - 4431:443
    restart: unless-stopped

# This container requires an external application to be run separately.
# MariaDB
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - MYSQL_ROOT_PASSWORD=HdVwMMRsekdm3QS83AZnZK6f
      - MYSQL_DATABASE=mariadb #optional
      - MYSQL_USER=kimaiuser #optional
      - MYSQL_PASSWORD=kimaipassword #optional
    volumes:
      - /var/lib/mysql:/mysql
    ports:
      - 3400:3306
    restart: unless-stopped

This is the error on kimai container:

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support the app dev(s) visit:
Kimai: https://www.kimai.org/donate/
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
Waiting for DB to be available
Kimai installation running ...
==============================

 [ERROR] Failed to create database: An exception occurred in the driver:        
         SQLSTATE[HY000] [2002] Connection refused                              

Kimai updates running ...
=========================

 [ERROR] Database connection could not be established.                          

         An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection 
         refused                                                                

s6-rc: warning: unable to start service init-kimai-config: command exited 1

This is mariadb logs:```

[migrations] no migrations found ─────────────────────────────────────── ██╗ ███████╗██╗ ██████╗ ██║ ██╔════╝██║██╔═══██╗ ██║ ███████╗██║██║ ██║ ██║ ╚════██║██║██║ ██║ ███████╗███████║██║╚██████╔╝ ╚══════╝╚══════╝╚═╝ ╚═════╝ Brought to you by linuxserver.io ─────────────────────────────────────── To support LSIO projects visit: https://www.linuxserver.io/donate/ ─────────────────────────────────────── GID/UID ─────────────────────────────────────── User UID: 1000 User GID: 1000 ─────────────────────────────────────── Setting Up Initial Databases chown: cannot access '/auth_pam_tool_dir/auth_pam_tool': No such file or directory Couldn't set an owner to '/auth_pam_tool_dir/auth_pam_tool'. It must be root, the PAM authentication plugin doesn't work otherwise.. chown: cannot access '/auth_pam_tool_dir': No such file or directory Cannot change ownership of the '/auth_pam_tool_dir' directory to the 'abc' user. Check that you have the necessary permissions and try again. Installing MariaDB/MySQL system tables in '/config/databases' ... 2024-01-16 12:29:48 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory") OK To start mariadbd at boot time you have to copy support-files/mariadb.service to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following command: '/usr/bin/mariadb-secure-installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at https://mariadb.com/kb You can start the MariaDB daemon with: cd '/usr' ; /usr/bin/mariadb-safe --datadir='/config/databases' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/mysql-test' ; perl mariadb-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ 2024-01-16 12:29:50 0 [Note] Starting MariaDB 10.11.5-MariaDB-log source revision 7875294b6b74b53dd3aaa723e6cc103d2bb47b2c as process 191 2024-01-16 12:29:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-01-16 12:29:50 0 [Note] InnoDB: Number of transaction pools: 1 2024-01-16 12:29:50 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions 2024-01-16 12:29:50 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) 2024-01-16 12:29:50 0 [Note] InnoDB: Using Linux native AIO 2024-01-16 12:29:50 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB 2024-01-16 12:29:50 0 [Note] InnoDB: Completed initialization of buffer pool 2024-01-16 12:29:50 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes) 2024-01-16 12:29:50 0 [Note] InnoDB: End of log at LSN=46572 2024-01-16 12:29:51 0 [Note] InnoDB: 128 rollback segments are active. 2024-01-16 12:29:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2024-01-16 12:29:51 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2024-01-16 12:29:51 0 [Note] InnoDB: log sequence number 46572; transaction id 14 2024-01-16 12:29:51 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-01-16 12:29:51 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool 2024-01-16 12:29:51 0 [Note] InnoDB: Buffer pool(s) load completed at 240116 12:29:51 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '::'. 2024-01-16 12:29:51 0 [Note] mariadbd: ready for connections. Version: '10.11.5-MariaDB-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Alpine Linux 2024-01-16 12:29:52 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown 2024-01-16 12:29:52 0 [Note] InnoDB: FTS optimize thread exiting. 2024-01-16 12:29:52 0 [Note] InnoDB: Starting shutdown... 2024-01-16 12:29:52 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool 2024-01-16 12:29:52 0 [Note] InnoDB: Buffer pool(s) dump completed at 240116 12:29:52 2024-01-16 12:29:53 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2024-01-16 12:29:53 0 [Note] InnoDB: Shutdown completed; log sequence number 46572; transaction id 16 2024-01-16 12:29:53 0 [Note] mariadbd: Shutdown complete Database Setup Completed [custom-init] No custom files found, skipping... 240116 12:29:54 mysqld_safe Logging to '/config/databases/c6a83f5f2fa4.err'. 240116 12:29:54 mysqld_safe Starting mariadbd daemon with databases from /config/databases [ls.io-init] done.

Container logs

Facing this issue when deploying a stack using portainer (hosted on OCL)

**This is the stack:**

---
services:
  kimai:
    image: lscr.io/linuxserver/kimai:latest
    container_name: kimai
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DATABASE_URL=mysql://kimaiuser:kimaipassword@mariadb:3400/mariadb?charset=utf8&serverVersion=10.11.4-MariaDB-log
    volumes:
      - /volume1/docker/kimai/config:/config
    ports:
      - 8001:80
      - 4431:443
    restart: unless-stopped

# This container requires an external application to be run separately.
# MariaDB
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - MYSQL_ROOT_PASSWORD=HdVwMMRsekdm3QS83AZnZK6f
      - MYSQL_DATABASE=mariadb #optional
      - MYSQL_USER=kimaiuser #optional
      - MYSQL_PASSWORD=kimaipassword #optional
    volumes:
      - /var/lib/mysql:/mysql
    ports:
      - 3400:3306
    restart: unless-stopped

This is the error on kimai container:

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support the app dev(s) visit:
Kimai: https://www.kimai.org/donate/
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
Waiting for DB to be available
Kimai installation running ...
==============================

 [ERROR] Failed to create database: An exception occurred in the driver:        
         SQLSTATE[HY000] [2002] Connection refused                              

Kimai updates running ...
=========================

 [ERROR] Database connection could not be established.                          

         An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection 
         refused                                                                

s6-rc: warning: unable to start service init-kimai-config: command exited 1

This is mariadb logs:```

[migrations] no migrations found ─────────────────────────────────────── ██╗ ███████╗██╗ ██████╗ ██║ ██╔════╝██║██╔═══██╗ ██║ ███████╗██║██║ ██║ ██║ ╚════██║██║██║ ██║ ███████╗███████║██║╚██████╔╝ ╚══════╝╚══════╝╚═╝ ╚═════╝ Brought to you by linuxserver.io ─────────────────────────────────────── To support LSIO projects visit: https://www.linuxserver.io/donate/ ─────────────────────────────────────── GID/UID ─────────────────────────────────────── User UID: 1000 User GID: 1000 ─────────────────────────────────────── Setting Up Initial Databases chown: cannot access '/auth_pam_tool_dir/auth_pam_tool': No such file or directory Couldn't set an owner to '/auth_pam_tool_dir/auth_pam_tool'. It must be root, the PAM authentication plugin doesn't work otherwise.. chown: cannot access '/auth_pam_tool_dir': No such file or directory Cannot change ownership of the '/auth_pam_tool_dir' directory to the 'abc' user. Check that you have the necessary permissions and try again. Installing MariaDB/MySQL system tables in '/config/databases' ... 2024-01-16 12:29:48 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory") OK To start mariadbd at boot time you have to copy support-files/mariadb.service to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following command: '/usr/bin/mariadb-secure-installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at https://mariadb.com/kb You can start the MariaDB daemon with: cd '/usr' ; /usr/bin/mariadb-safe --datadir='/config/databases' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/mysql-test' ; perl mariadb-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ 2024-01-16 12:29:50 0 [Note] Starting MariaDB 10.11.5-MariaDB-log source revision 7875294b6b74b53dd3aaa723e6cc103d2bb47b2c as process 191 2024-01-16 12:29:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2024-01-16 12:29:50 0 [Note] InnoDB: Number of transaction pools: 1 2024-01-16 12:29:50 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions 2024-01-16 12:29:50 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) 2024-01-16 12:29:50 0 [Note] InnoDB: Using Linux native AIO 2024-01-16 12:29:50 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB 2024-01-16 12:29:50 0 [Note] InnoDB: Completed initialization of buffer pool 2024-01-16 12:29:50 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes) 2024-01-16 12:29:50 0 [Note] InnoDB: End of log at LSN=46572 2024-01-16 12:29:51 0 [Note] InnoDB: 128 rollback segments are active. 2024-01-16 12:29:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2024-01-16 12:29:51 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2024-01-16 12:29:51 0 [Note] InnoDB: log sequence number 46572; transaction id 14 2024-01-16 12:29:51 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-01-16 12:29:51 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool 2024-01-16 12:29:51 0 [Note] InnoDB: Buffer pool(s) load completed at 240116 12:29:51 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-01-16 12:29:51 0 [Note] Server socket created on IP: '::'. 2024-01-16 12:29:51 0 [Note] mariadbd: ready for connections. Version: '10.11.5-MariaDB-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Alpine Linux 2024-01-16 12:29:52 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown 2024-01-16 12:29:52 0 [Note] InnoDB: FTS optimize thread exiting. 2024-01-16 12:29:52 0 [Note] InnoDB: Starting shutdown... 2024-01-16 12:29:52 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool 2024-01-16 12:29:52 0 [Note] InnoDB: Buffer pool(s) dump completed at 240116 12:29:52 2024-01-16 12:29:53 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2024-01-16 12:29:53 0 [Note] InnoDB: Shutdown completed; log sequence number 46572; transaction id 16 2024-01-16 12:29:53 0 [Note] mariadbd: Shutdown complete Database Setup Completed [custom-init] No custom files found, skipping... 240116 12:29:54 mysqld_safe Logging to '/config/databases/c6a83f5f2fa4.err'. 240116 12:29:54 mysqld_safe Starting mariadbd daemon with databases from /config/databases [ls.io-init] done.

github-actions[bot] commented 8 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

aptalca commented 8 months ago

You did not map the config folder for mariadb

aptalca commented 8 months ago

Also your database url var is using the wrong port. It needs to use the container port because it is trying to connect over the docker network, not through host.

jabertech commented 8 months ago

@aptalca works like a charm! thanks

this is hosted on oracle cloud, using portainer...for anyone looking for the right solution

the below is the updated stack I used, I have another sql db on port 3306, so the mariadb sqldb was mapped with port 3400 instead...please change it as needed

version: "3.8"

services:
  kimai:
    image: lscr.io/linuxserver/kimai:latest
    container_name: kimai
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DATABASE_URL=mysql://kimaiuser:kimaipassword@mariadb:3306/mariadb?charset=utf8&serverVersion=10.11.4-MariaDB-log
    volumes:
      - /volume1/docker/kimai/config:/config
    ports:
      - 8001:80
      - 4431:443
    restart: unless-stopped

  # MariaDB
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - MYSQL_ROOT_PASSWORD=changetoyourpassword
      - MYSQL_DATABASE=mariadb # optional
      - MYSQL_USER=kimaiuser # optional
      - MYSQL_PASSWORD=kimaipassword # optional
    volumes:
      - /volume1/docker/mariadb/config:/config
      - /var/lib/mysql:/var/lib/mysql
    ports:
      - 3400:3306
    restart: unless-stopped
aptalca commented 8 months ago

Also a heads up, assuming that mariadb instance is exclusively for kimai, you don't need that port mapping 3400:3306. Kimai is accessing it over the docker network so no need to map a port on the host.