alexjustesen / speedtest-tracker

Speedtest Tracker is a self-hosted internet performance tracking application that runs speedtest checks against Ookla's Speedtest service.
https://speedtest-tracker.dev/
MIT License
2.68k stars 100 forks source link

0.11.19 SQLite Db Errors #701

Closed jiriteach closed 1 year ago

jiriteach commented 1 year ago

Seeing db errors with the latest release. Since I used Watchtower - it pulled down the latest 0.11.19 and now the container wont come back up. Have multiple deployments effected.

Assuming this is related to the SQLite changes? How does one fix this? Was a working deployment - only update was the container.

#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(272): Illuminate\\Database\\SQLiteConnection->__construct()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(76): Illuminate\\Database\\Connectors\\ConnectionFactory->createConnection()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(50): Illuminate\\Database\\Connectors\\ConnectionFactory->createSingleConnection()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(152): Illuminate\\Database\\Connectors\\ConnectionFactory->make()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(101): Illuminate\\Database\\DatabaseManager->makeConnection()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(210): Illuminate\\Database\\DatabaseManager->connection()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(98): Illuminate\\Cache\\CacheManager->createDatabaseDriver()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(61): Illuminate\\Cache\\CacheManager->resolve()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(72): Illuminate\\Cache\\CacheManager->store()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php(36): Illuminate\\Cache\\CacheManager->driver()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Cache\\CacheServiceProvider->Illuminate\\Cache\\{closure}()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(236): Illuminate\\Container\\Container->offsetGet()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(207): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(347): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#23 /var/www/html/app/Providers/RouteServiceProvider.php(29): Illuminate\\Support\\Facades\\Facade::__callStatic()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\RouteServiceProvider->boot()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1010): Illuminate\\Container\\Container->call()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(991): Illuminate\\Foundation\\Application->bootProvider()
#31 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(992): array_walk()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(261): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(447): Illuminate\\Foundation\\Application->bootstrapWith()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(199): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#37 /var/www/html/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#38 {main}
[previous exception] [object] (Illuminate\\Database\\SQLiteDatabaseDoesNotExistException(code: 0): Database file at path [/var/www/html/database/database.sqlite] does not exist. Ensure this is an absolute path to the database. at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php:34)

