Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d5e99bd
task: upgrade to sbt 2
hohonuuli Jun 21, 2026
8b9f02d
Starting implementation
hohonuuli Jun 21, 2026
96c9ced
fix: everything compiles
hohonuuli Jun 21, 2026
80eca5e
fix: FfmpegUtil captures either jpg or png now
hohonuuli Jun 21, 2026
8a46638
fix: sbt 2 puts video into the test jar file; where ffmpeg can't read…
hohonuuli Jun 21, 2026
074f47d
task: add imageType as a key for looking up images froom tthe cache
hohonuuli Jun 21, 2026
d56c7ab
task: added tests for png and mixed jpg/png use in the image cache
hohonuuli Jun 21, 2026
277d04f
task: update docs to current Scala 3.8.4
hohonuuli Jun 21, 2026
675925e
task: add /capture/jpg and /capture/png to endpoints
hohonuuli Jun 21, 2026
68ef565
fix: fixed typo in test.yml workflow
hohonuuli Jun 21, 2026
4f2f178
Potential fix for pull request finding
hohonuuli Jun 21, 2026
1d7e080
fix: docker packaging and nit in test util
hohonuuli Jun 21, 2026
63584bc
task: add additional unit tests for new endpoints. Add docs for new e…
hohonuuli Jun 21, 2026
7d26ee6
Merge branch 'task/add-png' of github.com:mbari-org/beholder into tas…
hohonuuli Jun 21, 2026
7d3e54a
task: add .scalafix.conf
hohonuuli Jun 21, 2026
65158e8
task: capture endpoint can accept imageType
hohonuuli Jun 22, 2026
1b37336
Fix CORS handler to allow all origins
Copilot Jun 22, 2026
81df50a
task: update CORS
hohonuuli Jun 22, 2026
aeb3f75
task: add test for /capture with imagetypes
hohonuuli Jun 22, 2026
9561222
fix: Add evictionOrder to ImageType for rare case of same created, UR…
hohonuuli Jun 22, 2026
a70340d
fix: fix nits with creation date
hohonuuli Jun 22, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Upload site
uses: actions/upload-pages-artifact@v1.0.1
with:
path: target/scala-3.8.2/api
path: target/scala-3.8.4/api

publish_docs:
needs: generate_docs
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
Expand All @@ -26,9 +28,14 @@ jobs:
- name: Package and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_TAG: ${{ github.ref_name }}
run: |
sbt 'Docker / stage'
cd target/docker/stage
STAGE_DIR=$(find target -name "Dockerfile" -not -path "*/streams/*" | head -1 | xargs dirname)
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
Comment thread
hohonuuli marked this conversation as resolved.
Resolved
docker buildx create --name dockerbuilder --platform linux/amd64,linux/arm64 --use
docker buildx build --platform linux/amd64,linux/arm64 -t mbari/beholder:${{ github.ref_name }} -t mbari/beholder:latest --push .
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t mbari/beholder:${IMAGE_TAG} \
-t mbari/beholder:latest \
--push "$STAGE_DIR"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: "2"
java-version: "25"
distribution: "temurin"
cache: "sbt"
- name: Setup sbt launcher
Expand Down
9 changes: 9 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rules = [
OrganizeImports
]
OrganizeImports {
expandRelative = true
groupedImports = Merge
}
OrganizeImports.targetDialect = Scala3
OrganizeImports.removeUnused = true
156 changes: 78 additions & 78 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import com.typesafe.sbt.packager.docker.CmdLike
import com.typesafe.sbt.packager.docker.ExecCmd
import com.typesafe.sbt.packager.docker.Cmd
import Dependencies._
import Dependencies.*

Docker / maintainer := "Brian Schlining <brian@mbari.org>"
Docker / packageName := "mbari/beholder"
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / licenses := Seq(("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")))
ThisBuild / organization := "org.mbari"
ThisBuild / organizationName := "MBARI"
ThisBuild / scalaVersion := "3.8.2"
ThisBuild / startYear := Some(2022)
ThisBuild / versionScheme := Some("semver-spec")
licenses := Seq(("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")))
organization := "org.mbari"
organizationName := "MBARI"
scalaVersion := "3.8.4"
startYear := Some(2022)
versionScheme := Some("semver-spec")
semanticdbEnabled := true
semanticdbVersion := scalafixSemanticdb.revision

Test / testOptions ++= Seq(
Tests.Argument(TestFrameworks.MUnit, "--log=debug")
)

