From a7e31fcfbd6f96fc9288f2fb867a493345ec6f8f Mon Sep 17 00:00:00 2001 From: NaeemDosh Date: Tue, 30 Jun 2026 12:27:15 +0500 Subject: [PATCH] Consolidate stack into one docker-compose.yml + restore minio + publish port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - web_server: branded livtec/aido-web:local from ./web, pull_policy never - restore minio (S3 file store) the flattened compose dropped — api_server requires S3_ENDPOINT_URL=http://minio:9000 and won't start without it - nginx published on ${HOST_PORT:-3000} → out-of-the-box http://localhost:3000 - Makefile targets the single file (no override chain) - README: ./web layout, one-compose flow, USER_AUTH_SECRET + first-boot notes - gitignore runtime data dirs (db_volume, model caches) Verified: stack converges healthy on the single file; localhost:3000 + /api/health both 200. --- .gitignore | 6 ++++++ Makefile | 11 ++++------- README.md | 37 ++++++++++++++++++++++--------------- docker-compose.yml | 38 +++++++++++++++++++++++++++++++++----- 4 files changed, 65 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 24b7e5c..b1c98cc 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,12 @@ .env .env.nginx +# Runtime data created by the stack (bind mounts / model caches) +/db_volume/ +/model_cache_huggingface/ +/indexing_huggingface_model_cache/ +/data/nginx/ + # OS / editor noise .DS_Store *.log diff --git a/Makefile b/Makefile index ed68789..d88fe32 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,12 @@ # 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. +# Everything lives in a single self-contained docker-compose.yml: the branded +# web image is built locally from ./web; every other service uses the official +# Onyx images unchanged. No override files to chain. # ───────────────────────────────────────────────────────────────────────────── -# 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 +COMPOSE = docker compose -f docker-compose.yml .PHONY: setup rebrand apply build up down restart logs verify config diff --git a/README.md b/README.md index 5bfba30..9e9f975 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ therefore can't fully rebrand it. So we use a **thin-overlay** model: │ branding/branding.config.json ← single source of truth (you edit) │ │ │ │ │ ▼ node branding/apply-branding.mjs │ -│ onyx/web ← branding baked in (logo, favicon, name, links) │ +│ ./web ← branding baked in (logo, favicon, name, links) │ │ │ │ │ ▼ docker compose build web_server │ │ livtec/aido-web:local ← the ONLY image we build │ @@ -43,43 +43,50 @@ Onyx release is a re-checkout + re-run, not a fork to maintain (see | Path | Purpose | |------|---------| | `branding/branding.config.json` | **Single source of truth** — name, assets, links, emails, rename rules. | -| `branding/apply-branding.mjs` | Applies the overlay into `onyx/web` (fetch assets, swap logos, repoint favicon, codemod strings). | +| `branding/apply-branding.mjs` | Applies the overlay into `./web` (fetch assets, swap logos, repoint favicon, codemod strings). | | `branding/templates/` | Logo React components (filled from the config at apply time). | | `branding/assets/` | Offline fallback copies of the fetched brand images. | -| `docker-compose.branding.yml` | Thin override: build **only** `web_server` from `./onyx/web`, pull the rest. | -| `Makefile` | `make rebrand` / `apply` / `build` / `up` / `down` / `verify`. | -| `.env.example`, `.env.nginx.example` | Deployment env templates (Onyx's standard vars — **not** branding). | -| `onyx/` | Upstream Onyx checkout (pinned — see `branding.config.json → upstream`). | +| `docker-compose.yml` | **One self-contained stack.** Branded web built from `./web`; everything else (incl. minio) uses official Onyx images. | +| `Makefile` | `make setup` / `rebrand` / `apply` / `build` / `up` / `down` / `verify`. | +| `.env.example` | Deployment env template (Onyx's standard vars — **not** branding). | +| `web/`, `data/` | Upstream Onyx checkout (sparse: `web` + `deployment/data/nginx`), fetched by `make setup`. Git-ignored. | --- ## Quick start ```bash -# 0a. one-time: fetch the upstream Onyx checkout at the pinned commit +# 0a. one-time: fetch the upstream Onyx sources (sparse checkout) make setup -# 0b. one-time: copy the env templates and set real secrets +# 0b. one-time: copy the env template and set real secrets cp .env.example .env -cp .env.nginx.example .env.nginx -# edit .env → set MINIO_ROOT_PASSWORD / S3_AWS_SECRET_ACCESS_KEY, AUTH_TYPE, WEB_DOMAIN -# (for the no-letsencrypt profile, also place TLS certs — see .env.nginx.example) +# In .env, set at minimum: +# USER_AUTH_SECRET → REQUIRED, the API won't start blank: openssl rand -hex 32 +# MINIO_ROOT_PASSWORD / S3_AWS_SECRET_ACCESS_KEY → strong values +# AUTH_TYPE → `disabled` for a quick local run, or oidc/basic for real auth +# HOST_PORT → optional, defaults to 3000 # 1. apply branding, build the branded web image, start the whole stack make rebrand # …or step by step: -make apply # bake branding into ./onyx/web +make apply # bake branding into ./web make build # build livtec/aido-web:local -make up # start the stack (web branded, everything else official) +make up # start the full stack (one docker-compose.yml) make logs # follow the web container make verify # assert no stray "Onyx" remains in the shipping source make down # stop ``` -Requires Docker + Docker Compose v2 and Node ≥ 18 (for the apply script). The app is -served via nginx on ports 80/443. +Requires Docker + Docker Compose v2 and Node ≥ 18 (for the apply script). Once healthy, +open **http://localhost:3000** (set `HOST_PORT` to change the port; Traefik labels on +nginx still apply in production). + +> **First boot** pulls the official images and the model server downloads embedding +> models (a few GB) — give it several minutes before nginx reports healthy. The api +> server waits on OpenSearch, minio and Postgres, so it's the last to go green. --- diff --git a/docker-compose.yml b/docker-compose.yml index 52b94a9..9241693 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -184,9 +184,13 @@ services: # - ${CA_CERT_PATH:-./custom-ca.crt}:/etc/ssl/certs/custom-ca.crt:ro web_server: - image: ${ONYX_WEB_SERVER_IMAGE:-onyxdotapp/onyx-web-server:${IMAGE_TAG:-latest}} + # Branded AIDO web image, built locally from ./web after `make apply`. + # This is the ONLY locally-built image; every other service below uses the + # official Onyx images unchanged. pull_policy: never => never overwrite it. + image: livtec/aido-web:local + pull_policy: never build: - context: ../../web + context: ./web dockerfile: Dockerfile args: - NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT:-} @@ -218,6 +222,27 @@ services: timeout: 10s retries: 5 start_period: 30s + + # Object (S3) file store. Official Onyx ships this; required by the backend + # (S3_ENDPOINT_URL=http://minio:9000). Without it api_server cannot start. + minio: + image: minio/minio:RELEASE.2025-07-23T15-54-02Z-cpuv1 + restart: unless-stopped + environment: + MINIO_ROOT_USER: ${MINIO_ROOT_USER:?set a strong value in .env} + MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?set a strong value in .env} + MINIO_DEFAULT_BUCKETS: ${S3_FILE_STORE_BUCKET_NAME:-onyx-file-store-bucket} + command: server /data --console-address ":9001" + volumes: + - minio_data:/data + networks: + - onyx-network + healthcheck: + test: ["CMD", "mc", "ready", "local"] + interval: 30s + timeout: 20s + retries: 3 + # Uncomment the block below to enable the MCP server for Onyx. # mcp_server: # image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}} @@ -461,9 +486,10 @@ services: networks: - onyx-network - web - #ports: - # - "${HOST_PORT_80:-80}:80" - # - "${HOST_PORT:-3000}:80" # allow for localhost:3000 usage, since that is the norm + # Local access at http://localhost:3000 out of the box. The Traefik labels + # above still apply in production; set HOST_PORT in .env to change the port. + ports: + - "${HOST_PORT:-3000}:80" volumes: # Mount templates read-only; the startup command copies them into # the writable /etc/nginx/conf.d/ inside the container. This avoids @@ -554,6 +580,8 @@ services: volumes: # Persistent data for OpenSearch. opensearch-data: null + # Persistent data for the MinIO (S3) file store. + minio_data: null networks: onyx-network: driver: bridge