Skip to content

feat(examples): Add pocketbase0.40-go1.27-base-distroless example - #346

Open
danieldyn wants to merge 2 commits into
unikraft:mainfrom
danieldyn:feat/add-pocketbase0.40-go1.27-base-distroless
Open

danieldyn wants to merge 2 commits into
unikraft:mainfrom
danieldyn:feat/add-pocketbase0.40-go1.27-base-distroless

Conversation

@danieldyn

Copy link
Copy Markdown

Description

Added a PocketBase0.40 Go1.27 backend system example using the distroless container image gcr.io/distroless/static-debian13, which is compatible with trixie and provides sufficient dependencies.

The README.md file contains instructions for building and running the example manually, as well as the list of dependencies that are covered by the chosen distroless image:

  • CA certificates (ca-certificates)
  • Timezone data (tzdata)
  • Standard /tmp and /etc directories

Automated Testing

The second commit of this PR contains a three-stage workflow to build and test this example via Github Actions:

  1. Measuring the rootfs size (resulting in 38MB)
  2. Scanning for vulnerabilities using Trivy (one found, but not relevant, see .trivyignore for more)
  3. Running in the background and testing REST API health endpoint and dashboard connectivity using curl

Notes

PocketBase configures SQLite to use Write-Ahead Logging (WAL) mode for performance increase. Because it needs a shared memory (MAP_SHARED) file for this, the unikernel experienced Error 5386 SQLITE_IOERR_SHMMAP due to Unikraft's single-PVAS environment.

The fix for this was to "vendor" the PocketBase source code in the Docker build and replace journal_mode=WAL with journal_mode=DELETE using two sed commands (see Dockerfile for more).

Automated testing in CI/CD can only go as far as direct responses from curl, as the backend system is far more complex. In the README.md file, I attached the full description of how to access the "superuser" account and properly use the app at its full potential, while running as a unikernel.

Use static-debian13 distroless image for full compatibility
with trixie build. It also includes CA certificates, timezone
data and /etc and /tmp directories.

Additionally, use SHA digest for distroless image.

Signed-off-by: Daniel-Ioan Dinu <daniel_dinu30@yahoo.com>
… system example

- Measure root file system size using du -h
- Scan for vulnerabilities using Trivy
- Run in background and test connectivity and REST API health using curl

Additionally, document one unresolved CVE to .trivyignore.

Signed-off-by: Daniel-Ioan Dinu <daniel_dinu30@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant