Skip to content

Commit 0300893

Browse files
authored
Fix wasp start db to use Postgres 18 explicitly (#3323)
1 parent 5986860 commit 0300893

File tree

18 files changed

+63
-49
lines changed

18 files changed

+63
-49
lines changed

examples/tutorials/TodoApp/main.wasp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app TodoApp {
22
wasp: {
3-
version: "^0.18.1" // Pins the version of Wasp to use.
3+
version: "^0.18.2" // Pins the version of Wasp to use.
44
},
55
title: "TodoApp", // Used as the browser tab title. Note that all strings in Wasp are double quoted!
66
head: [

examples/tutorials/TodoApp/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tutorials/TodoAppTs/main.wasp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app TodoApp {
22
wasp: {
3-
version: "^0.18.1" // Pins the version of Wasp to use.
3+
version: "^0.18.2" // Pins the version of Wasp to use.
44
},
55
title: "TodoApp", // Used as the browser tab title. Note that all strings in Wasp are double quoted!
66
head: [

examples/waspello/main.wasp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ActionConfig, App, ExtImport } from "wasp-config";
22

33
const app = new App("waspello", {
44
title: "Waspello",
5-
wasp: { version: "^0.18.1" },
5+
wasp: { version: "^0.18.2" },
66
});
77

88
app.auth({

examples/waspleau/main.wasp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app waspleau {
22
wasp: {
3-
version: "^0.18.1"
3+
version: "^0.18.2"
44
},
55

66
title: "Waspleau",

examples/waspleau/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/websockets-realtime-voting/main.wasp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app whereDoWeEat {
22
wasp: {
3-
version: "^0.18.1"
3+
version: "^0.18.2"
44
},
55
title: "where-do-we-eat",
66
client: {

mage/main.wasp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app waspAi {
22
wasp: {
3-
version: "^0.18.1"
3+
version: "^0.18.2"
44
},
55
title: "MAGE - GPT Web App Generator ✨",
66
head: [

waspc/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.18.2
4+
5+
### 🐞 Bug fixes
6+
7+
- Wasp dev database (`wasp start db`) now uses a pinned PostgreSQL version (`postgres:18`) with the correct volume mount path. ([#3323](https://github.com/wasp-lang/wasp/pull/3323))
8+
39
## 0.18.1
410

511
### 🐞 Bug fixes

waspc/cli/src/Wasp/Cli/Command/Start/Db.hs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,31 +107,24 @@ startPostgreDevDb waspProjectDir appName = do
107107
-- only when initializing the database -> if it already exists, they will be ignored.
108108
-- This is how the postgres Docker image works.
109109
let command =
110-
printf
111-
( unwords
112-
[ "docker run",
113-
"--name %s",
114-
"--rm",
115-
"--publish %d:5432",
116-
"-v %s:/var/lib/postgresql/data",
117-
"--env POSTGRES_PASSWORD=%s",
118-
"--env POSTGRES_USER=%s",
119-
"--env POSTGRES_DB=%s",
120-
"postgres"
121-
]
122-
)
123-
dockerContainerName
124-
Dev.Postgres.defaultDevPort
125-
dockerVolumeName
126-
Dev.Postgres.defaultDevPass
127-
Dev.Postgres.defaultDevUser
128-
dbName
110+
unwords
111+
[ "docker run",
112+
printf "--name %s" dockerContainerName,
113+
"--rm",
114+
printf "--publish %d:5432" Dev.Postgres.defaultDevPort,
115+
printf "-v %s:%s" dockerVolumeName postgresDockerVolumeMountPath,
116+
printf "--env POSTGRES_PASSWORD=%s" Dev.Postgres.defaultDevPass,
117+
printf "--env POSTGRES_USER=%s" Dev.Postgres.defaultDevUser,
118+
printf "--env POSTGRES_DB=%s" dbName,
119+
postgresDockerImage
120+
]
129121
liftIO $ callCommand command
130122
where
131123
dockerVolumeName = makeWaspDevDbDockerVolumeName waspProjectDir appName
132124
dockerContainerName = makeWaspDevDbDockerContainerName waspProjectDir appName
133125
dbName = Dev.Postgres.makeDevDbName waspProjectDir appName
134126
connectionUrl = Dev.Postgres.makeDevConnectionUrl waspProjectDir appName
127+
(postgresDockerImage, postgresDockerVolumeMountPath) = waspDevDbPostgresDockerImageSpec
135128

136129
throwIfDevDbPortIsAlreadyInUse :: Command ()
137130
throwIfDevDbPortIsAlreadyInUse = do
@@ -171,3 +164,18 @@ makeWaspDevDbDockerContainerName waspProjectDir appName =
171164

172165
maxDockerContainerNameLength :: Int
173166
maxDockerContainerNameLength = 63
167+
168+
type PostgresDockerImage = String
169+
170+
type PostgresDockerVolumeMountPath = String
171+
172+
-- | We pin the Postgres Docker image to avoid issues when a new major version of Postgres
173+
-- is released. We aim to occasionally update this version in Wasp releases.
174+
-- If you bump the Postgres version here, also check if `postgresDockerVolumeMountPath`
175+
-- is still correct.
176+
waspDevDbPostgresDockerImageSpec :: (PostgresDockerImage, PostgresDockerVolumeMountPath)
177+
waspDevDbPostgresDockerImageSpec = ("postgres:18", postgresDockerVolumeMountPath)
178+
where
179+
-- Path inside the Postgres Docker container where the database files are stored.
180+
postgresDockerVolumeMountPath :: PostgresDockerVolumeMountPath
181+
postgresDockerVolumeMountPath = "/var/lib/postgresql"

0 commit comments

Comments
 (0)