mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
* wip auto-detect available extensions auto-recovery, fix reindexing check use original image for ml * set probes * update image for sql checker update images for gha * cascade * fix new instance * accurate dummy vector * simplify dummy * preexisiting pg docs * handle different db name * maybe fix sql generation * revert refreshfaces sql change * redundant switch * outdated message * update docker compose files * Update docs/docs/administration/postgres-standalone.md Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * tighten range * avoid always printing "vector reindexing complete" * remove nesting * use new images * add vchord to unit tests * debug e2e image * mention 1.107.2 in startup error * support new vchord versions --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { Kysely } from 'kysely';
|
|
import { DB } from 'src/db';
|
|
import { ConfigRepository } from 'src/repositories/config.repository';
|
|
import { DatabaseRepository } from 'src/repositories/database.repository';
|
|
import { LoggingRepository } from 'src/repositories/logging.repository';
|
|
import { getKyselyConfig } from 'src/utils/database';
|
|
import { GenericContainer, Wait } from 'testcontainers';
|
|
|
|
const globalSetup = async () => {
|
|
const postgresContainer = await new GenericContainer('ghcr.io/immich-app/postgres:14')
|
|
.withExposedPorts(5432)
|
|
.withEnvironment({
|
|
POSTGRES_PASSWORD: 'postgres',
|
|
POSTGRES_USER: 'postgres',
|
|
POSTGRES_DB: 'immich',
|
|
})
|
|
.withCommand([
|
|
'postgres',
|
|
'-c',
|
|
'shared_preload_libraries=vchord.so',
|
|
'-c',
|
|
'max_wal_size=2GB',
|
|
'-c',
|
|
'shared_buffers=512MB',
|
|
'-c',
|
|
'fsync=off',
|
|
'-c',
|
|
'full_page_writes=off',
|
|
'-c',
|
|
'synchronous_commit=off',
|
|
'-c',
|
|
'config_file=/var/lib/postgresql/data/postgresql.conf',
|
|
])
|
|
.withWaitStrategy(Wait.forAll([Wait.forLogMessage('database system is ready to accept connections', 2)]))
|
|
.start();
|
|
|
|
const postgresPort = postgresContainer.getMappedPort(5432);
|
|
const postgresUrl = `postgres://postgres:postgres@localhost:${postgresPort}/immich`;
|
|
|
|
process.env.IMMICH_TEST_POSTGRES_URL = postgresUrl;
|
|
|
|
const db = new Kysely<DB>(getKyselyConfig({ connectionType: 'url', url: postgresUrl }));
|
|
|
|
const configRepository = new ConfigRepository();
|
|
const logger = LoggingRepository.create();
|
|
await new DatabaseRepository(db, logger, configRepository).runMigrations();
|
|
|
|
await db.destroy();
|
|
};
|
|
|
|
export default globalSetup;
|