drupal icon indicating copy to clipboard operation
drupal copied to clipboard

Installation error drupal 11 with sqlite

Open svicervlad opened this issue 1 year ago • 10 comments

When I try to install Drupal 11 with a sqlite database I get an error

The database server version 3.40.1 is less than the minimum required version 3.45.

Image: drupal:11.0.0-php8.3-apache-bookworm

I think SQLite should be supported in Drupal Docker images for several important reasons, making it an ideal choice for specific use cases.

Key Advantages of SQLite in Docker Images of Drupal:

  1. Ease of Setup: SQLite requires no complex configuration. All that’s needed is a database file, making it perfect for quick testing or development.
  2. Minimal Dependencies: Using SQLite reduces the number of additional services that need to be run and managed in the container, simplifying deployment and maintenance.
  3. Drupal Support: Drupal officially supports SQLite as one of the database options. Therefore, you can expect that functionality will work correctly in any environment, including Docker.
  4. Local Development: For developers working on Drupal in Docker containers, using SQLite can be a convenient solution for local development where a more complex database isn’t needed.
  5. Simplicity in Backup and Restoration: Since SQLite’s database is stored as a single file, it’s easy to back up and transfer between environments.

Demonstrations with Drupal:

  1. Quick Deployment of Demo Sites: With SQLite, you can quickly deploy demo versions of Drupal sites without the need to configure a full-fledged database. This is ideal for presentations where you need to showcase functionality or themes quickly.
  2. Single File Database: SQLite allows the entire database to be stored in a single file. This is convenient for creating and distributing Docker demo images that can be easily transferred and run on different machines without additional setup.
  3. Resource Minimization: Since demonstrations usually don’t require high performance or scalability, SQLite becomes an optimal solution that minimizes resource usage.

svicervlad avatar Aug 06 '24 07:08 svicervlad

Ouch, confirmed: https://www.drupal.org/docs/getting-started/system-requirements/database-server-requirements#s-drupal-11--3

(I also tested - totally stock image deployment with no additional configuration and simply choosing SQLite in the setup wizard :disappointed:)

tianon avatar Aug 06 '24 18:08 tianon

Looking at https://packages.debian.org/bookworm/sqlite3, I'm also not sure there's a good way for us to solve this (there's not a newer version available for bookworm).

tianon avatar Aug 06 '24 18:08 tianon

Looks like this was part of https://www.drupal.org/project/drupal/issues/3346338 (actually codified in https://github.com/drupal/drupal/commit/10466dba9d7322ed55165dd9224edb2153c9b27a, which references https://www.drupal.org/project/drupal/issues/3420972 instead but that one is about testing, not about bumping the requirement).

tianon avatar Aug 06 '24 18:08 tianon

The first Debian release that supports 3.45 is Trixie, most likely released 2025, This is after Drupal 11 release. The latest version supported by Debian is 3.40.1-2.

and

Require sqlite 3.45 for Drupal 11. Very few sites run SQLite in production, and any existing ones which aren't yet ready to update to 3.45 are able to stay on Drupal 10 for two years beyond Drupal 11's release date.

:disappointed:

tianon avatar Aug 06 '24 18:08 tianon

From comments like this:

I think if there are really good reasons, we can roll this back, but I agree sqlite is mainly used for testing locally.

I believe we can safely infer that this is a "wontfix" / intentional breakage for upstream.

https://www.drupal.org/project/drupal/issues/3346338#comment-15370259 suggests that there could be (slash will be?) a contrib module with can be used instead to get sqlite support working on older sqlite versions, but I have not found it yet.

tianon avatar Aug 06 '24 18:08 tianon

From https://www.drupal.org/project/drupal/issues/3346338#comment-15577306, it looks like that might exist at https://www.drupal.org/project/sqlite326 someday, but does not currently (and no ETA), so I think that's as far as we can reasonably take this unless/until someone writes that module.