[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(221): Illuminate\\Database\\Connectors\\SQLiteConnector->connect()
#1 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1292): call_user_func()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(574): Illuminate\\Database\\Connection->getPdo()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(788): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(755): Illuminate\\Database\\Connection->runQueryCallback()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(581): Illuminate\\Database\\Connection->run()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(398): Illuminate\\Database\\Connection->statement()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php(36): Illuminate\\Database\\Schema\\Builder->enableForeignKeyConstraints()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(272): Illuminate\\Database\\SQLiteConnection->__construct()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(76): Illuminate\\Database\\Connectors\\ConnectionFactory->createConnection()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(50): Illuminate\\Database\\Connectors\\ConnectionFactory->createSingleConnection()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(152): Illuminate\\Database\\Connectors\\ConnectionFactory->make()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(101): Illuminate\\Database\\DatabaseManager->makeConnection()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(210): Illuminate\\Database\\DatabaseManager->connection()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(98): Illuminate\\Cache\\CacheManager->createDatabaseDriver()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(61): Illuminate\\Cache\\CacheManager->resolve()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(72): Illuminate\\Cache\\CacheManager->store()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php(36): Illuminate\\Cache\\CacheManager->driver()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Cache\\CacheServiceProvider->Illuminate\\Cache\\{closure}()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(236): Illuminate\\Container\\Container->offsetGet()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(207): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(347): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#28 /var/www/html/app/Providers/RouteServiceProvider.php(29): Illuminate\\Support\\Facades\\Facade::__callStatic()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\RouteServiceProvider->boot()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1010): Illuminate\\Container\\Container->call()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(991): Illuminate\\Foundation\\Application->bootProvider()
#36 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(992): array_walk()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(261): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(447): Illuminate\\Foundation\\Application->bootstrapWith()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(199): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#42 /var/www/html/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#43 {main}
"} 
In Connection.php line 801:

  Database file at path [/var/www/html/database/database.sqlite] does not exi  
  st. Ensure this is an absolute path to the database. (Connection: sqlite, S  
  QL: PRAGMA foreign_keys = ON;)                                               

In SQLiteConnector.php line 34:

  Database file at path [/var/www/html/database/database.sqlite] does not exi  
  st. Ensure this is an absolute path to the database.                         

s6-rc: warning: unable to start service laravel-automations: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
prog: fatal: stopping the container.
holocronology commented 1 year ago

@holocronology @Jiriteach Have you guys tried adding the APP_KEY variable?

Yes, I did. Similar issues. I also noticed that the rest of the DB info (host, port, etc) was not being properly passed from compose file to mariaDB.

jiriteach commented 1 year ago

My issue of db not found is not related to the APP_KEY issue. Flushed everything and a new install failed - seems like a path issue in being able to find the sqlite db. Have reverted to .17 and using this OK for now.

EVOTk commented 1 year ago

Just did a fresh install on Unraid based on template and included the DB_CONNECTION variable for sqlite but still not working.

In Connection.php line 801:

  Database file at path [speedtest_tracker] does not exist. Ensure this is an  
   absolute path to the database. (Connection: sqlite, SQL: PRAGMA foreign_ke  
  ys = ON;)                                                                    

In SQLiteConnector.php line 34:

  Database file at path [speedtest_tracker] does not exist. Ensure this is an  
   absolute path to the database. 

Same issue for me :(

jiriteach commented 1 year ago

Decided to try 0.11.21 and strangly - its fixed!. Tried this on multiple sites with the 0.11.21 version. Fails on first startup then restarts and fixed so I belive its fixed now. Thanks

paralovosca commented 1 year ago

Version 0.11.21 worked for me as well. I had to ensure '- 'DB_CONNECTION=sqlite' was removed. Thank you for the fixes able to move from 0.11.17 now.

EVOTk commented 1 year ago

Decided to try 0.11.21 and strangly - its fixed!. Tried this on multiple sites with the 0.11.21 version. Fails on first startup then restarts and fixed so I belive its fixed now. Thanks

Same for me, fails on first startup then restarts , its works

StirCwazy commented 1 year ago

My apologies if this is somewhere mixed into this huge gnarly thread, but is 0.11.21 working on unRAID? Default install, no existing appdata, and I'm getting the following.

In Connection.php line 801:

SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *
from information_schema.tables where table_schema = speedtest_tracker and
table_name = migrations and table_type = 'BASE TABLE')

In Connector.php line 65:

SQLSTATE[HY000] [2002] Connection refused

This is a clean install on a new server, had this on a previous server a while back and wanted to start using it again. I came across this thread and have seen numerous comments about unRAID and it not working.

chandz05 commented 1 year ago

@StirCwazy this is what works for me on Unraid. Note that I setup a separate db for speed test:

-d --name='speedtest-tracker' --net='bridge' -e TZ="America/New_York" -e HOST_OS="Unraid" -e HOST_HOSTNAME="Tower" -e HOST_CONTAINERNAME="speedtest-tracker" -e 'PUID'='1000' -e 'PGID'='1000' -e 'APP_KEY'='base64:somstring' -e 'DB_CONNECTION'='mysql' -e 'DB_HOST'='db' -e 'DB_PORT'='3306' -e 'DB_DATABASE'='speedtest' -e 'DB_USERNAME'='speedtest' -e 'DB_PASSWORD'='password' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.webui='https://[IP]:[PORT:443]/' -l net.unraid.docker.icon='https://raw.githubusercontent.com/devzwf/unraid-docker-templates/main/images/speedtest-tracker-icon.png' -p '9443:443/tcp' -v '/mnt/user/appdata/speedtest-tracker-1':'/config':'rw' 'ghcr.io/alexjustesen/speedtest-tracker:latest'

To get the APP_KEY value, run the following command for your speedtest-tracker container: docker exec -it speedtest-tracker php artisan key:generate --show

holocronology commented 1 year ago

UNRAID: I had it on v0.11.17. I changed the template back to "latest". Forced an update and it failed to start. Same errors. Stopped and restarted and it works.

I guess the Unraid APP template is going to need to be revised to include mariadb/mysql or postsql databases.

StirCwazy commented 1 year ago

@StirCwazy this is what works for me on Unraid. Note that I setup a separate db for speed test:

-d --name='speedtest-tracker' --net='bridge' -e TZ="America/New_York" -e HOST_OS="Unraid" -e HOST_HOSTNAME="Tower" -e HOST_CONTAINERNAME="speedtest-tracker" -e 'PUID'='1000' -e 'PGID'='1000' -e 'APP_KEY'='base64:somstring' -e 'DB_CONNECTION'='mysql' -e 'DB_HOST'='db' -e 'DB_PORT'='3306' -e 'DB_DATABASE'='speedtest' -e 'DB_USERNAME'='speedtest' -e 'DB_PASSWORD'='password' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.webui='https://[IP]:[PORT:443]/' -l net.unraid.docker.icon='https://raw.githubusercontent.com/devzwf/unraid-docker-templates/main/images/speedtest-tracker-icon.png' -p '9443:443/tcp' -v '/mnt/user/appdata/speedtest-tracker-1':'/config':'rw' 'ghcr.io/alexjustesen/speedtest-tracker:latest'

To get the APP_KEY value, run the following command for your speedtest-tracker container: docker exec -it speedtest-tracker php artisan key:generate --show

Am I understanding then that a sqlite DB is no longer an option?

alexjustesen commented 1 year ago

Decided to try 0.11.21 and strangly - its fixed!. Tried this on multiple sites with the 0.11.21 version. Fails on first startup then restarts and fixed so I belive its fixed now. Thanks

I added back the symlink in 0.11.20 so that fixed the connection to the database because it needed to get mounted inside of the app which is why it suddenly started work.

SaltireSoul commented 1 year ago

Decided to try 0.11.21 and strangly - its fixed!. Tried this on multiple sites with the 0.11.21 version. Fails on first startup then restarts and fixed so I belive its fixed now. Thanks

I added back the symlink in 0.11.20 so that fixed the connection to the database because it needed to get mounted inside of the app which is why it suddenly started work.

It is still kind of bugged, as it requires two runs to start successfully.

alexjustesen commented 1 year ago

I guess the Unraid APP template is going to need to be revised to include mariadb/mysql or postsql databases.

I don't own the template but I'll post in the forums for an update.

alexjustesen commented 1 year ago

It is still kind of bugged, as it requires two runs to start successfully.

Caching I think has something to do with it

SaltireSoul commented 1 year ago

I forgot to mention, ZappyZap's Unraid template doesn't use enviroment variables except for /config

alexjustesen commented 1 year ago

Maybe not by default but you can add them image

StirCwazy commented 1 year ago

@alexjustesen If using unraid, are there any other variables I'd need to use if opting for sqlite?

SaltireSoul commented 1 year ago

@StirCwazy I'm actually using Unraid for this myself, however I'm using the .env file.

DB_CONNECTION=sqlite
DB_DATABASE=/config/database.sqlite

@alexjustesen sorry I just meant it creates a .env file by default and manually creating enviroment variables might be having a conflict

alexjustesen commented 1 year ago

@alexjustesen sorry I just meant it creates a .env file by default and manually creating enviroment variables might be having a conflict

No worries, I'm marching towards getting rid of the the .env file so environment variables passed through are absolutely preferred at this point.

@alexjustesen If using unraid, are there any other variables I'd need to use if opting for sqlite?

What @SaltireSoul is correct, you just need those two vars.

holocronology commented 1 year ago

Adding these to Unraid: image

Resulted in: image

Removed them. Started and it failed. Restarted and it worked.

StirCwazy commented 1 year ago

Adding these to Unraid: image

Resulted in: image

Removed them. Started and it failed. Restarted and it worked.

Added both variables, got the same 500 | Server Error. Removed as you said you tried with success, failed.

In Connection.php line 801:

SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *
from information_schema.tables where table_schema = speedtest_tracker and
table_name = migrations and table_type = 'BASE TABLE')

