Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container tries MySQL migrations when not using MySQL as database backend #753

Closed
devtobi opened this issue Sep 11, 2023 · 6 comments
Closed
Labels
😖 duplicate This issue or pull request already exists

Comments

@devtobi
Copy link

devtobi commented Sep 11, 2023

Describe the bug
I tried running the speedtest tracker container with SQLite as backend. However, whenever the container starts, it tries to connect to a MySQL database and do the migrations. I have not set any environment variables that indicate I want to use MySQL, so I guess the default SQLite is not picked correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Only set the env variables PUID and PGID for the container
  2. Start the container

Expected behavior
The container should start up with SQLite as database backend

Environment (please complete the following information):

  • OS: Synology DSM
  • Architecture: amd64
  • Browser: -- not relevant
  • Speedtest-Tracker-Version: 0.11.22

Screenshots
If applicable, add screenshots to help explain your problem.

Logs

🐇  Configuring Speedtest Tracker...
🔒  Fixing app path file permissions...
✅  Permissions fixed.
🔗  Creating database symlink...
✅  Database symlink created.
✅  Environment file exists.
🔗  Creating symlinks for config and log files...
✅  Symlinks created.
✅  App key exists
💰  Building the cache...
✅  Cache set.
🚛  Migrating the database...
[2023-09-11 14:45:04] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations and table_type = 'BASE TABLE') at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:801)
@alexjustesen
Copy link
Owner

As environment variables you'll need to set the following as SQLite is no longer the default database as of v0.11.20. Referencing #701

DB_CONNECTION=sqlite
DB_DATABASE=/config/database.sqlite

@alexjustesen alexjustesen added the 😖 duplicate This issue or pull request already exists label Sep 11, 2023
@devtobi
Copy link
Author

devtobi commented Sep 11, 2023

Thanks for that quick answer. I wasn't able to find that information in the official documentation so that's why I was a bit confused, but now also found the new default for mysql in database.php. Does the .sqlite file have to be created manually, or is the container able to do so on startup if not found?

@alexjustesen
Copy link
Owner

If it's a new install you'll need to create the file, if its an existing sqlite file you'll be all set.

@BobFlapjack
Copy link

If it's a new install you'll need to create the file, if its an existing sqlite file you'll be all set.

How do we create the file?

@alexjustesen
Copy link
Owner

alexjustesen commented Sep 11, 2023

How do we create the file?

If you have a new install I strongly recommend using MySQL/MariaDB or Postresql as your database as SQLite isn't an officially supported option anymore. You just need to create an empty file in your mounted volume or directory called database.sqlite.

Important note for SQLite: It does work, and you can use it. But just because you can, doesn't mean you should.

@BobFlapjack
Copy link

BobFlapjack commented Sep 12, 2023

You just need to create an empty file in your mounted volume or directory called database.sqlite.

As simple as touch database.sqlite? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😖 duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants