diff --git a/.gitignore b/.gitignore index f328e6b..55ee0ec 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,6 @@ bin/ ### OpenAPI ### legalconsenthub/.api-client legalconsenthub/.api-client-middleware + +### PostgreSQL persistent data ### +legalconsenthub-backend/postgres-data/ diff --git a/.run/local-server-backend-postgres.run.xml b/.run/local-server-backend-postgres.run.xml new file mode 100644 index 0000000..2517fa6 --- /dev/null +++ b/.run/local-server-backend-postgres.run.xml @@ -0,0 +1,13 @@ + + + + diff --git a/.run/local-server-backend-testcontainers.run.xml b/.run/local-server-backend-testcontainers.run.xml new file mode 100644 index 0000000..75e97d9 --- /dev/null +++ b/.run/local-server-backend-testcontainers.run.xml @@ -0,0 +1,13 @@ + + + + diff --git a/legalconsenthub-backend/docker-compose.yml b/legalconsenthub-backend/docker-compose.yml new file mode 100644 index 0000000..7762883 --- /dev/null +++ b/legalconsenthub-backend/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + postgres: + image: postgres:17-alpine + container_name: legalconsenthub-postgres + environment: + POSTGRES_DB: legalconsenthub + POSTGRES_USER: legalconsenthub + POSTGRES_PASSWORD: legalconsenthub + ports: + - "5432:5432" + volumes: + - ./postgres-data:/var/lib/postgresql/data + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U legalconsenthub -d legalconsenthub"] + interval: 10s + timeout: 5s + retries: 5 diff --git a/legalconsenthub-backend/src/main/resources/application-postgres.yaml b/legalconsenthub-backend/src/main/resources/application-postgres.yaml new file mode 100644 index 0000000..40884c9 --- /dev/null +++ b/legalconsenthub-backend/src/main/resources/application-postgres.yaml @@ -0,0 +1,41 @@ +spring: + application: + name: legalconsenthub + + datasource: + hikari: + auto-commit: false + url: jdbc:postgresql://localhost:5432/legalconsenthub + username: legalconsenthub + password: legalconsenthub + driver-class-name: org.postgresql.Driver + + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + hibernate: + ddl-auto: validate + show-sql: true + properties: + hibernate: + format_sql: true + jdbc: + batch_size: 100 + order_inserts: true + enable_lazy_load_no_trans: true + + liquibase: + enabled: true + drop-first: false + change-log: classpath:/db/changelog/db.changelog-master.yaml + default-schema: public + + sql: + init: + platform: postgresql + +logging: + level: + org: + springframework: + security: TRACE + oauth2: TRACE diff --git a/legalconsenthub-backend/src/main/resources/testcontainers.properties b/legalconsenthub-backend/src/main/resources/testcontainers.properties new file mode 100644 index 0000000..f0e6e42 --- /dev/null +++ b/legalconsenthub-backend/src/main/resources/testcontainers.properties @@ -0,0 +1 @@ +testcontainers.reuse.enable=true