Compile / doc / scalacOptions ++= Seq(
"-groups",
Expand All @@ -23,85 +29,79 @@ Compile / doc / scalacOptions ++= Seq(
"./src/docs/index.md"
)


// Hack to get the apt-get command in the right place in the docker file
// Inserts apt-get before user is changed to non-root
def buildDocker(cmds: Seq[CmdLike]): Seq[CmdLike] = {
val idx = cmds.indexWhere(_ match {
case Cmd("USER", user) => user != "root"
case _ => false
})
cmds.take(idx) ++
Seq(Cmd("RUN", "apt-get update && apt-get install -y ffmpeg")) ++
cmds.drop(idx)
}
def buildDocker(cmds: Seq[CmdLike]): Seq[CmdLike] =
val idx = cmds.indexWhere(_ match
case Cmd("USER", user) => user != "root"
case _ => false
)
cmds.take(idx) ++
Seq(Cmd("RUN", "apt-get update && apt-get install -y ffmpeg")) ++
cmds.drop(idx)

lazy val root = project
.in(file("."))
.enablePlugins(
AutomateHeaderPlugin,
GitBranchPrompt,
GitVersioning,
JavaAppPackaging)
.settings(
name := "beholder",
dockerBaseImage := "eclipse-temurin:25",
dockerCommands := buildDocker(dockerCommands.value),
dockerEntrypoint := Seq("/opt/docker/bin/beholder", "/opt/beholder/cache"),
dockerExposedPorts := Seq(8080),
dockerExposedVolumes := Seq("/opt/beholder/cache"),
dockerRepository := Some("mbari"),
dockerUpdateLatest := true,
// Set version based on git tag. I use "0.0.0" format (no leading "v", which is the default)
// Use `show gitCurrentTags` in sbt to update/see the tags
git.gitTagToVersionNumber := { tag: String =>
if(tag matches "[0-9]+\\..*") Some(tag)
else None
},
git.useGitDescribe := true,
// sbt-header
javacOptions ++= Seq("-target", "25", "-source", "25"),
libraryDependencies ++= Seq(
auth0,
auth0jwk,
circeCore,
circeGeneric,
circeParser,
jansi % Runtime,
logback % Runtime,
methanol,
munit % Test,
picocli,
slf4jJdk % Runtime,
tapirStubServer % Test,
tapirSwagger,
tapirCirce,
tapirVertx,
typesafeConfig,
zio
),
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding",
"UTF-8", // yes, this is 2 args. Specify character encoding used by source files.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-indent",
"-rewrite",
"-unchecked"
.in(file("."))
.enablePlugins(AutomateHeaderPlugin, GitBranchPrompt, GitVersioning, JavaAppPackaging)
.settings(
name := "beholder",
dockerBaseImage := "eclipse-temurin:25",
dockerCommands := buildDocker(dockerCommands.value),
dockerEntrypoint := Seq("/opt/docker/bin/beholder", "/opt/beholder/cache"),
dockerExposedPorts := Seq(8080),
dockerExposedVolumes := Seq("/opt/beholder/cache"),
dockerRepository := Some("mbari"),
dockerUpdateLatest := true,
// Set version based on git tag. I use "0.0.0" format (no leading "v", which is the default)
// Use `show gitCurrentTags` in sbt to update/see the tags
git.gitTagToVersionNumber := { (gitTag: String) =>
if gitTag.matches("[0-9]+\\..*") then Some(gitTag)
else None
},
git.useGitDescribe := true,
// sbt-header
javacOptions ++= Seq("-target", "25", "-source", "25"),
libraryDependencies ++= Seq(
auth0,
auth0jwk,
circeCore,
circeGeneric,
circeParser,
jansi % Runtime,
logback % Runtime,
methanol,
munit % Test,
picocli,
slf4jJdk % Runtime,
tapirStubServer % Test,
tapirSwagger,
tapirCirce,
tapirVertx,
typesafeConfig,
zio
),
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding",
"UTF-8", // yes, this is 2 args. Specify character encoding used by source files.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-indent",
"-rewrite",
"-unchecked",
"-Wunused:imports" // Warn if an import selector is not referenced.
)
)
)

// https://stackoverflow.com/questions/22772812/using-sbt-native-packager-how-can-i-simply-prepend-a-directory-to-my-bash-scrip
bashScriptExtraDefines ++= Seq(
"""addJava "-Dconfig.file=${app_home}/../conf/application.conf"""",
"""addJava "-Dlogback.configurationFile=${app_home}/../conf/logback.xml""""
"""addJava "-Dconfig.file=${app_home}/../conf/application.conf"""",
"""addJava "-Dlogback.configurationFile=${app_home}/../conf/logback.xml""""
)
batScriptExtraDefines ++= Seq(
"""call :add_java "-Dconfig.file=%APP_HOME%\conf\application.conf"""",
"""call :add_java "-Dlogback.configurationFile=%APP_HOME%\conf\logback.xml""""
"""call :add_java "-Dconfig.file=%APP_HOME%\conf\application.conf"""",
"""call :add_java "-Dlogback.configurationFile=%APP_HOME%\conf\logback.xml""""
)

