# Plan: Reorganize hiveops-openmetal for Multi-Software Management ## Context The `hiveops-openmetal` directory is currently structured entirely around HiveOps. The goal is to reorganize it so that multiple software deployments (HiveOps, SmartJournal, and potentially more in the future) can be managed cleanly from this directory. SmartJournal will share some infrastructure (database) but have its own dedicated app instance(s). --- ## Proposed Directory Structure ``` hiveops-openmetal/ ├── hiveops/ # HiveOps software configs │ ├── instances/ │ │ ├── services/ # ← moved from instances/services/ │ │ └── browser/ # ← moved from instances/browser/ │ ├── docker-compose.yml # ← moved from root │ ├── docker-compose.db.yml │ ├── docker-compose.override.yml │ ├── docker-compose.prod.yml │ ├── docker-compose.ssl.yml │ ├── .env # ← moved from root │ ├── .env.example │ └── scripts/ # HiveOps-specific scripts (subset of root scripts/) │ ├── smartjournal/ # SmartJournal software configs │ ├── instances/ │ │ └── services/ # SmartJournal dedicated app instance │ ├── docker-compose.yml # ← bring in from existing SmartJournal config │ ├── .env │ ├── .env.example │ └── scripts/ │ ├── shared/ # Shared infrastructure │ └── database/ # ← moved from instances/database/ │ ├── docker-compose.yml │ ├── .env │ ├── .env.example │ ├── postgresql.conf │ ├── backup/ │ └── scripts/ │ ├── docs/ # Cross-project / OpenMetal-level docs (kept at root) │ ├── OPENMETAL-SETUP.md │ ├── MULTI-INSTANCE-ARCHITECTURE.md │ └── ...existing docs... │ ├── scripts/ # Cross-project provisioning scripts (kept at root) │ ├── provision-instances.sh │ ├── deploy-all-instances.sh │ ├── build-all-images.sh │ └── check-prerequisites.sh │ ├── .env.openmetal # OpenMetal cloud credentials (shared, stays at root) ├── .env.openmetal.example ├── .env.openmetal.ready ├── cloud-init-hiveops.yaml ├── .gitignore └── README.md ``` --- ## What Moves Where | Current Path | New Path | |---|---| | `instances/services/` | `hiveops/instances/services/` | | `instances/browser/` | `hiveops/instances/browser/` | | `instances/database/` | `shared/database/` | | `docker-compose.yml` (root) | `hiveops/docker-compose.yml` | | `docker-compose.*.yml` (root) | `hiveops/docker-compose.*.yml` | | `.env` (root) | `hiveops/.env` | | `.env.example` (root) | `hiveops/.env.example` | | `nginx/` (legacy, root) | `hiveops/nginx/` (or remove if unused) | | `certs/` (root) | `hiveops/certs/` | | `data/` (root) | `hiveops/data/` | **Stays at root:** - `docs/` — OpenMetal-level docs remain shared - `scripts/` — provisioning scripts remain shared - `.env.openmetal*` — cloud credentials are global - `cloud-init-hiveops.yaml` - `README.md` - `.gitignore` - `.gitea/` --- ## Steps ### 1. Create new directory skeleton ``` mkdir -p hiveops/instances mkdir -p smartjournal/instances/services mkdir -p shared/database ``` ### 2. Move HiveOps instance directories ``` mv instances/services hiveops/instances/services mv instances/browser hiveops/instances/browser ``` ### 3. Move shared database instance ``` mv instances/database shared/database ``` ### 4. Move root-level HiveOps configs ``` mv docker-compose.yml hiveops/ mv docker-compose.db.yml hiveops/ mv docker-compose.override.yml hiveops/ mv docker-compose.prod.yml hiveops/ mv docker-compose.ssl.yml hiveops/ mv .env hiveops/ mv .env.example hiveops/ mv nginx/ hiveops/ mv certs/ hiveops/ mv data/ hiveops/ ``` ### 5. Set up smartjournal/ skeleton Create: - `smartjournal/instances/services/` — placeholder for SmartJournal's dedicated instance config - `smartjournal/docker-compose.yml` — brought in from existing SmartJournal config - `smartjournal/.env.example` — template env file - `smartjournal/README.md` — brief description ### 6. Update paths in deployment scripts Scripts that reference old paths need updating: - `scripts/deploy-all-instances.sh` — update instance paths - `instances/services/scripts/deploy.sh` → now at `hiveops/instances/services/scripts/deploy.sh` - Any SSH copy commands in docs referencing old paths ### 7. Update README.md Update the root README to reflect the new structure and include links to `hiveops/` and `smartjournal/` subdirectories. ### 8. Handle untracked file - `preload.js` (currently untracked at root) — determine if it belongs to HiveOps browser and move accordingly to `hiveops/` --- ## Files with Hardcoded Paths to Update After moving, check and update these: - `scripts/deploy-all-instances.sh` — references `instances/` paths - `scripts/provision-instances.sh` — may reference `instances/` - `.gitea/workflows/deploy.yml` — check deployment paths - Any `scp` commands in docs pointing to `instances/services/nginx/conf.d/` --- ## Verification 1. Check `hiveops/instances/services/docker-compose.yml` still works: ```bash cd hiveops/instances/services && docker compose config ``` 2. Check `shared/database/docker-compose.yml` still works: ```bash cd shared/database && docker compose config ``` 3. Verify git status shows moves (not deletions): ```bash git status git diff --stat ``` 4. On production: deployment scripts reference new paths correctly (dry-run before deploying)