Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3839d8d
docker: reduce common statements, separate concerns
Louwrensth Jul 5, 2026
b210f03
docker: separate server-http config
Louwrensth Jul 5, 2026
50ca09b
docker: rename location snippets
Louwrensth Jul 5, 2026
9569da3
docker: add server-https config
Louwrensth Jul 5, 2026
5b86009
docker: add http redirect to https
Louwrensth Jul 6, 2026
1286eb4
make: add USE_HTTPS=1 switch, update docs
Louwrensth Jul 5, 2026
0f79db5
docker: add nginx/ssl cert.* generation
Louwrensth Jul 6, 2026
a5029c1
docker: merge stage service-https into service
Louwrensth Jul 6, 2026
7991af1
docs: mention scripts/generate-self-signed-certs.sh
Louwrensth Jul 28, 2026
92dc37b
systemd: service using compose override
Louwrensth Jul 29, 2026
04e0ceb
mv docker-compose.https.yml
Louwrensth Aug 7, 2026
5715458
mv .github/workflows/ci.yml
Louwrensth Aug 7, 2026
cf1b8ba
update CODEOWNERS
Louwrensth Aug 7, 2026
e305deb
.dockerignore: ignore some more
Louwrensth Aug 7, 2026
dbc3636
add env file for systemd service
Louwrensth Aug 7, 2026
552ba23
systemd: simplify Makefile
Louwrensth Aug 7, 2026
b512dc5
generate-self-signed-certs.sh: add x.509 extension and SAN
Louwrensth Aug 7, 2026
5ef4b92
add more logging
Louwrensth Aug 7, 2026
2bb577c
systemd: use DASHBOARD_CONTAINER_NAME, SIMDB_DASHBOARD_IMAGE
Louwrensth Aug 7, 2026
81bd9eb
nginx: listen ... http2 directive is deprecated
Louwrensth Aug 7, 2026
9fb1237
systemd: latest tag by default, howto using make
Louwrensth Aug 14, 2026
dc61e5a
ci: tag and push "latest", create release with tarball asset
Louwrensth Aug 14, 2026
19a156c
Makefile: use conventional install command
Louwrensth Aug 14, 2026
9bb3e3f
fixup! systemd: latest tag by default, howto using make
Louwrensth Aug 17, 2026
bef7350
nginx: use gzip_static assets with cache-control
Louwrensth Aug 17, 2026
a8e8275
systemd: match description with Dockerfile
Louwrensth Aug 24, 2026
ab29434
certs: rootCA-signing; replace ssl->tls, sh->Makefile
Louwrensth Aug 31, 2026
a18006b
nginx: add FYI comment, remove double log output
Louwrensth Aug 31, 2026
0ad14d7
nginx: bugfix simdb backend at prefix /scenarios/api
Louwrensth Aug 31, 2026
8b6f1f9
fixup! systemd: simplify Makefile
Louwrensth Sep 9, 2026
f4e5fb4
nginx: document good directives for simdb application
Louwrensth Sep 11, 2026
cdf8f3d
docs: add systemd installation notes, align comments elsewhere
Louwrensth Sep 11, 2026
de869bb
Update help text from Makefile
olivhoenen Sep 14, 2026
4b6116f
ci: add GH_REPO to publish job
Louwrensth Sep 14, 2026
3c80f04
docker: fixup custom DASHBOARD_HTTPS_PORT
Louwrensth Sep 14, 2026
783a5c2
docker: SYSTEMD_CONTAINER_NAME
Louwrensth Sep 14, 2026
b7d5696
make systemd-*: prevent early abort
Louwrensth Sep 14, 2026
2ee96ec
make install: only intended key/pem files
Louwrensth Sep 14, 2026
9dd82d2
docker: service execution should --no-build
Louwrensth Sep 14, 2026
695e49c
make deploy: remove placeholder
Louwrensth Sep 14, 2026
624c63f
fixup! nginx: document good directives for simdb application
Louwrensth Sep 16, 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
12 changes: 9 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.git
.github
.vscode
dashboard/dist
dashboard/node_modules
dashboard/.vite
docker/nginx/ssl/*.crt
docker/nginx/ssl/*.key
docs
scripts
.env
.env.*
node_modules
dashboard/node_modules
dashboard/dist
scripts
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# Do not edit unless specifically mandated to do so.

# Global/fallback and technical modifications.
* @SimonPinches @olivhoenen @prasad-sawantdesai
* @SimonPinches @olivhoenen @prasad-sawantdesai @Louwrensth
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: docker/setup-buildx-action@v4

# APP_VERSION is embedded into the static assets at build time
- name: Build build target image
- name: Build build image
uses: docker/build-push-action@v7
with:
target: build
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dist/
.idea/
dashboard/dist/
dashboard/node_modules/
.idea/
docker/nginx/ssl/*.crt
docker/nginx/ssl/*.key
dist/
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ ARG APP_VERSION=0.0.0-unknown
ENV SIMDB_SERVER_URL=/scenarios/api \
API_HOST=host.docker.internal \
API_PORT=5000 \
DASHBOARD_PORT=80
SERVER_CONF=server-http.conf
LABEL org.opencontainers.image.title="SimDB Dashboard" \
org.opencontainers.image.description="Web frontend for the SimDB simulation management tool" \
org.opencontainers.image.source="https://github.com/iterorganization/SimDB-Dashboard" \
org.opencontainers.image.licenses="LGPL-3.0-only" \
org.opencontainers.image.version="${APP_VERSION}" \
io.simdb.component="dashboard"
COPY docker/dashboard.nginx /etc/nginx/templates/default.conf.template
COPY docker/runtime-config-template.js /usr/share/nginx/html/runtime-config-template.js
COPY docker/nginx/templates/ /etc/nginx/templates/
COPY docker/nginx/entrypoint/ /docker-entrypoint.d/
COPY docker/nginx/ssl/ /etc/nginx/ssl/
RUN chmod +x /docker-entrypoint.d/*.sh
# App expects itself at urlpath /dashboard
COPY --from=build /app/dist /usr/share/nginx/html/dashboard
# NOTE: nginx base image already exposes port 80:
EXPOSE 80
# HTTPS service at port 443 (only utilized when SERVER_CONF=server-https.conf)
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]
111 changes: 105 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@ SHELL := /bin/sh

VERSION ?= $(shell git describe --tags --always 2>/dev/null || echo 0.0.0-unknown)
DASHBOARD_PORT ?= 80
COMPOSE_PROJECT_NAME ?= simdb-dashboard-$(DASHBOARD_PORT)
PROJECT_NAME ?= simdb-dashboard
COMPOSE_PROJECT_NAME ?= $(PROJECT_NAME)-$(DASHBOARD_PORT)

ifeq ($(USE_HTTPS),1)
DASHBOARD_HTTPS_PORT ?= 443
export DASHBOARD_HTTPS_PORT
COMPOSE_FILE ?= docker-compose.yml:docker-compose.https.yml
else
COMPOSE_FILE ?= docker-compose.yml
endif

# Used by docker-compose
export DASHBOARD_PORT
export COMPOSE_PROJECT_NAME

DOCKER_CMD ?= docker
DOCKER_BUILD ?= $(DOCKER_CMD) build --build-arg APP_VERSION="$(VERSION)"
DOCKER_COMPOSE ?= APP_VERSION="$(VERSION)" $(DOCKER_CMD) compose
DOCKER_COMPOSE ?= APP_VERSION="$(VERSION)" COMPOSE_FILE="$(COMPOSE_FILE)" $(DOCKER_CMD) compose

# systemd-install destinations
package_optdir ?= /opt/$(PROJECT_NAME)
package_etcdir ?= /etc/$(PROJECT_NAME)
systemd_unitdir ?= /etc/systemd/system

BUILD_IMAGE := simdb-dashboard:build
DEV_IMAGE := simdb-dashboard:dev
BUILD_IMAGE := simdb-dashboard:build
SERVICE_IMAGE := simdb-dashboard:service

.DEFAULT_GOAL := service

.PHONY: \
build \
builder \
clean-images \
deploy \
dev \
dist \
Expand All @@ -33,6 +47,15 @@ SERVICE_IMAGE := simdb-dashboard:service
logs-f \
service \
shell \
systemd-disable \
systemd-daemon-reload \
systemd-enable \
systemd-installdirs \
systemd-install \
systemd-status \
systemd-start \
systemd-stop \
systemd-uninstall \
test \
type-check \
up \
Expand All @@ -52,6 +75,13 @@ help:
@echo " make logs-f Follow logs of the started simdb-dashboard service"
@echo " make shell Enter shell in the started simdb-dashboard service"
@echo ""
@echo "HTTPS toggle (set USE_HTTPS=1):"
@echo " USE_HTTPS=1 make service Build HTTPS service stage and tag simdb-dashboard:service-https"
@echo " USE_HTTPS=1 make up Start dashboard with docker-compose.https.yml override"
@echo " USE_HTTPS=1 make down Stop dashboard started with the HTTPS compose override"
@echo " USE_HTTPS=1 make logs-f Follow logs of the HTTPS compose service"
@echo " USE_HTTPS=1 make shell Enter shell in the started HTTPS compose service"
@echo ""
@echo "Dockerfile stage targets:"
@echo " make builder Build builder stage (dependency setup + source prep)"
@echo " make build Build application build stage and tag $(BUILD_IMAGE)"
Expand All @@ -71,9 +101,21 @@ help:
@echo " make distclean Remove local artifacts and compose runtime state"
@echo " make deploy Deploy project (placeholder)"
@echo ""
@echo "Systemd integration (run with sudo):"
@echo " sudo make systemd-install Copy files to $(package_optdir) and $(package_etcdir)"
@echo " sudo make systemd-enable systemctl daemon-reload && systemctl enable simdb-dashboard"
@echo " sudo make systemd-start systemctl start simdb-dashboard"
@echo " sudo make systemd-status systemctl status simdb-dashboard"
@echo " sudo make systemd-stop systemctl stop simdb-dashboard"
@echo " sudo make systemd-disable systemctl stop && systemctl disable simdb-dashboard"
@echo " sudo make systemd-uninstall Remove files installed by systemd-install"
@echo " USE_HTTPS=1 sudo make systemd-install Include HTTPS compose override and SSL setup"
@echo ""
@echo "Environment variable examples:"
@echo " Start simdb-dashboard at alternative DASHBOARD_PORT, with simdb server at API_PORT:"
@echo " DASHBOARD_PORT=8080 API_PORT=5100 make up"
@echo " Start HTTPS dashboard with alternative HTTP/HTTPS host ports:"
@echo " DASHBOARD_PORT=8080 DASHBOARD_HTTPS_PORT=8443 USE_HTTPS=1 make up"

# Compose targets
up:
Expand Down Expand Up @@ -153,11 +195,68 @@ dashboard/package-lock.json: dashboard/package.json
"npm install --package-lock-only && npm audit fix && npm list"

distclean:
$(DOCKER_COMPOSE) down --volumes --remove-orphans --rmi local
$(DOCKER_CMD) rmi -f $(BUILD_IMAGE) $(SERVICE_IMAGE) >/dev/null 2>&1 || true
APP_VERSION="$(VERSION)" COMPOSE_FILE="docker-compose.yml" $(DOCKER_CMD) compose down --volumes --remove-orphans --rmi local
APP_VERSION="$(VERSION)" COMPOSE_FILE="docker-compose.yml:docker-compose.https.yml" $(DOCKER_CMD) compose down --volumes --remove-orphans --rmi local
$(DOCKER_CMD) rmi -f $(BUILD_IMAGE) simdb-dashboard:service simdb-dashboard:service-https >/dev/null 2>&1 || true
$(DOCKER_CMD) volume rm -f simdb_dashboard_node_modules >/dev/null 2>&1 || true
rm -rf dist

# Systemd integration (run with sudo)
systemd-installdirs:
mkdir -p \
$(DESTDIR)/$(package_etcdir) \
$(DESTDIR)/$(package_optdir) \
$(DESTDIR)/$(package_optdir)/docker/nginx/ssl/ \
$(DESTDIR)/$(package_optdir)/docker/nginx/templates/snippets \
$(DESTDIR)/$(systemd_unitdir)

systemd-install: systemd-installdirs
cp -r \
Comment thread
Louwrensth marked this conversation as resolved.
Resolved
docker-compose.https.yml \
docker-compose.systemd.yml \
docker-compose.yml \
$(DESTDIR)/$(package_optdir)
ls docker/nginx/ssl/* 2>/dev/null && \
cp -r \
docker/nginx/ssl/* \
$(DESTDIR)/$(package_optdir)/docker/nginx/ssl/ || \
echo "WARNING: Could not install missing cert files, see docker/nginx/ssl/*"
cp -r \
docker/nginx/templates/default.conf.template \
$(DESTDIR)/$(package_optdir)/docker/nginx/templates/
cp -r \
docker/nginx/templates/snippets/location-dashboard.conf.template \
docker/nginx/templates/snippets/location-simdb_proxy.conf.template \
docker/nginx/templates/snippets/runtime-config-template.js \
docker/nginx/templates/snippets/server-http.conf.template \
docker/nginx/templates/snippets/server-https.conf.template \
$(DESTDIR)/$(package_optdir)/docker/nginx/templates/snippets
cp -r \
scripts/simdb-dashboard.env.example \
$(DESTDIR)/$(package_etcdir)/simdb-dashboard.env.example
cd $(DESTDIR)/$(package_etcdir) && \
[ ! -f simdb-dashboard.env ] && \
cp simdb-dashboard.env.example simdb-dashboard.env || \
true
cp -r \
scripts/simdb-dashboard.service \
$(DESTDIR)/$(systemd_unitdir)/simdb-dashboard.service

systemd-uninstall:
-rm -f --interactive $(DESTDIR)/$(systemd_unitdir)/simdb-dashboard.service
-rm -rf --interactive $(DESTDIR)/$(package_etcdir)
-rm -rf --interactive $(DESTDIR)/$(package_optdir)

systemd-daemon-reload:
systemctl daemon-reload

systemd-enable: systemd-daemon-reload

systemd-disable: systemd-stop

systemd-start systemd-status systemd-stop systemd-enable systemd-disable:
systemctl $(patsubst systemd-%,%,$@) simdb-dashboard

# Deployment
deploy:
@echo "TODO define deploy workflow here"
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.https.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# HTTPS override for docker-compose.yml.
#
# Only adds or overrides SSL-specific settings.
#
# Enable this override by including it in COMPOSE_FILE,
# after the original, e.g.
# COMPOSE_FILE="docker-compose.yml:docker-compose.https.yml"
# COMPOSE_FILE="docker-compose.yml:docker-compose.https.yml:docker-compose.systemd.yml"
#
services:
dashboard:
environment:
# Use server-https.conf when SSL certificates (cert.crt and cert.key) are provided.
SERVER_CONF: ${SERVER_CONF:-server-https.conf}
ports:
- "${DASHBOARD_PORT:-80}:80"
- "${DASHBOARD_HTTPS_PORT:-443}:443"
volumes:
- ./docker/nginx/templates:/etc/nginx/templates
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
19 changes: 19 additions & 0 deletions docker-compose.systemd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Systemd override for docker-compose.yml.
#
# Uses the GHCR-published image instead of a local build.
#
# Set SIMDB_DASHBOARD_TAG in the environment file to pin a specific
# version. The default is the latest tag at the time of writing.
#
# Enable this override by including it in COMPOSE_FILE,
# after the original, e.g.
# COMPOSE_FILE="docker-compose.yml:docker-compose.https.yml"
# COMPOSE_FILE="docker-compose.yml:docker-compose.https.yml:docker-compose.systemd.yml"
#
services:
dashboard:
image: ${SIMDB_DASHBOARD_IMAGE:-ghcr.io/iterorganization/simdb-dashboard:${SIMDB_DASHBOARD_TAG:-service-0.9.0-68-g8819049}}
Comment thread
Louwrensth marked this conversation as resolved.
Resolved
logging:
driver: journald
options:
tag: simdb-dashboard
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
services:
dashboard:
container_name: ${DASHBOARD_CONTAINER_NAME:-simdb-dashboard}
image: simdb-dashboard:service
labels:
io.simdb.component: "dashboard"
build:
build:
context: .
args:
APP_VERSION: ${APP_VERSION:-0.0.0-unknown}
Expand All @@ -18,7 +19,6 @@ services:
ports:
- "${DASHBOARD_PORT:-80}:80"
volumes:
- ./docker/dashboard.nginx:/etc/nginx/templates/default.conf.template
- ./docker/runtime-config-template.js:/usr/share/nginx/html/runtime-config-template.js
- ./docker/nginx/templates:/etc/nginx/templates
extra_hosts:
- "host.docker.internal:host-gateway"
55 changes: 0 additions & 55 deletions docker/dashboard.nginx

This file was deleted.

4 changes: 4 additions & 0 deletions docker/nginx/entrypoint/25-select-server-conf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -eu

cp "/etc/nginx/conf.d/snippets/${SERVER_CONF:-server-http.conf}" /etc/nginx/conf.d/snippets/server.conf
1 change: 1 addition & 0 deletions docker/nginx/ssl/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This directory expects cert.crt and cert.key files.
18 changes: 18 additions & 0 deletions docker/nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Relies on official nginx image default behavior: /etc/nginx/templates/*.template
# are envsubst-processed into /etc/nginx/conf.d at container startup.
# See: https://github.com/docker-library/docs/tree/master/nginx

# Log to container stdout/stderr so logs are visible via `docker compose logs`.
# Change `info` to `debug` for maximum verbosity (requires nginx debug build).
error_log /dev/stderr info;
access_log /dev/stdout;

# Hostnames inside upstream blocks are resolved at config-load time using the
# system resolver, which does read /etc/hosts.
upstream simdb_backend {
server ${API_HOST}:${API_PORT};
}

# Server block include is selected at startup by /docker-entrypoint.d/25-select-server-conf.sh
# using SERVER_CONF (default: server-http.conf).
include /etc/nginx/conf.d/snippets/server.conf;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# dashboard app expects request url path to start with /dashboard/
location = / { return 302 /dashboard/; }
location = /dashboard { return 302 /dashboard/; }
location /dashboard/ {
try_files $uri $uri/ /dashboard/index.html;
}

# dashboard is a simdb client;
# runtime-config.js defines the simdb remote url to use.
location = /dashboard/runtime-config.js {
default_type application/javascript;
add_header Cache-Control "no-cache, no-store, must-revalidate";
alias /etc/nginx/templates/snippets/runtime-config-template.js;
sub_filter_once off;
sub_filter_types application/javascript;
# Optional tokens to replace in template:
sub_filter 'SIMDB_SERVER_URL' '${SIMDB_SERVER_URL}';
sub_filter 'API_HOST' '${API_HOST}';
sub_filter 'API_PORT' '${API_PORT}';
}
Loading