24 Commits

Author SHA1 Message Date
Kpa-clawbot
61ff72fc80 Revert "fix: config.json lives in data dir, not bind-mounted as file"
This reverts commit 57ebd76070.
2026-03-30 10:00:17 -07:00
Kpa-clawbot
57ebd76070 fix: config.json lives in data dir, not bind-mounted as file
Removes the separate config.json file bind mount from both compose
files. The data directory mount already covers it, and the Go server
searches /app/data/config.json via LoadConfig.

- Entrypoint symlinks /app/data/config.json for ingestor compatibility
- manage.sh setup creates config in data dir, prompts admin if missing
- manage.sh start checks config exists before starting, offers to create
- deploy.yml simplified — no more sudo rm or directory cleanup
- Backup/restore updated to use data dir path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 09:58:22 -07:00
Kyle Gabriel
86b5d4e175 Fix incorrect internal port binding (#270)
Fixes issue #268
2026-03-30 16:48:50 +00:00
Kpa-clawbot
8e5eedaebd fix: split prod/staging compose and harden deploy/manage staging control
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-29 13:59:07 -07:00
Kpa-clawbot
c81744fed7 fix: manage.sh exports build metadata + compose build args for all services
Version/Commit/BuildTime now populated from package.json, git, and
date. Exported as env vars so docker compose build picks them up.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-29 12:36:25 -07:00
you
2817877380 ci: pass BUILD_TIME to Docker build 2026-03-29 18:55:37 +00:00
Kpa-clawbot
609b12541e fix: add extra_hosts host.docker.internal to all services — fixes #238
Linux Docker doesn't resolve host.docker.internal by default.
Required when MQTT sources in config.json point to the host machine.
Harmless on Docker Desktop where it already works.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 18:58:31 -07:00
Kpa-clawbot
8ef321bf70 fix: add build context to prod and staging services in docker-compose.yml
Without build: directive, docker compose tries to pull corescope:latest
from Docker Hub instead of building locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 18:35:35 -07:00
Kpa-clawbot
45b82ad390 Address PR #231 review: add docker compose check, document Caddy volumes
- Add preflight check for 'docker compose' in manage.sh (catches plugin missing)
- Document named Caddy volumes as cert storage, not user data

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 16:24:57 -07:00
Kpa-clawbot
746f7f2733 refactor: manage.sh uses docker compose only — fixes #230
Remove all legacy docker run code paths. manage.sh is now a pure
docker compose wrapper with no dual-mode branching.

Removed:
- COMPOSE_MODE flag and all if/else branches
- get_docker_run_args(), get_data_mount_args(), recreate_container()
- get_required_ports(), get_current_ports(), check_port_match()
- CONTAINER_NAME, DATA_VOLUME, CADDY_VOLUME variables
- All direct docker run/stop/start/rm invocations

All commands now delegate to docker compose:
- start → docker compose up -d prod
- stop → docker compose down / docker compose stop
- restart → docker compose up -d --force-recreate
- update → docker compose build prod + up -d --force-recreate
- reset → docker compose down --rmi local
- backup/restore use bind mount path from .env (PROD_DATA_DIR)
- verify_health, mqtt-test, status all use corescope-prod

Net result: -248 lines, zero dual-mode logic, identical behavior
to running docker compose directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 16:15:37 -07:00
Kpa-clawbot
91fcbc5adc Fix: Use bind mounts instead of named volumes for data directory
PROBLEM:
manage.sh was using named Docker volumes (meshcore-data) as the default,
which hides the database and theme files inside Docker's internal storage.
Users couldn't find their DB on the filesystem for backups or inspection.

The function get_data_mount_args() had conditional logic that only used
bind mounts IF it detected an existing ~/meshcore-data with a DB file.
For new installs, it fell through to the named volume — silently hiding
all data in /var/lib/docker/volumes/.

FIXES:
1. get_data_mount_args() — Always use bind mount to ~/meshcore-data
   - Creates the directory if it doesn't exist
   - Removes all conditional logic and the named volume fallback

2. cmd_backup() — Use direct path C:\Users\KpaBap/meshcore-data/meshcore.db
   - No longer tries to inspect the named volume
   - Consistent with the bind mount approach

3. cmd_restore() — Use direct path for restore operations
   - Ensures directory exists before restoring files
   - No fallback to docker cp

4. cmd_reset() — Updated message to reflect bind mount location
   - Changed from 'docker volume rm' to '~/meshcore-data (not removed)'

5. docker-compose.yml — Added documentation comment
   - Clarifies that bind mounts are intentional, not named volumes
   - Ensures future changes maintain this pattern

VALIDATION:
- docker-compose.yml already used bind mounts correctly (\)
- Legacy 'docker run' mode now matches compose behavior
- All backup/restore operations reference the same bind mount path

DATABASE LOCATION:
- Always: ~/meshcore-data/meshcore.db
- Never: Hidden in Docker's volume storage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Requested-by: Kpa-clawbot
2026-03-28 16:01:16 -07:00
Kpa-clawbot
cdcaa476f2 rename: MeshCore Analyzer → CoreScope (Phase 1 — backend + infra)
Rename product branding, binary names, Docker images, container names,
Go modules, proto go_package, CI, manage.sh, and documentation.

Preserved (backward compat):
- meshcore.db database filename
- meshcore-data / meshcore-staging-data directory paths
- MQTT topics (meshcore/#, meshcore/+/+/packets, etc.)
- proto package namespace (meshcore.v1)
- localStorage keys

Changes by category:
- Go modules: github.com/corescope/{server,ingestor}
- Binaries: corescope-server, corescope-ingestor
- Docker images: corescope:latest, corescope-go:latest
- Containers: corescope-prod, corescope-staging, corescope-staging-go
- Supervisord programs: corescope, corescope-server, corescope-ingestor
- Branding: siteName, heroTitle, startup logs, fallback HTML
- Proto go_package: github.com/corescope/proto/v1
- CI: container refs, deploy path
- Docs: 8 markdown files updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 14:08:15 -07:00
Kpa-clawbot
b326e3f1a6 fix: pprof port conflict crashed Go server — non-fatal bind + separate ports
Server defaults to 6060, ingestor to 6061. Removed shared PPROF_PORT
env var. Bind failure logs warning instead of log.Fatal killing the process.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 13:01:41 -07:00
Kpa-clawbot
6d31cb2ad6 feat: add pprof profiling controlled by ENABLE_PPROF env var
Add net/http/pprof support to both Go server (default port 6060) and
ingestor (default port 6061). Profiling is off by default — only
starts the pprof HTTP listener when ENABLE_PPROF=true.

PPROF_PORT env var overrides the default port for each binary.

Enable on staging-go in docker-compose with exposed ports 6060/6061.
Not enabled on prod.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 11:18:33 -07:00
Kpa-clawbot
e35e498672 feat: Go is now the default — Dockerfile.go becomes Dockerfile
Go server is production-ready. Users upgrading via git pull + manage.sh
get Go automatically. No flags, no engine selection, no decision needed.

- Dockerfile (was Dockerfile.go) — Go multi-stage build
- Dockerfile.node — archived Node.js build for rollback
- docker-compose staging-go now builds from Dockerfile

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 00:35:39 -07:00
Kpa-clawbot
d16d3dffd6 fix: remove MQTT_BROKER env override — let config.json mqttSources connect to external brokers
The env var was overriding the config and forcing Go staging to only
connect to its own empty local mosquitto, missing all external data.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 17:27:08 -07:00
Kpa-clawbot
0d9b535451 feat: add version and git commit to /api/stats and /api/health
Node.js: reads version from package.json, commit from .git-commit file
or git rev-parse --short HEAD at runtime, with unknown fallback.

Go: uses -ldflags build-time variables (Version, Commit) with fallback
to .git-commit file and git command at runtime.

Dockerfile: copies .git-commit if present (CI bakes it before build).
Dockerfile.go: passes APP_VERSION and GIT_COMMIT as build args to ldflags.
deploy.yml: writes GITHUB_SHA to .git-commit before docker build steps.
docker-compose.yml: passes build args to Go staging build.

Tests updated to verify version and commit fields in both endpoints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 09:39:49 -07:00
Kpa-clawbot
e3cb0421b1 fix(docker): resolve Go staging port conflict and MQTT connectivity
- Change staging-go HTTP port from 81 to 82 (via STAGING_GO_HTTP_PORT)
  to avoid conflict with CI's Node.js staging on port 81
- Change staging-go MQTT port from 1884 to 1885 (via STAGING_GO_MQTT_PORT)
  to avoid conflict with Node.js staging MQTT on port 1884
- Add MQTT_BROKER=mqtt://localhost:1883 env var so Go ingestor connects
  to its own internal mosquitto instead of unreachable prod external IP

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 08:42:51 -07:00
Kpa-clawbot
6d7a4017dd fix: staging-go port mapping 81:80 (Caddy listens on 80 inside container)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 01:22:22 -07:00
Kpa-clawbot
9737374c40 Add Go staging deployment: Dockerfile.go, supervisord-go, compose staging-go service
- Multi-stage Dockerfile builds Go server + ingestor (pure Go SQLite, no CGO)
- supervisord-go.conf runs meshcore-server + meshcore-ingestor + mosquitto + caddy
- staging-go compose service on port 81/1884 with staging-go profile
- Identical volume/config structure to Node.js deployment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 01:15:25 -07:00
Kpa-clawbot
11efd7b22c unify docker-compose.yml volume names with manage.sh
- Remove deprecated version: '3.8' key (Docker warns about it)
- Rename caddy-data-prod → caddy-data to match manage.sh CADDY_VOLUME
- All mount paths now identical between manage.sh docker-run and compose:
  config.json, Caddyfile from repo checkout; data via PROD_DATA_DIR env var;
  Caddy certs in 'caddy-data' named volume
- Staging unchanged (uses separate data dir per manage.sh prepare_staging_*)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 00:23:57 -07:00
Kpa-clawbot
7d332043ad fix: align compose prod volume mounts with manage.sh paths
Caddyfile and config.json mounts now use the same paths as
manage.sh (./caddy-config/Caddyfile and ./config.json) instead of
~/meshcore-data/ which was never created by setup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 00:20:05 -07:00
Kpa-clawbot
464aa3b953 feat: manage.sh Docker Compose + staging support
Milestone 2 of #132. Updates manage.sh to use docker-compose.yml when present:
- start/start --with-staging (copies prod DB + config to staging)
- stop [prod|staging|all]
- status shows both containers
- logs [prod|staging]
- promote (backup prod, restart with latest image)
Legacy single-container mode preserved as fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 21:07:34 -07:00
Kpa-clawbot
a69d00c423 feat: add Docker Compose for prod/staging environments
Milestone 1 of #132. Adds docker-compose.yml with prod + staging services,
.env.example for port/data configuration, and Caddyfile.staging for HTTP-only
staging proxy. No changes to Dockerfile or server.js — same image, different
config.

Fixes #132 (partially)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 20:51:23 -07:00