Experiments with the RSTM Framework and Docker
  • Java 70%
  • HTML 29.2%
  • Dockerfile 0.8%
Find a file
Philip Oswald a370b2b9eb
All checks were successful
/ ci-build (push) Successful in 25s
Upgrade record-builder, supports Java 25
2026-01-28 22:07:09 +01:00
.forgejo/workflows Add workflow_dispatch to Forgejo Actions 2026-01-28 21:51:31 +01:00
src Add OpenAPI 2026-01-14 23:16:16 +01:00
.gitignore Ignore IntelliJ project files 2025-12-28 21:05:44 +01:00
LICENSE Create simple application (incomplete) 2023-02-13 01:31:59 +01:00
pom.xml Upgrade record-builder, supports Java 25 2026-01-28 22:07:09 +01:00
README.md Use application/xml instead of text/xml 2026-01-08 22:51:16 +01:00
renovate.json Add renovate.json 2023-09-20 21:51:42 +02:00

sample-rstm

Experiments with the RSTM (Really Simple & Totally Minimalistic) Framework and Docker, featuring:

  • Static web content
  • Dynamic web content
  • REST endpoints
  • Postgres or H2 database using JDBC
  • Playwright for UI testing

Run Standalone

$ mvn clean verify
$ mvn clean verify -Dtest.ui
$ export APP_SAMPLE_CONFIG=ValueFromShell
$ java \
  -cp $(echo target/sample-rstm-*-dist/lib)/"*" \
  -Dapp.http.port=8080 \
  -Dapp.jdbc.url=jdbc:h2:./databases/task-db \
  com.github.phoswald.sample.Application
$ java \
  -cp $(echo target/sample-rstm-*-dist/lib)/"*" \
  -Dapp.http.port=8080 \
  -Dapp.jdbc.url=jdbc:postgresql://localhost:5432/mydb \
  -Dapp.jdbc.username=myuser \
  -Dapp.jdbc.password=mypassword \
  -Dapp.jwt.issuer=http://localhost:8080 \
  -Dapp.jwt.secret=mysecretforhmac \
  com.github.phoswald.sample.Application

Run with Docker

$ mvn clean verify -P docker
$ docker run -it --name sample-rstm --rm \
  -p 8080:8080 \
  -e APP_SAMPLE_CONFIG=ValueFromDockerRun \
  -e APP_JDBC_URL=jdbc:h2:/databases/task-db \
  -v ./databases/:/databases \
  philip/sample-rstm:0.1.0-SNAPSHOT
$ docker run -it --name sample-rstm --rm \
  -p 8080:8080 \
  -e APP_SAMPLE_CONFIG=ValueFromDockerRun \
  -e APP_JDBC_URL=jdbc:postgresql://surin.home:5432/mydb \
  -e APP_JDBC_USERNAME=myuser \
  -e APP_JDBC_PASSWORD=mypassword \
  -e APP_JWT_ISSUER=http://localhost:8080 \
  -e APP_JWT_SECRET=mysecretforhmac \
  philip/sample-rstm:0.1.0-SNAPSHOT

URLs

$ curl 'http://localhost:8080/app/rest/sample/time' -i
$ curl 'http://localhost:8080/app/rest/sample/config' -i
$ curl 'http://localhost:8080/app/rest/sample/echo-xml' -i -X POST \
  -H 'content-type: application/xml' \
  -d '<echoRequest><input>This is CURL</input></echoRequest>'
$ curl 'http://localhost:8080/app/rest/sample/echo-json' -i -X POST \
  -H 'content-type: application/json' \
  -d '{"input":"This is CURL"}'
$ curl 'http://localhost:8080/app/rest/tasks' -i
$ curl 'http://localhost:8080/app/rest/tasks' -i -X POST \
  -H 'content-type: application/json' \
  -d '{"title":"Some task","description":"This is CURL","done":true}'
$ curl 'http://localhost:8080/app/rest/tasks/5b89f266-c566-4d1f-8545-451bc443cf26' -i
$ curl 'http://localhost:8080/app/rest/tasks/5b89f266-c566-4d1f-8545-451bc443cf26' -i -X PUT \
  -H 'content-type: application/json' \
  -d '{"title":"Some updated task","description":"This is still CURL","done":false}'
$ curl 'http://localhost:8080/app/rest/tasks/5b89f266-c566-4d1f-8545-451bc443cf26' -i -X DELETE

Database:

See SQL DDL for Postgres and H2.

Start H2 Console in current directory (use JDBC URL with relative path, log in with sa:sa):

$ java -jar target/sample-rstm-*-dist/lib/h2-*.jar

Create passwords for form-based authentication (table user_):

$ java -cp $(echo target/sample-rstm-*-dist/lib)/"*" \
  com.github.phoswald.rstm.security.password.PasswordUtility