jarischaefer / docker-librenms

Docker image for LibreNMS
MIT License
115 stars 37 forks source link

docker image fails to populate initial database #132

Closed jermudgeon closed 2 years ago

jermudgeon commented 3 years ago

This may be related to https://github.com/jarischaefer/docker-librenms/issues/128

I started with the docker-compose.yml file, with appropriate modifications (APP_KEY, db credentials, etc.)

librenms.log has (repeatedly) [2021-08-08 02:01:01] production.ERROR: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table│web_1 | Aug 8 02:01:01 librenms CRON[332]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/aler 'librenms.config' doesn't exist in /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.p│ts.php >> /dev/null 2>&1) hp:79 │web_1 | Aug 8 02:02:02 librenms CRON[429]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/aler Stack trace:

It looks as if the initial database creation is aborting, but I'm not sure where the log would be for that:

mysql> show tables;
+--------------------+
| Tables_in_librenms |
+--------------------+
| access_points      |
| alert_device_map   |
| alert_group_map    |
| alert_location_map |
| alert_log          |
+--------------------+
5 rows in set (0.00 sec)

mysql> select * from alert_log
    -> ;
Empty set (0.00 sec)

setup_database has an interesting output:

root@librenms:/etc/my_init.d# setup_database 

In Process.php line 267:

  The command "mysql  --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}"  
   --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOA  
  D_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.                                            

  Exit Code: 1(General error)                                                                

  Working directory: /opt/librenms                                                           

  Output:                                                                                    
  ================                                                                           

  Error Output:                                                                              
  ================                                                                           
  mysql: [Warning] Using a password on the command line interface can be insecure.           
  ERROR 1071 (42000) at line 85: Specified key was too long; max key length is 767 bytes     

As this appears to be a dynamically generated input file, I'm not sure where to go from here to find out what key is too long.

Any ideas? Thanks!

jarischaefer commented 3 years ago

Sorry for the delay. You need innodb_large_prefix=1 and perhaps format Barracuda (check MySQL docs). Tables must be recreated. The error appears if trying to create an index on a large column (e.g. utf8mb4 with length 255). The large prefix increases the limit.