Add rendered example

This commit is contained in:
Daniel Berteaud 2024-01-13 14:42:09 +01:00
parent a981387910
commit a2232aa0b7
5 changed files with 118 additions and 0 deletions

3
example/README.md Normal file
View File

@ -0,0 +1,3 @@
# boardgame-manager
Boardgame Manager from Oscar https://github.com/oscgr/eht-boardgame-manager

View File

@ -0,0 +1,77 @@
job "boardgame-manager" {
datacenters = ["dc1"]
group "boardgame-manager" {
network {
mode = "bridge"
}
service {
name = "boardgame-manager"
port = 8080
connect {
sidecar_service {
}
sidecar_task {
resources {
cpu = 50
memory = 64
}
}
}
tags = [
"traefik.enable=true",
"traefik.http.routers.boardgame-manager.rule=Host(`bgm.example.org`)",
"traefik.http.routers.boardgame-manager.entrypoints=https",
"traefik.http.routers.boardgame-manager.tls=true",
"traefik.http.middlewares.boardgame-manager-csp.headers.contentSecurityPolicy=default-src 'self'; img-src 'self' data: https://www.gravatar.com; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; font-src 'self' data:",
"traefik.http.routers.boardgame-manager.middlewares=boardgame-manager-csp,rate-limit-std@file,inflight-std@file,security-headers@file,hsts@file,compression@file,csp-relaxed@file",
]
}
volume "data" {
type = "csi"
source = "bgm-data"
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
task "boardgame-manager" {
driver = "docker"
config {
image = "danielberteaud/boardgame-manager:24.1-1"
pids_limit = 100
readonly_rootfs = true
}
env {
LANG = "fr_FR.utf8"
TZ = "Europe/Paris"
}
volume_mount {
volume = "data"
destination = "/opt/bgm/databases"
}
resources {
cpu = 20
memory = 192
}
}
}
}

View File

@ -0,0 +1,3 @@
Kind = "service-defaults"
Name = "boardgame-manager"
Protocol = "http"

View File

@ -0,0 +1,15 @@
Kind = "service-intentions"
Name = "boardgame-manager"
Sources = [
{
Name = "traefik"
Permissions = [
{
Action = "allow"
HTTP {
PathPrefix = "/"
}
}
]
}
]

View File

@ -0,0 +1,20 @@
FROM danielberteaud/alma:9.24.1-3
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
RUN set -eux &&\
rpm -qa --qf "%{NAME}\n" | sort > /tmp/before.txt &&\
dnf -y install git npm unzip &&\
rpm -qa --qf "%{NAME}\n" | sort > /tmp/after.txt &&\
curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash &&\
cd /opt/ &&\
git clone --depth=1 https://github.com/oscgr/eht-boardgame-manager.git bgm &&\
cd bgm &&\
bun install &&\
npm install sqlite3 --save &&\
dnf -y remove $(comm -13 /tmp/before.txt /tmp/after.txt) &&\
dnf clean all &&\
rm -rf /var/cache/yum/* /var/log/yum/* /tmp/before.txt /tmp/after.txt /var/lib/dnf/history*
EXPOSE 8080
WORKDIR /opt/bgm
CMD ["bun", "start"]