aido-onyx/Makefile
livdebus 1d650c4d30 refactor: flatten structure, sparse-checkout upstream, add base compose for dockge/traefik
Replace the nested `onyx/` full-clone approach with a flattened, self-contained
deployment structure:

- `make setup` now uses `git sparse-checkout` to fetch only `web/` and
  `deployment/data/nginx/` from upstream, extracting them flat into `./web`
  and `./data/nginx`. This avoids downloading the entire Onyx repository
  when we only rebuild the branded web container ourselves.
- Add a top-level `docker-compose.yml` as the base stack file instead of
  referencing paths inside `onyx/deployment/...`. This keeps the compose
  project in the repo root so it can be managed by dockge and simplifies
  putting Traefik in front of the Onyx nginx.
- Update `docker-compose.branding.yml` build context from `./onyx/web` to `./web`.
- Update `branding.config.json`:
  - `webSrcRoot`: `onyx/web` → `web`
  - `pinnedCommit`: pinned hash → `main`
  - Add rename literals for "Open Source AI Platform" → "Powered by Livtec"
    and `https://www.onyx.app` → `https://livtec.cloud`
- Replace the minimal `.env.example` with the full Onyx deployment template.
- Add `setup.sh` for server provisioning (Node.js 25, make, /opt/stacks/onyx).
- Update `make verify` to search `./web/src` instead of `./onyx/web/src`.

All backend/model services continue to use official upstream Docker images;
only the `web_server` image is built locally from the branded source.
2026-06-29 12:43:31 +02:00

76 lines
3 KiB
Makefile

# ─────────────────────────────────────────────────────────────────────────────
# AIDO white-label of Onyx Community Edition — operator shortcuts.
#
# make rebrand apply branding + build the web image + (re)start the stack
# make apply only re-run the branding overlay into ./onyx/web
# make build only (re)build the branded web image
# make up / down start / stop the full stack
# make logs follow the web container logs
# make verify sanity-check that branding was applied (no stray "Onyx")
#
# The --project-directory . flag pins the Compose project dir to this repo root so
# the override's `./onyx/web` context and the root-level `.env` both resolve, while
# every other service is pulled unchanged from Onyx's official images.
# ─────────────────────────────────────────────────────────────────────────────
# Use the no-letsencrypt prod compose by default (no TLS/domain needed). Override
# with `make COMPOSE_BASE=onyx/deployment/docker_compose/docker-compose.prod.yml`.
COMPOSE_BASE ?= ./docker-compose.yml
COMPOSE = docker compose --project-directory . -f $(COMPOSE_BASE) -f docker-compose.branding.yml
.PHONY: setup rebrand apply build up down restart logs verify config
# Clone the upstream Onyx checkout at the pinned commit (only if ./onyx is absent).
# Reads upstream.repo / upstream.pinnedCommit from branding/branding.config.json.
ONYX_REPO = $(shell node -e "console.log(require('./branding/branding.config.json').upstream.repo)")
ONYX_COMMIT = $(shell node -e "console.log(require('./branding/branding.config.json').upstream.pinnedCommit)")
setup:
@set -e; \
TMP=".onyx-sparse-tmp"; \
echo "Fetching $(ONYX_REPO) @ $(ONYX_COMMIT) ..."; \
rm -rf "$$TMP"; \
git clone --filter=blob:none --no-checkout $(ONYX_REPO) "$$TMP"; \
git -C "$$TMP" sparse-checkout init --cone; \
git -C "$$TMP" sparse-checkout set web deployment/data/nginx; \
git -C "$$TMP" checkout $(ONYX_COMMIT); \
\
echo "Extracting web/ ..."; \
rm -rf web; \
cp -r "$$TMP/web" ./web; \
\
echo "Extracting deployment/data/nginx/ -> data/nginx/ ..."; \
rm -rf data/nginx; \
mkdir -p data; \
cp -r "$$TMP/deployment/data/nginx" ./data/nginx; \
\
rm -rf "$$TMP"; \
echo "Done."
rebrand: apply build up
apply:
node branding/apply-branding.mjs
build:
$(COMPOSE) build web_server
up:
$(COMPOSE) up -d
down:
$(COMPOSE) down
restart:
$(COMPOSE) up -d --force-recreate web_server
logs:
$(COMPOSE) logs -f web_server
config:
$(COMPOSE) config
verify:
@echo "Stray standalone 'Onyx' in shipping web source (expect 0):"
@grep -rnE '\bOnyx\b' web/src --include='*.ts' --include='*.tsx' \
| grep -vE '\.test\.|\.spec\.|\.stories\.|__tests__|__mocks__' | wc -l