Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This repository contains a Spring Boot implementation for application-level fiel

**IMPORTANT DISCLAIMER**: **NOT PRODUCTION GRADE**

## Solution Summary
## Summary

The application protects sensitive fields before they are persisted by combining the following controls:

Expand All @@ -17,7 +17,7 @@ The application protects sensitive fields before they are persisted by combining
## Technology Stack

- Java 21
- Spring Boot 3.3.4
- Spring Boot 3.5.x
- Maven
- PostgreSQL
- HashiCorp Vault
Expand All @@ -28,14 +28,13 @@ The application protects sensitive fields before they are persisted by combining

Key top-level paths:

- `src/main/java/dev/wackydevelopers/encryption/`: application source code
- `src/test/java/dev/wackydevelopers/encryption/`: unit, integration, and e2e tests
- `db/`: database migration assets and validation scripts
- `src/main/`: application source code
- `src/test/`: unit, integration, and e2e tests
- `vault/`: Vault bootstrap assets and validation scripts
- `docs/`: runbooks and supporting documentation
- `postman/`: Postman collection and environment files

## Architecture Diagram
## Architecture

The following high-level view shows the main runtime components and trust boundaries:

Expand All @@ -59,7 +58,7 @@ The primary local workflow is documented in [docs/local-development-workflow.md]

Typical prerequisites:

- Docker with Compose plugin
- Docker/podman with Compose plugin
- Java 21 or later
- Maven 3.9 or later

Expand Down Expand Up @@ -130,9 +129,11 @@ This repository currently emphasizes implementation and validation of:
- Vault bootstrap and startup resilience behavior
- key rotation workflows and contract validation

The implementation **IS NOT PRODUCTION GRADE** but only a showcase. **DO NOT USE IN PRODUCTION** UNLESS REVIEWED AND VETTED
The implementation **IS NOT PRODUCTION GRADE** but only a showcase. **DO NOT USE IN PRODUCTION** UNLESS REVIEWED AND VETTED.

Other than that, enjoy your stay and *you can checkout any time you like...*.
If this repo helps you in any chance, target achieved!

Cheers, and remember, *the bards' songs will remain*.

PS: Did I mention that this is **NOT BATTLE-TESTED & PRODUCTION READY**?
32 changes: 0 additions & 32 deletions config/application-vault-example.yml

This file was deleted.

50 changes: 12 additions & 38 deletions docs/local-development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,34 @@ This runbook defines the primary Docker-based local setup and the fallback workf

## Prerequisites

Run prerequisite checks:

```bash
bash scripts/check-prerequisites.sh
```

Expected tools:

- Docker with Compose plugin
- Java 21+
- Maven 3.9+

Ensure scripts are executable:

```bash
chmod +x scripts/*.sh db/tests/*.sh vault/tests/*.sh tests/*.sh
```

## Primary Workflow (Docker Compose)

1. Start local stack and run Vault bootstrap:

```bash
bash scripts/start-local.sh
docker compose up -d postgres vault
```

1. Confirm services:
2. Confirm services:

```bash
docker compose ps
```

3. Initialise vault:

```bash
docker compose run --rm vault-init
```

Check logs to get the AppRole `role-id` and generated `secret-id`. These are necessary environment variables (`VAULT_ROLE_ID` & `VAULT_SECRET_ID`) for the application to start.

1. Access endpoints:

- PostgreSQL: localhost:5432
Expand All @@ -51,37 +47,15 @@ Use fallback only when Docker Compose cannot be used in the current environment.
1. Run API in in-memory mode:

```bash
bash scripts/start-local-fallback.sh
mvn -q -DskipTests -Dspring-boot.run.profiles=inmemory spring-boot:run
```

1. Validate API health:
2. Validate API health:

```bash
curl http://localhost:8080/actuator/health
```

## Troubleshooting

1. Docker daemon not running:

- Start Docker Desktop or daemon service.
- Re-run `bash scripts/check-prerequisites.sh`.

1. Vault init fails:

- Check Vault container logs: docker compose logs vault
- Re-run bootstrap: docker compose run --rm vault-init

1. Port conflicts:

- Check listeners on 5432/8200/8080 and free conflicting processes.
- Override mapped ports in docker-compose.yml if needed.

1. Fallback startup fails:

- Verify Java and Maven paths.
- Run `mvn -q test` first to ensure project compiles.

## Exit and Cleanup

Stop and remove services:
Expand Down
19 changes: 10 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.boot.version>3.3.4</spring.boot.version>
<flyway.version>10.20.1</flyway.version>
<jackson.version>2.17.2</jackson.version>
<junit.jupiter.version>5.11.0</junit.jupiter.version>
<testcontainers.version>1.20.4</testcontainers.version>
<postgresql.version>42.7.4</postgresql.version>
<spring.boot.version>3.5.13</spring.boot.version>
<flyway.version>11.7.2</flyway.version>
<jackson.version>2.21.2</jackson.version>
<jackson.annotations.version>2.21</jackson.annotations.version>
<junit.jupiter.version>5.12.2</junit.jupiter.version>
<testcontainers.version>1.21.4</testcontainers.version>
<postgresql.version>42.7.10</postgresql.version>
<h2.version>2.3.232</h2.version>
<slf4j.version>2.0.16</slf4j.version>
<maven.surefire.plugin.version>3.3.1</maven.surefire.plugin.version>
<slf4j.version>2.0.17</slf4j.version>
<maven.surefire.plugin.version>3.5.5</maven.surefire.plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -111,7 +112,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
<version>${jackson.annotations.version}</version>
</dependency>

<dependency>
Expand Down
Loading