Sign inSign up

sinups/layers-preview

By sinups

Updated 5 months ago

Preview/storyboard worker for self-hosted Layers installations

Image
0

300

sinups/layers-preview repository overview

layers-preview

Worker service that generates previews/storyboards for video attachments — an optional App Store module for self-hosted Layers installations.

It connects to the same Postgres DB as the core server (hissih/layers) and writes storyboard artifacts into the same shared volume, so the core server can serve:

  • /v1/storyboards/attachment/<attachmentId>/index.vtt
  • /v1/storyboards/attachment/<attachmentId>/meta.json
  • /v1/storyboards/attachment/<attachmentId>/sheet_<N>.jpg

Docker image

  • sinups/layers-preview:<version> — pinned semver (e.g. 1.0.3)
  • sinups/layers-preview:latest — rolling tag, rebuilt on every push to main

All tags are multi-arch manifest lists (linux/amd64 + linux/arm64), so Apple Silicon and Graviton hosts run natively without QEMU emulation.

Env contract (same as core hissih/layers)

A single set of credentials powers core + every plugin. The module reads:

VariableRequiredDescription
DB_SERVER_URLyesJDBC URL for the core Postgres (e.g. jdbc:postgresql://db:5432/layersdb).
DB_SERVER_USERNAMEyesDB user — same one core uses.
DB_SERVER_PASSWORDyesDB password.
PREVIEW_ADMIN_BINDno (default 127.0.0.1)Bind address for the worker's admin port. Use 0.0.0.0 inside Docker.
PREVIEW_ADMIN_PORTno (default 8082)Admin port.
USE_AWSnoSet true to upload storyboards to S3.
S3_BUCKET_NAME, S3_ACCESS_KEY, S3_SECRET_KEYif USE_AWS=trueS3 target.

Legacy SPRING_DATASOURCE_URL / SPRING_DATASOURCE_USERNAME / SPRING_DATASOURCE_PASSWORD are still accepted as a fallback for pre-1.0.3 installs — but new installs should use the unified DB_SERVER_* names.

Drop-in docker-compose (core + preview)

Add this stanza to the core stack's docker-compose.yml:

services:
  preview:
    image: sinups/layers-preview:latest
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    environment:
      # Same three vars the core app already has — no duplication.
      DB_SERVER_URL: ${DB_SERVER_URL}
      DB_SERVER_USERNAME: ${DB_SERVER_USERNAME}
      DB_SERVER_PASSWORD: ${DB_SERVER_PASSWORD}
      PREVIEW_ADMIN_BIND: 0.0.0.0
    volumes:
      # Shared with core so generated storyboards are visible to both.
      - layers_data:/opt/maker/java-maker/uploaded-files

Then:

docker compose pull preview && docker compose up -d preview

Standalone docker run

docker run --rm \
  -e DB_SERVER_URL='jdbc:postgresql://db:5432/layersdb' \
  -e DB_SERVER_USERNAME='layers' \
  -e DB_SERVER_PASSWORD='changeme' \
  -e PREVIEW_ADMIN_BIND=0.0.0.0 \
  -v layers_data:/opt/maker/java-maker/uploaded-files \
  --network layers-default \
  sinups/layers-preview:latest

Build (contributors)

This repo depends on com.layers:layers-shared:1.0.0.

cd ../layers-shared && mvn -q -DskipTests install
cd ../layers-preview && ./mvnw -q -DskipTests package

Notes / limitations

  • The worker runs with spring.main.web-application-type=none (no web UI).
  • In a multi-node core cluster, storyboards can become inconsistent if each node uses a different local filesystem. If you cannot share the uploaded-files volume across nodes, enable shared S3 storage:
    • layers-preview uploads storyboards to S3 (best-effort).
    • Core server can serve /v1/storyboards/** from S3 when local files are missing (server profile, behind the same flag).

Tag summary

Content type

Image

Digest

sha256:010d39ad6

Size

959.5 MB

Last updated

5 months ago

docker pull sinups/layers-preview