Skip to content

Commit

Permalink
fix: provide sqlite 3.45 for drupal11, fixes #6110 (#6137)
Browse files Browse the repository at this point in the history
Co-authored-by: Stanislav Zhuk <stasadev@gmail.com>
  • Loading branch information
rfay and stasadev committed May 1, 2024
1 parent 5ec6275 commit a96ab26
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 10 deletions.
16 changes: 16 additions & 0 deletions pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,22 @@ func (app *DdevApp) RenderComposeYAML() (string, error) {
if app.CorepackEnable {
extraWebContent = extraWebContent + "\nRUN corepack enable"
}
if app.Type == nodeps.AppTypeDrupal {
// TODO: When ddev-webserver has required drupal 11+ sqlite version we can remove this.
drupalVersion, err := GetDrupalVersion(app)
if err == nil && drupalVersion == "11" {
extraWebContent = extraWebContent + "\n" + fmt.Sprintf(`
### Drupal 11+ requires a minimum sqlite3 version (3.45 currently)
ARG TARGETPLATFORM
ENV SQLITE_VERSION=%s
RUN mkdir -p /tmp/sqlite3 && \
wget -O /tmp/sqlite3/sqlite3.deb https://ftp.debian.org/debian/pool/main/s/sqlite3/sqlite3_${SQLITE_VERSION}-1_${TARGETPLATFORM##linux/}.deb && \
wget -O /tmp/sqlite3/libsqlite3.deb https://ftp.debian.org/debian/pool/main/s/sqlite3/libsqlite3-0_${SQLITE_VERSION}-1_${TARGETPLATFORM##linux/}.deb && \
apt install -y /tmp/sqlite3/*.deb && \
rm -rf /tmp/sqlite3
`, versionconstants.Drupal11RequiredSqlite3Version)
}
}

// Add supervisord config for WebExtraDaemons
var supervisorGroup []string
Expand Down
13 changes: 13 additions & 0 deletions pkg/ddevapp/ddevapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,19 @@ func TestDdevFullSiteSetup(t *testing.T) {
assert.Error(err)
assert.Contains(err.Error(), "upload_dirs is not set", app.Type)
}

// Special installed sqlite3 test for drupal11.
if app.Type == nodeps.AppTypeDrupal {
drupalVersion, err := ddevapp.GetDrupalVersion(app)
if err == nil && drupalVersion == "11" {
stdout, stderr, err := app.Exec(&ddevapp.ExecOpts{
Cmd: "sqlite3 --version | awk '{print $1}'",
})
require.NoError(t, err, "sqlite3 --version failed, output=%v, stderr=%v", stdout, stderr)
stdout = strings.Trim(stdout, "\r\n")
require.Equal(t, versionconstants.Drupal11RequiredSqlite3Version, stdout)
}
}
// We don't want all the projects running at once.
err = app.Stop(true, false)
assert.NoError(err)
Expand Down
20 changes: 10 additions & 10 deletions pkg/ddevapp/drupal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package ddevapp

import (
"fmt"
"github.com/ddev/ddev/pkg/dockerutil"
"github.com/ddev/ddev/pkg/nodeps"
"github.com/ddev/ddev/pkg/output"
"github.com/ddev/ddev/pkg/util"

"os"
"path"
"path/filepath"
"text/template"

"github.com/ddev/ddev/pkg/dockerutil"
"github.com/ddev/ddev/pkg/nodeps"
"github.com/ddev/ddev/pkg/output"
"github.com/ddev/ddev/pkg/util"

"github.com/ddev/ddev/pkg/fileutil"

"github.com/ddev/ddev/pkg/archive"
Expand Down Expand Up @@ -172,7 +172,7 @@ func writeDrupalSettingsDdevPhp(settings *DrupalSettings, filePath string, app *
}
}

drupalVersion, err := getDrupalVersion(app)
drupalVersion, err := GetDrupalVersion(app)
if err != nil || drupalVersion == "" {
// todo: Reconsider this logic for default version
drupalVersion = "10"
Expand Down Expand Up @@ -306,10 +306,10 @@ func isDrupal7App(app *DdevApp) bool {
return false
}

// getDrupalVersion finds the drupal8+ version so it can be used
// GetDrupalVersion finds the drupal8+ version so it can be used
// for setting requirements.
// It can only work if there is configured Drupal8+ code
func getDrupalVersion(app *DdevApp) (string, error) {
func GetDrupalVersion(app *DdevApp) (string, error) {
// For drupal6/7 we use the apptype provided as version
switch app.Type {
case nodeps.AppTypeDrupal6:
Expand All @@ -329,7 +329,7 @@ func getDrupalVersion(app *DdevApp) (string, error) {

// isDrupalApp returns true if the app is drupal
func isDrupalApp(app *DdevApp) bool {
v, err := getDrupalVersion(app)
v, err := GetDrupalVersion(app)
if err == nil && v != "" {
return true
}
Expand Down Expand Up @@ -358,7 +358,7 @@ func drupal7ConfigOverrideAction(app *DdevApp) error {

// drupalConfigOverrideAction selects proper versions for
func drupalConfigOverrideAction(app *DdevApp) error {
v, err := getDrupalVersion(app)
v, err := GetDrupalVersion(app)
if err != nil || v == "" {
util.Warning("Unable to detect Drupal version, continuing")
return nil
Expand Down
3 changes: 3 additions & 0 deletions pkg/versionconstants/versionconstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ var MutagenVersion = ""
const RequiredMutagenVersion = "0.17.2"

const RequiredDockerComposeVersionDefault = "v2.27.0"

// Drupal11RequiredSqlite3Version for ddev-webserver
const Drupal11RequiredSqlite3Version = "3.45.1"

0 comments on commit a96ab26

Please sign in to comment.