235 lines
8.0 KiB
Markdown
235 lines
8.0 KiB
Markdown
# Project Rename Plan: atm-incident → hiveops-incident
|
|
|
|
## Overview
|
|
Rename the entire project from "atm-incident" to "hiveops-incident" across 121 files, including Java package structure, database name, Docker infrastructure, and documentation.
|
|
|
|
## Scope
|
|
- **Java Package**: `com.atm.incident` → `com.hiveops.incident` (93 files)
|
|
- **Database**: `atm_incident` → `hiveops_incident` (15 files)
|
|
- **Docker/Containers**: All containers, images, and networks (25 files)
|
|
- **Documentation**: All paths and references (16 files)
|
|
|
|
## Implementation Steps
|
|
|
|
### 1. Pre-Flight Validation
|
|
- Verify clean git state
|
|
- Create safety branch: `rename-to-hiveops-incident`
|
|
- Stop all running Docker services
|
|
|
|
### 2. Backend Maven Configuration
|
|
**Files**: `backend/pom.xml`
|
|
- Update `<groupId>com.atm</groupId>` → `<groupId>com.hiveops</groupId>`
|
|
- Validate with `mvn validate`
|
|
|
|
### 3. Java Package Rename (Critical - Two-Step Process)
|
|
|
|
**Step 3a: Update Package Content First**
|
|
```bash
|
|
cd backend/src/main/java/com/atm/incident
|
|
# Update package declarations in all 93 files
|
|
find . -name "*.java" -exec sed -i 's/^package com\.atm\.incident/package com.hiveops.incident/g' {} \;
|
|
# Update all imports
|
|
find . -name "*.java" -exec sed -i 's/import com\.atm\.incident/import com.hiveops.incident/g' {} \;
|
|
```
|
|
|
|
**Step 3b: Rename Main Application Class**
|
|
- Update class name in content: `AtmIncidentManagementApplication` → `HiveopsIncidentManagementApplication`
|
|
- Rename file using `git mv`
|
|
|
|
**Step 3c: Move Directory Structure**
|
|
```bash
|
|
cd backend/src/main/java/com
|
|
mkdir -p hiveops/incident
|
|
git mv atm/incident/* hiveops/incident/
|
|
git rm -r atm/
|
|
```
|
|
|
|
**Validation**: `mvn clean compile` must succeed
|
|
|
|
### 4. Backend Configuration Files
|
|
**File**: `backend/src/main/resources/application.properties`
|
|
- `spring.application.name`: `atm-incident-management` → `hiveops-incident-management`
|
|
- `logging.level`: `com.atm.incident` → `com.hiveops.incident`
|
|
- Database URL: `atm_incident` → `hiveops_incident`
|
|
|
|
### 5. Database Name Changes
|
|
**Files**: All config files, scripts, and documentation
|
|
```bash
|
|
# Docker compose files
|
|
sed -i 's/atm_incident/hiveops_incident/g' docker-compose.yml docker-compose.prod.yml .env.example
|
|
|
|
# DevOps scripts (5 files)
|
|
find devops-scripts -name "*.sh" -exec sed -i 's/atm_incident/hiveops_incident/g' {} \;
|
|
|
|
# Documentation (16 files)
|
|
find docs -name "*.md" -exec sed -i 's/atm_incident/hiveops_incident/g' {} \;
|
|
sed -i 's/atm_incident/hiveops_incident/g' README.md CLAUDE.md
|
|
|
|
# SQL files
|
|
sed -i 's/atm_incident/hiveops_incident/g' backend/src/main/resources/db/*.sql SAMPLE_DATA.sql
|
|
```
|
|
|
|
### 6. Docker Infrastructure
|
|
**Pattern**: `atm-incident-*` → `hiveops-incident-*`
|
|
|
|
**Files**: `docker-compose.yml`, `docker-compose.prod.yml`, `.gitea/workflows/build-deploy.yml`, DevOps scripts
|
|
```bash
|
|
# Docker compose
|
|
sed -i 's/atm-incident-/hiveops-incident-/g' docker-compose.yml docker-compose.prod.yml
|
|
|
|
# CI/CD pipeline
|
|
sed -i 's/atm-incident-/hiveops-incident-/g' .gitea/workflows/build-deploy.yml
|
|
|
|
# DevOps scripts (11 files)
|
|
find devops-scripts -name "*.sh" -exec sed -i 's/atm-incident-/hiveops-incident-/g' {} \;
|
|
find devops-scripts -name "*.sh" -exec sed -i 's/ATM Incident Management System/HiveOps Incident Management System/g' {} \;
|
|
```
|
|
|
|
**Validation**: `docker compose config` must validate
|
|
|
|
### 7. Frontend Configuration
|
|
**Files**: `frontend/package.json`, `frontend/package-lock.json`
|
|
```bash
|
|
sed -i 's/"name": "atm-incident-frontend"/"name": "hiveops-incident-frontend"/g' \
|
|
frontend/package.json frontend/package-lock.json
|
|
```
|
|
|
|
**Validation**: `npm install --dry-run` must succeed
|
|
|
|
### 8. Documentation Updates
|
|
**Files**: All 16 markdown files in `docs/`, plus root documentation
|
|
```bash
|
|
# Update deployment paths
|
|
find docs -name "*.md" -exec sed -i 's|/opt/atm-incident|/opt/hiveops-incident|g' {} \;
|
|
|
|
# Update project name
|
|
find docs -name "*.md" -exec sed -i 's/atm-incident/hiveops-incident/g' {} \;
|
|
find docs -name "*.md" -exec sed -i 's/ATM Incident Management/HiveOps Incident Management/g' {} \;
|
|
|
|
# Update Java package references
|
|
find docs -name "*.md" -exec sed -i 's/com\.atm\.incident/com.hiveops.incident/g' {} \;
|
|
|
|
# Root docs
|
|
sed -i 's/atm-incident/hiveops-incident/g' README.md
|
|
sed -i 's/ATM Incident Management/HiveOps Incident Management/g' README.md
|
|
sed -i 's/com\.atm\.incident/com.hiveops.incident/g' CLAUDE.md
|
|
```
|
|
|
|
### 9. Comprehensive Validation
|
|
|
|
**File Count Checks**:
|
|
```bash
|
|
# Java files should be 93
|
|
find backend/src/main/java/com/hiveops/incident -name "*.java" | wc -l
|
|
|
|
# Old path should not exist
|
|
test ! -d backend/src/main/java/com/atm && echo "OK"
|
|
```
|
|
|
|
**No Old References** (should return 0 for each):
|
|
```bash
|
|
grep -r "package com\.atm\.incident" backend/src --include="*.java" | wc -l
|
|
grep -r "import com\.atm\.incident" backend/src --include="*.java" | wc -l
|
|
grep -r "atm-incident-" . --exclude-dir=.git --exclude-dir=node_modules | wc -l
|
|
```
|
|
|
|
**Build Tests**:
|
|
```bash
|
|
# Backend
|
|
cd backend && mvn clean compile
|
|
|
|
# Frontend
|
|
cd frontend && npm install && npm run check
|
|
|
|
# Docker compose syntax
|
|
docker compose -f docker-compose.yml config > /dev/null
|
|
docker compose -f docker-compose.prod.yml config > /dev/null
|
|
```
|
|
|
|
### 10. Git Commits (6 Logical Commits)
|
|
|
|
1. **Java package structure** - Package rename, directory move, main class
|
|
2. **Configuration files** - Spring config, logging, database name
|
|
3. **Docker infrastructure** - Containers, networks, CI/CD
|
|
4. **DevOps scripts** - All shell scripts
|
|
5. **Documentation** - All markdown files
|
|
6. **Database schemas** - SQL files and sample data
|
|
|
|
Each commit includes migration context and co-authorship tag.
|
|
|
|
### 11. Integration Testing
|
|
|
|
**Local Development Test**:
|
|
```bash
|
|
docker compose down -v
|
|
docker compose build
|
|
docker compose up -d
|
|
sleep 30
|
|
docker compose ps # All should be "Up"
|
|
curl http://localhost:8080/api/atms
|
|
curl http://localhost:5173
|
|
docker exec hiveops-incident-db psql -U postgres -c "\l" | grep hiveops_incident
|
|
```
|
|
|
|
**API Compatibility Test**:
|
|
```bash
|
|
# Test hiveops-agent integration
|
|
curl -X POST http://localhost:8080/api/journal-events \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"atmId": 1, "eventType": "CARD_READER_DETECTED", "eventDetails": "Test", "eventSource": "HIVEOPS_AGENT"}'
|
|
```
|
|
|
|
## Critical Files
|
|
|
|
1. `backend/src/main/java/com/atm/incident/AtmIncidentManagementApplication.java` - Main class requiring rename
|
|
2. `backend/pom.xml` - Maven config (update before package changes)
|
|
3. `backend/src/main/resources/application.properties` - Spring configuration
|
|
4. `docker-compose.yml` - Development orchestration
|
|
5. `.gitea/workflows/build-deploy.yml` - CI/CD pipeline
|
|
|
|
## Database Migration Notes
|
|
|
|
**For Existing Deployments**: Database rename required
|
|
|
|
**Option 1: Rename Existing Database** (preserves data):
|
|
```sql
|
|
SELECT pg_terminate_backend(pid) FROM pg_stat_activity
|
|
WHERE datname = 'atm_incident' AND pid <> pg_backend_pid();
|
|
ALTER DATABASE atm_incident RENAME TO hiveops_incident;
|
|
```
|
|
|
|
**Option 2: Fresh Database** (clean start):
|
|
```bash
|
|
./devops-scripts/setup-database.sh # Already updated with new name
|
|
```
|
|
|
|
## Risk Mitigation
|
|
|
|
**Java Package Rename Risk**: Update content before moving files; use `git mv` to preserve history
|
|
**Database Risk**: Rename instead of recreate; backup first
|
|
**Rollback**: Git branch preserved; can revert commits or reset to previous state
|
|
|
|
## Success Criteria
|
|
|
|
- [ ] All 93 Java files use `com.hiveops.incident` package
|
|
- [ ] Zero references to `com.atm.incident` in codebase
|
|
- [ ] All containers use `hiveops-incident-*` prefix
|
|
- [ ] Database name is `hiveops_incident` everywhere
|
|
- [ ] Backend compiles successfully (`mvn clean compile`)
|
|
- [ ] Frontend builds without errors (`npm run check`)
|
|
- [ ] Docker Compose starts all services
|
|
- [ ] API endpoints respond correctly
|
|
- [ ] hiveops-agent integration works
|
|
|
|
## Verification Commands
|
|
|
|
After implementation, run:
|
|
```bash
|
|
# Check for any remaining old references
|
|
grep -r "com\.atm\.incident\|atm-incident\|atm_incident" . \
|
|
--exclude-dir={.git,node_modules,target} \
|
|
--include=\*.{java,properties,yml,yaml,json,sh,md}
|
|
|
|
# Should return empty or only in docs/CLAUDE.md as historical reference
|
|
```
|