For the avoidance of doubt, I am not very comfortable with us building our own copy of SQLite from source to fix this issue (for similar reasons to upstream deciding it was worth doing a breaking change even knowing it would exclude some set of users and that it wasn't important enough to stop them from doing so).

tianon avatar Aug 06 '24 19:08 tianon

https://github.com/ddev/ddev/issues/6110 Fixed in ddev https://github.com/ddev/ddev/pull/6137 by installing sqlite pkg from Debian Trixie.

svicervlad avatar Aug 07 '24 06:08 svicervlad

or maybe better to use apt_preferences instead of wget and dpkg https://wiki.debian.org/AptConfiguration?action=show&redirect=AptPreferences#apt_preferences_.28APT_pinning.29

svicervlad avatar Aug 07 '24 07:08 svicervlad

Installing the package from Trixie is something that will currently maybe work, but is likely to break in the future, especially as Trixie is not in any stage of freeze.

tianon avatar Aug 07 '24 17:08 tianon

AFAICS the workaround of installing sqlite 3.45.1 from the trixie repo (see https://github.com/ddev/ddev/pull/6137 and https://github.com/ddev/ddev/issues/6110 ) has indeed stopped working.

The version in the repo seems to have changed to 3.46 which means the 3.45 urls now return a 404 - e.g.:

#24 [web 7/8] RUN SQLITE_VERSION=3.45.1 &&     mkdir -p /tmp/sqlite3 &&     wget -O /tmp/sqlite3/sqlite3.deb https://ftp.debian.org/debian/pool/main/s/sqlite3/sqlite3_${SQLITE_VERSION}-1_amd64.deb &&     wget -O /tmp/sqlite3/libsqlite3.deb https://ftp.debian.org/debian/pool/main/s/sqlite3/libsqlite3-0_${SQLITE_VERSION}-1_amd64.deb &&     dpkg -i /tmp/sqlite3/*.deb &&     rm -rf /tmp/sqlite3
#24 0.195 --2024-09-20 07:32:39--  https://ftp.debian.org/debian/pool/main/s/sqlite3/sqlite3_3.45.1-1_amd64.deb
#24 0.206 Resolving ftp.debian.org (ftp.debian.org)... 146.75.74.132, 2a04:4e42:82::644
#24 0.220 Connecting to ftp.debian.org (ftp.debian.org)|146.75.74.132|:443... connected.
#24 0.248 HTTP request sent, awaiting response... 404 Not Found

Trying to install 3.46 instead results in dependency errors:

#24 0.543 Preparing to unpack /tmp/sqlite3/libsqlite3.deb ...
#24 0.559 Unpacking libsqlite3-0:amd64 (3.46.1-1) over (3.40.1-2) ...
#24 0.667 Preparing to unpack /tmp/sqlite3/sqlite3.deb ...
#24 0.683 Unpacking sqlite3 (3.46.1-1) over (3.40.1-2) ...
#24 0.754 dpkg: dependency problems prevent configuration of libsqlite3-0:amd64:
#24 0.754  libsqlite3-0:amd64 depends on libc6 (>= 2.38); however:
#24 0.754   Version of libc6:amd64 on system is 2.36-9+deb12u7.
#24 0.754 
#24 0.754 dpkg: error processing package libsqlite3-0:amd64 (--install):
#24 0.754  dependency problems - leaving unconfigured
#24 0.754 dpkg: dependency problems prevent configuration of sqlite3:
#24 0.754  sqlite3 depends on libreadline8t64 (>= 6.0); however:
#24 0.754   Package libreadline8t64 is not installed.
#24 0.754  sqlite3 depends on libsqlite3-0 (= 3.46.1-1); however:
#24 0.754   Package libsqlite3-0:amd64 is not configured yet.
#24 0.754 
#24 0.754 dpkg: error processing package sqlite3 (--install):
#24 0.754  dependency problems - leaving unconfigured
#24 0.755 Processing triggers for libc-bin (2.36-9+deb12u7) ...
#24 0.977 Errors were encountered while processing:
#24 0.977  libsqlite3-0:amd64
#24 0.977  sqlite3

mcdruid avatar Sep 20 '24 07:09 mcdruid

As promised in the upstream conversation, a contrib module has materialized (thanks to effulgentsia). So, the answer is to add https://www.drupal.org/project/sqlite337 to your Drupal site. I am not yet sure if we can just plop a composer require 'drupal/sqlite337:^1.0@alpha' into the Dockerfile and that'll be enough or not.

* https://www.drupal.org/project/drupal/issues/3346338#comment-15743072

Edit: composer require ... works (with a choice during setup to use the alternative sqlite adapter); PR coming soon

yosifkit avatar Jun 23 '25 23:06 yosifkit

Here is how we solved this in farmOS:

https://github.com/farmOS/farmOS/blob/c462e5dfcd20f547ba6648bf4ea0d6d9ab5b6d9c/docker/Dockerfile#L67C1-L74C30

mstenta avatar Jun 25 '25 14:06 mstenta

Installing the package from Trixie is something that will currently maybe work, but is likely to break in the future, especially as Trixie is not in any stage of freeze.

Even with Trixie in a pretty advanced stage of freeze, mixing and matching packages like this is definitely a somewhat dangerous thing to do. 😬

tianon avatar Jun 25 '25 17:06 tianon

Agreed it's not ideal.

In our case we have tests that run nightly so if anything fails we can fix and update quickly. I'm not necessarily suggesting that this image adopt this solution. IMO it might be better to just let downstream users of the image to create their own derivative image and "own" the solution of their choosing (whether that be installing the contrib module from #291 or backporting the trixie package). Ultimately I think it was Drupal core's mistake to require an SQLite version that isn't available in Debian yet, so it's debatable whether or not this project should be responsible for fixing that.

mstenta avatar Jun 25 '25 18:06 mstenta