Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions internal/db/dump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/jackc/pgconn"
"github.com/spf13/afero"
"github.com/supabase/cli/internal/utils"
cliConfig "github.com/supabase/cli/pkg/config"
)

var (
Expand Down Expand Up @@ -173,7 +172,7 @@ func dump(ctx context.Context, config pgconn.Config, script string, env []string
return utils.DockerRunOnceWithConfig(
ctx,
container.Config{
Image: cliConfig.Images.Pg15,
Image: utils.Config.Db.Image,
Env: allEnvs,
Cmd: []string{"bash", "-c", script, "--"},
},
Expand Down
26 changes: 17 additions & 9 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func NewConfig(editors ...ConfigEditor) config {
KongImage: Images.Kong,
},
Db: db{
Image: Images.Pg15,
Image: Images.Pg,
Password: "postgres",
RootKey: Secret{
Value: "d4dc5b6d4a1d6a10b2c1e76112c994d65db7cec380572cc1839624d4be3fa275",
Expand Down Expand Up @@ -596,12 +596,22 @@ func (c *config) Load(path string, fsys fs.FS) error {
c.Api.ExternalUrl = apiUrl.String()
}
// Update image versions
if version, err := fs.ReadFile(fsys, builder.PostgresVersionPath); err == nil {
if strings.HasPrefix(string(version), "15.") && semver.Compare(string(version[3:]), "1.0.55") >= 0 {
c.Db.Image = replaceImageTag(Images.Pg15, string(version))
}
switch c.Db.MajorVersion {
case 13:
c.Db.Image = pg15
case 14:
c.Db.Image = pg14
case 15:
c.Db.Image = pg15
}
if c.Db.MajorVersion > 14 {
if version, err := fs.ReadFile(fsys, builder.PostgresVersionPath); err == nil {
// Only replace image if postgres version is above 15.1.0.55
if strings.HasPrefix(string(version), fmt.Sprintf("%d.", c.Db.MajorVersion)) &&
(c.Db.MajorVersion != 15 || semver.Compare(string(version[3:]), "1.0.55") >= 0) {
c.Db.Image = replaceImageTag(pg15, string(version))
}
}
if version, err := fs.ReadFile(fsys, builder.RestVersionPath); err == nil && len(version) > 0 {
c.Api.Image = replaceImageTag(Images.Postgrest, string(version))
}
Expand Down Expand Up @@ -725,10 +735,8 @@ func (c *config) Validate(fsys fs.FS) error {
return errors.New("Missing required field in config: db.major_version")
case 12:
return errors.New("Postgres version 12.x is unsupported. To use the CLI, either start a new project or follow project migration steps here: https://supabase.com/docs/guides/database#migrating-between-projects.")
case 13:
c.Db.Image = pg13
case 14:
c.Db.Image = pg14
case 13, 14, 17:
// TODO: support oriole db 17 eventually
case 15:
if len(c.Experimental.OrioleDBVersion) > 0 {
c.Db.Image = "supabase/postgres:orioledb-" + c.Experimental.OrioleDBVersion
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import (
const (
pg13 = "supabase/postgres:13.3.0"
pg14 = "supabase/postgres:14.1.0.89"
pg15 = "supabase/postgres:15.8.1.069"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note

To rename Pg15 and Pg17 under the single Pg I still needed a way to address the specific pg15 version in some case. I went like for pg13 and pg14 and pointed to the latest available version at the time. Not sure if that's the way to go though.

deno2 = "supabase/edge-runtime:v1.68.0-develop.13"
)

type images struct {
Pg15 string `mapstructure:"pg15"`
Pg string `mapstructure:"pg"`
// Append to Services when adding new dependencies below
Kong string `mapstructure:"kong"`
Inbucket string `mapstructure:"mailpit"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/templates/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Exposed for updates by .github/dependabot.yml
FROM supabase/postgres:15.8.1.060 AS pg15
FROM supabase/postgres:17.4.1.012 AS pg
# Append to ServiceImages when adding new dependencies below
FROM library/kong:2.8.1 AS kong
FROM axllent/mailpit:v1.22.3 AS mailpit
Expand Down
2 changes: 1 addition & 1 deletion tools/selfhost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func updateSelfHosted(ctx context.Context, branch string) error {
}

func getStableVersions() map[string]string {
images := append(config.Images.Services(), config.Images.Pg15)
images := append(config.Images.Services(), config.Images.Pg)
result := make(map[string]string, len(images))
for _, img := range images {
parts := strings.Split(img, ":")
Expand Down