In Connector.php line 65:

SQLSTATE[HY000] [2002] Connection refused

alexjustesen commented 1 year ago

@StirCwazy config looks right, not sure if it was the unraid forums or here but it required a second restart for the container to pickup the env variables.

holocronology commented 1 year ago

it required a second restart for the container to pickup the env variables

I did try the second, and third, restart after adding the variables without success. It was only after removing them that it worked.

Okay, I tried it again and it worked.

UPDATE @alexjustesen :

I added the following variables to Unraid and set up a MariaDB (Linuxserver image) container:

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=speedtest_tracker
DB_USERNAME=speedy
DB_PASSWORD=password
TZ=America/Chicago

I had to do the same start, stop, and restart to clear the 500 error code. Seems to be working.

devzwf commented 1 year ago

I will update the template with this

devzwf commented 1 year ago

speedtest_tracker

@StirCwazy config looks right, not sure if it was the unraid forums or here but it required a second restart for the container to pickup the env variables.

That's really weird , but yes it is the case.

StirCwazy commented 1 year ago

speedtest_tracker

@StirCwazy config looks right, not sure if it was the unraid forums or here but it required a second restart for the container to pickup the env variables.

That's really weird , but yes it is the case.

After adding the variables for DB_CONNECTION and DB_DATABASE it worked after a restart. I've been busy and haven't had a chance to reply, so my apologies to all.

alexjustesen commented 1 year ago

746 merged to dynamically generate an APP_KEY should that be missing on start up.

toxic0berliner commented 1 year ago

Seems it's not creating the db if it doesn't exist. How to start using this image when no preexisting sqlite db exists? Should be documented I believe

alexjustesen commented 1 year ago

Using SQLite added to the FAQ

felho001 commented 1 year ago

Using SQLite added to the FAQ

I try this method but not work for me. I back to v0.11.17

holocronology commented 1 year ago

I moved to MariaDB.

alexjustesen commented 1 year ago

Using SQLite added to the FAQ

I try this method but not work for me. I back to v0.11.17

If you're still having problems please open a new issue and we'll get it sorted. I'll be unsubscribing from this one