16 changes: 13 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@ echo "--- Building beholder (reminder: run docker login first!!)"

ARCH=$(uname -m)
if [[ $ARCH == 'arm64' ]]; then
# Stage the Docker build context, then find where sbt put it.
# sbt 2.0 changed the staging directory from target/docker/stage to
# target/out/jvm/scala-X.Y.Z/<project>/docker/stage.
sbt 'Docker / stage'
cd $SCRIPT_DIR/target/docker/stage
VCS_REF=`git tag | sort -V | tail -1`
STAGE_DIR=$(find "$SCRIPT_DIR/target" -name "Dockerfile" -not -path "*/streams/*" | head -1 | xargs dirname)

if [[ -z "$STAGE_DIR" || ! -f "$STAGE_DIR/Dockerfile" ]]; then
echo "ERROR: could not locate Docker staging directory after 'Docker / stage'" >&2
exit 1
fi

cd "$STAGE_DIR"
VCS_REF=$(git -C "$SCRIPT_DIR" tag | sort -V | tail -1)
# https://betterprogramming.pub/how-to-actually-deploy-docker-images-built-on-a-m1-macs-with-apple-silicon-a35e39318e97
docker buildx build \
--platform linux/amd64,linux/arm64 \
Expand All @@ -17,4 +27,4 @@ if [[ $ARCH == 'arm64' ]]; then
&& docker pull mbari/beholder:latest
else
sbt 'Docker / publish'
fi
fi
24 changes: 11 additions & 13 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import sbt.*

object Dependencies {
object Dependencies:

lazy val auth0 = "com.auth0" % "java-jwt" % "4.5.1"
lazy val auth0jwk = "com.auth0" % "jwks-rsa" % "0.23.0"
private val circeVersion = "0.14.14"
lazy val auth0 = "com.auth0" % "java-jwt" % "4.5.2"
lazy val auth0jwk = "com.auth0" % "jwks-rsa" % "0.24.1"
private val circeVersion = "0.14.15"
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val jansi = "org.fusesource.jansi" % "jansi" % "2.4.2"
lazy val logback = "ch.qos.logback" % "logback-classic" % "1.5.32"
lazy val jansi = "org.fusesource.jansi" % "jansi" % "2.4.3"
lazy val logback = "ch.qos.logback" % "logback-classic" % "1.5.34"
lazy val methanol = "com.github.mizosoft.methanol" % "methanol" % "1.9.0"
lazy val munit = "org.scalameta" %% "munit" % "1.2.3"
lazy val munit = "org.scalameta" %% "munit" % "1.3.3"
lazy val picocli = "info.picocli" % "picocli" % "4.7.7"
lazy val slf4jVersion = "2.0.17"
lazy val slf4jVersion = "2.0.18"
lazy val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion
lazy val slf4jJul = "org.slf4j" % "jul-to-slf4j" % slf4jVersion
lazy val slf4jJdk = "org.slf4j" % "slf4j-jdk-platform-logging" % slf4jVersion
lazy val sttpCirceClient = "com.softwaremill.sttp.client3" %% "circe" % "3.11.0"
private val tapirVersion = "1.13.9"
private val tapirVersion = "1.13.23"
lazy val tapirStubServer = "com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % tapirVersion
lazy val tapirSwagger = "com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-bundle" % tapirVersion
lazy val tapirCirce = "com.softwaremill.sttp.tapir" %% "tapir-json-circe" % tapirVersion
lazy val tapirVertx = "com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % tapirVersion
lazy val typesafeConfig = "com.typesafe" % "config" % "1.4.6"
lazy val zio = "dev.zio" %% "zio" % "2.1.24"

}
lazy val typesafeConfig = "com.typesafe" % "config" % "1.4.9"
lazy val zio = "dev.zio" %% "zio" % "2.1.26"
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.12.4
sbt.version=2.0.0
12 changes: 6 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.7")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0")
addSbtPlugin("com.github.sbt" % "sbt-header" % "5.11.0")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.7")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.7.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")
1 change: 1 addition & 0 deletions src/main/scala/org/mbari/beholder/AppConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.mbari.beholder

import com.typesafe.config.ConfigFactory

import scala.util.Try

object AppConfig:
Expand Down
Loading
Loading