Description
A few weeks ago, I pulled the entire repository onto my local server.
I added the necessary values into .env, and then I ran the following command:
docker compose -f docker-compose.prod.yml up -d
All the logs indicate everything is correct, database works, user registration works.
Ran this command:
docker compose -f docker-compose.prod.yml down
Shutdown successful
docker compose -f docker-compose.prod.yml up -d
Started it again. Everything looks good so far.
Then today:
Updated docker-compose.prod.yml to the latest version
Ran the following command:
docker compose -f docker-compose.prod.yml pull
Executed successfully. Then ran:
docker compose -f docker-compose.prod.yml up --force-recreate --remove-orphans | tee simstudio-up.log
[+] Running 4/4
✔ Container f0f7fbf29ffe_simstudio_db_1 Recreated0.1s
✔ Container simstudio_migrations_1 Recreated0.0s
✔ Container simstudio-realtime-1 Created0.0s
✔ Container simstudio_simstudio_1 Recreated0.3s
Attaching to db-1, migrations-1, realtime-1, simstudio-1
db-1 |
db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db-1 |
db-1 | 2025-07-02 18:04:35.236 UTC [1] LOG: starting PostgreSQL 17.4 (Debian 17.4-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
db-1 | 2025-07-02 18:04:35.238 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db-1 | 2025-07-02 18:04:35.238 UTC [1] LOG: listening on IPv6 address "::", port 5432
db-1 | 2025-07-02 18:04:35.240 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db-1 | 2025-07-02 18:04:35.248 UTC [27] LOG: database system was shut down at 2025-07-02 17:57:16 UTC
db-1 | 2025-07-02 18:04:35.262 UTC [1] LOG: database system is ready to accept connections
migrations-1 | $ bunx drizzle-kit migrate
migrations-1 | No config path provided, using default 'drizzle.config.ts'
migrations-1 | Reading config file '/app/apps/sim/drizzle.config.ts'
migrations-1 | Using 'postgres' driver for database querying
db-1 | 2025-07-02 18:04:42.478 UTC [39] FATAL: database "simstudio" does not exist
migrations-1 | 37 | async queryWithCache(queryString, params, query) {
migrations-1 | 38 | if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
migrations-1 | 39 | try {
migrations-1 | 40 | return await query();
migrations-1 | 41 | } catch (e) {
migrations-1 | 42 | throw new DrizzleQueryError(queryString, params, e);
migrations-1 | ^
migrations-1 | error: Failed query: CREATE SCHEMA IF NOT EXISTS "drizzle"
migrations-1 | params:
migrations-1 | query: "CREATE SCHEMA IF NOT EXISTS \"drizzle\"",
migrations-1 | params: [],
migrations-1 |
migrations-1 | at queryWithCache (/app/node_modules/drizzle-orm/pg-core/session.js:42:15)
migrations-1 |
migrations-1 | 790 | }
migrations-1 | 791 | )
migrations-1 | 792 | Error.captureStackTrace(error, notSupported)
migrations-1 | 793 | return error
migrations-1 | 794 | }
migrations-1 | ^
migrations-1 | PostgresError: database "simstudio" does not exist
migrations-1 | severity_local: "FATAL",
migrations-1 | severity: "FATAL",
migrations-1 | file: "postinit.c",
migrations-1 | routine: "InitPostgres",
migrations-1 | code: "3D000"
migrations-1 |
migrations-1 | at ErrorResponse (/app/node_modules/postgres/src/errors.js:794:5)
migrations-1 |
migrations-1 | error: script "db:migrate" exited with code 1
[⣯] applying migrations...
migrations-1 exited with code 1
Anyway, I looked into my pg-vector container and found the following:
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | Locale | ICU Rules | Access privileges
-------------------+----------+----------+-----------------+------------+------------+--------+-----------+-----------------------
postgres | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
readme_to_recover | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | |
template0 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | en_US.utf8 | en_US.utf8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
So--I am assuming that a database was created called postgres, instead of one called simstudio. Is this a known issue? Has this happened before? Did I make a mistake in setting this up?