Skip to content

A slim JRE and yew-rs setup to deploy your custom MAL list

License

Notifications You must be signed in to change notification settings

deomorxsy/meuCafeList

Repository files navigation

meuCafeList

slimjre wasm-yew

Featuring:

  • Alpine as OCI container distro;
  • corretto-22 as JRE;
  • Symbol stripping with jlink;
  • Multi-stage builds to avoid container layer bloat.
  • TDD (Test-Driven-Development) is implemented on build on a layer that will be discarded from the final production image, which will contain the artifact.
  • yew-rs serving wasm with trunk/wasm-packer

Usage

  1. clone repository with SSH and enter directory
git clone git@github.com:deomorxsy/meuCafeList.git
cd ./meuCafeList/
  1. Build with make build

  2. Test with make test

  3. Run/Stop the app: make up/down

Scaffolding

  1. make scaff to run setup.sh and generate a similar project directory structure

Deployment

This repository uses Github Actions for Continuous Integration. Similar to how to run manually, the yaml script calls Makefile, which calls compose.yml, which runs the containers based on the specific Dockerfile context. It consists in three containers:

  • server: the SpringBoot application on a slim JRE with amazon-corretto and the Alpine distro.
  • client: the Yew application frontend on a slim Rust environment. This multi-stage build was inspired by codefeetime's article.
  • nginx as web server, reverse proxy, etc.

compose (+ Podman Service)

Compose concentrates in orchestrating multiple containers in a single host. To do this with k8s, you would need kind, minikube, k3s (does not use virtualization) or similar. It was made to be compatible with other OCI runtimes, such as Podman, which was one of the first to enable rootless containers, and can be setup with compose using the Podman Service's systemd unit file for unix sockets.

The orchestration tool docker-compose supports Podman Service through the DOCKER_HOST environment variable. This makes it possible to run containers with podman but with the benefit of rootless.

Source the script and run it to run compose with podman, or just put a make up. XD

; source ./scripts/ccr.sh; checker

k8s

Kubernetes is a container orchestrator that have a YAML syntax similar to the CI deployment from this repo. To run this project on single host just like the Compose tool, you can use tools like kind or minikube in a full-virtualized environment or k3s which don't use full-virtualization. The cluster setup such as ingress and egress will not be covered here.

; kubectl apply -f ./deploy.yml