Skip to content

tarilabs/demo20220831-edgepos

Repository files navigation

demo20220831-edgepos Project

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . The GUI embedded in this repo is coming from this sibling project: https://github.com/tarilabs/demo20220831-edgepos-ui

Notes

used https://code.quarkus.redhat.com/?g=org.drools.hackfest2022&a=demo20220831-edgepos&e=resteasy-jackson&e=smallrye-openapi&e=kubernetes&e=container-image-jib&e=org.kie.kogito%3Akogito-quarkus-rules&extension-search=origin:platform%20DRL

pushing to Quay.io with

mvn clean install install -Dquarkus.container-image.push=true

Quick start

Install podman and ensure date(time) is setup correctly:

Fedora:

typically Podman is already installed, in case:

sudo dnf install podman
date

Debian-based:

sudo apt-get install podman
date

Launch application:

Then, launch this Drools+Quarkus application from a container image from quay.io registry

podman pull quay.io/mmortari/demo20220831-edgepos:1.0.0-SNAPSHOT
podman run -i --rm -p 8080:8080 quay.io/mmortari/demo20220831-edgepos:1.0.0-SNAPSHOT

Configuring a Fedora box:

Configuring podman and systemd (manually)

sudo systemctl enable podman-auto-update.service

podman run --name app1 -d --label "io.containers.autoupdate=registry" --rm -p 8080:8080 quay.io/mmortari/demo20220831-edgepos:1.0.0-SNAPSHOT
podman generate systemd --new app1 -n > ~/.config/systemd/user/app1.service
systemctl --user daemon-reload
systemctl --user enable app1.service
systemctl --user start app1.service
systemctl --user status app1.service

Systemd files

~/.config/systemd/user/app1.service:

# container-app1.service
# autogenerated by Podman 4.3.1
# Thu Feb  9 18:48:26 CET 2023

[Unit]
Description=Podman container-app1.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm \
	-f %t/%n.ctr-id
ExecStart=/usr/bin/podman run \
	--cidfile=%t/%n.ctr-id \
	--cgroups=no-conmon \
	--rm \
	--sdnotify=conmon \
	--replace \
	--name app1 \
	-d \
	--label io.containers.autoupdate=registry \
	-p 8080:8080 quay.io/mmortari/demo20220831-edgepos:1.0.0-SNAPSHOT
ExecStop=/usr/bin/podman stop \
	--ignore -t 10 \
	--cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
	-f \
	--ignore -t 10 \
	--cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target

also,

~/.config/systemd/user/gui.service:

[Unit]
Description=Service running firefox
After=network.target app1.service

[Service]
Type=simple
Environment="DISPLAY=:0"
ExecStart=/usr/bin/firefox --kiosk http://localhost:8080
Restart=on-failure
RestartSec=1
TimeoutSec=60
RuntimeMaxSec=infinity

[Install]
WantedBy=default.target

Ansible

Using Ansible as an alternative, to automatically configure the edge pos boxes.

Ensure on the controller machine there is an host file inside inventory/, something ~like:

fedora.local ansible_ssh_user=your_ssh_user_here

Especially on Mac OSX, to avoid the need of sshpass on the controller, simply copy pub key to the host(s), for example via

ssh-copy-id -i $HOME/.ssh/id_rsa.pub [email protected]

Update and Configure devices using Ansible:

ansible all --list-hosts -i inventory
ansible all -i inventory -m ping
ansible-playbook -i inventory --ask-become-pass playbook_prereq.yml
ansible-playbook -i inventory playbook.yml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published