Skip to content

PostgreSQL 18.6 Local Container Database Setup ​

In accordance with the Zero-Mock principle, all SyncSeries products—including SyncBoot—do not use in-memory dummy databases (such as H2). Even in local development and integration testing environments, they standardize on an actual PostgreSQL 18.6 (pgvector/pgvector:pg18) container managed via docker-compose-local.yml and the 6-File DB SSOT (db/00_extensions.sql to 05_sample_dev.sql) architecture.


1. Starting the Local Infrastructure Container (docker-compose-local.yml) ​

Infrastructure required for IDE debugging and local development is started standalone using docker-compose-local.yml.

yaml
services:
  postgres:
    image: pgvector/pgvector:pg18
    container_name: syncboot-postgres-local
    ports:
      - "45432:5432"
    environment:
      POSTGRES_DB: syncboot_db
      POSTGRES_USER: ${DB_USERNAME:-postgres}
      POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
    volumes:
      - ./db/00_extensions.sql:/docker-entrypoint-initdb.d/00_extensions.sql:ro
      - ./db/01_schema_system.sql:/docker-entrypoint-initdb.d/01_schema_system.sql:ro
      - ./db/02_schema_domain.sql:/docker-entrypoint-initdb.d/02_schema_domain.sql:ro
      - ./db/03_seed_system.sql:/docker-entrypoint-initdb.d/03_seed_system.sql:ro
      - ./db/04_seed_domain.sql:/docker-entrypoint-initdb.d/04_seed_domain.sql:ro
      - ./db/05_sample_dev.sql:/docker-entrypoint-initdb.d/05_sample_dev.sql:ro
bash
# Start local development infrastructure (PostgreSQL 18.6, Redis 7, MinIO, RabbitMQ) standalone
docker compose -f docker-compose-local.yml up -d

2. 6-File DB SSOT Standard Structure (<SubProject>/db/) ​

On initial container startup, the 6-stage standard SQL scripts under <SubProject>/db/ execute sequentially to initialize the latest schema and seed data.

Execution OrderFile NamePrimary Role & Contents
00db/00_extensions.sqlRequired PostgreSQL 18.6 extension declarations (vector, uuid-ossp, pg_trgm)
01db/01_schema_system.sqlPlatform-common system table DDL (sys_user, sys_role, sys_permission, sys_dict, sys_config, etc.)
02db/02_schema_domain.sqlDomain-specific business table DDL, HNSW vector indexes, and constraints (snake_case standard)
03db/03_seed_system.sqlInitial super-admin account, default role (role_admin), common dictionary codes, and system base menus (INSERT INTO)
04db/04_seed_domain.sqlDomain business menus (sys_permission), role-permission mappings (sys_role_permission), and baseline master data (INSERT INTO)
05db/05_sample_dev.sqlSample fixture data for local development and demos only (excluded from production execution)

3. pom.xml Dependencies & application-local.yml Configuration ​

3.1 Maven Dependency (pom.xml) ​

xml
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <scope>runtime</scope>
</dependency>

3.2 Local Profile Configuration (application-local.yml) ​

yaml
spring:
  datasource:
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://localhost:45432/syncboot_db
    username: ${DB_USERNAME:postgres}
    password: ${DB_PASSWORD:postgres}

4. Database Connection & Status Verification ​

  • Host / Port: localhost:45432 (or localhost:5432 when using single-port mapping)
  • JDBC URL: jdbc:postgresql://localhost:45432/syncboot_db
  • Verify Required Extensions:
    sql
    SELECT extname, extversion FROM pg_extension WHERE extname IN ('vector', 'uuid-ossp', 'pg_trgm');