Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 55s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 6s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 5s
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Documentation Validation / validate-docs (push) Failing after 11s
Documentation Validation / validate-policies-strict (push) Successful in 2s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 2s
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 25m16s
P2P Network Verification / p2p-verification (push) Successful in 2s
- Remove conditional checks for settings.enforce_state_root_validation - Always enforce state root validation (no warning-only path) - Simplify error handling to always reject on mismatch - Update genesis metadata validation to always enforce - State root validation is now mandatory across all nodes
5.3 KiB
5.3 KiB
PostgreSQL Migration Complete
Date: 2026-05-03
Status: ✅ Complete
Summary
Migrated SQLite databases to PostgreSQL to resolve recurring database corruption issues on Btrfs filesystems. All critical services now use PostgreSQL for production nodes.
Migrations Completed
1. Mempool Database
- Status: ✅ Complete (all nodes)
- Nodes: localhost, aitbc1, gitea-runner
- Database:
aitbc_mempool - User:
aitbc_mempool - Connection:
postgresql+psycopg://aitbc_mempool:password@localhost:5432/aitbc_mempool - Changes:
- Updated
mempool.pyto use SQLAlchemy with PostgreSQL - Created dedicated
mempool_metadatato avoid chain table conflicts - Used raw SQL for table creation with
session.exec(text(...)) - Fixed count query bug using
func.count()and.one() - Added systemd drop-in
mempool-postgres.confon all nodes
- Updated
- Issues Fixed:
- SQLite corruption on Btrfs filesystem
- Missing
psycopgmodule on aitbc1 and gitea-runner - ScalarResult count attribute error
2. Exchange Database
- Status: ✅ Complete (all nodes)
- Nodes: localhost, aitbc1, gitea-runner
- Database:
aitbc_exchange - User:
aitbc_exchange - Connection:
postgresql+psycopg://aitbc_exchange:password@localhost:5432/aitbc_exchange - Changes:
- Updated systemd drop-in
exchange-postgres.confon all nodes - Set
EXCHANGE_DATABASE_URLenvironment variable
- Updated systemd drop-in
- Tables: orders, trades
3. Coordinator Database
- Status: ✅ Complete (localhost, aitbc1), ⚠️ SQLite fallback (gitea-runner)
- Nodes: localhost (PostgreSQL), aitbc1 (PostgreSQL), gitea-runner (SQLite)
- Database:
aitbc_coordinator - User:
aitbc_coordinator - Connection:
postgresql+psycopg://aitbc_coordinator:password@localhost:5432/aitbc_coordinator - Changes:
- Updated systemd drop-in
coordinator-postgres.confon localhost and aitbc1 - Set
DATABASE_ADAPTER=postgresqlandDATABASE_URLenvironment variables
- Updated systemd drop-in
- Gitea-runner Note: Coordinator uses SQLite fallback due to pydantic-settings nested config issues. PostgreSQL tables exist but service defaults to SQLite.
- Tables: job, job_payments, jobreceipt, marketplacebid, marketplaceoffer, miner, payment_escrows, transaction, user, usersession, wallet (11 tables)
Additional Fixes
Gitea-runner Blockchain Node
- Status: ✅ Fixed
- Issues Resolved:
- Service was inactive (dead) since 21:17:57
- Missing
psycopgmodule - Missing PostgreSQL user/database for mempool
- Outdated
mempool.pywith count query bug
- Actions Taken:
- Installed
psycopgmodule - Created PostgreSQL user
aitbc_mempooland databaseaitbc_mempool - Granted privileges
- Synced updated
mempool.pywithfunc.count()fix - Restarted service successfully
- Installed
Legacy Coordinator Service
- Status: ✅ Removed
- Action: Removed stale symlink
/etc/systemd/system/multi-user.target.wants/coordinator-api.serviceon gitea-runner - Reason: Legacy service causing confusion, modern
aitbc-agent-coordinator.serviceis the correct service
Documentation Updates
Updated documentation files to reflect PostgreSQL migrations:
/opt/aitbc/docs/apps/blockchain/blockchain-node.md- Added PostgreSQL mempool persistence note/opt/aitbc/docs/apps/exchange/exchange.md- Clarified PostgreSQL as production default/opt/aitbc/docs/apps/coordinator/coordinator-api.md- Added database configuration section
Configuration Details
Systemd Drop-ins
Mempool (/etc/systemd/system/aitbc-blockchain-node.service.d/mempool-postgres.conf):
[Service]
Environment="MEMPOOL_DB_URL=postgresql+psycopg://aitbc_mempool:password@localhost:5432/aitbc_mempool"
Exchange (/etc/systemd/system/aitbc-exchange-api.service.d/exchange-postgres.conf):
[Service]
Environment="EXCHANGE_DATABASE_URL=postgresql+psycopg://aitbc_exchange:password@localhost:5432/aitbc_exchange"
Coordinator (/etc/systemd/system/aitbc-agent-coordinator.service.d/coordinator-postgres.conf):
[Service]
Environment="DATABASE_ADAPTER=postgresql"
Environment="DATABASE_URL=postgresql+psycopg://aitbc_coordinator:password@localhost:5432/aitbc_coordinator"
PostgreSQL Setup
Users Created
aitbc_mempool- for mempool databaseaitbc_exchange- for exchange databaseaitbc_coordinator- for coordinator database
Databases Created
aitbc_mempool- mempool persistenceaitbc_exchange- exchange trading dataaitbc_coordinator- job coordination data
Privileges
All users granted ALL PRIVILEGES on their respective databases.
Verification
All services verified active and healthy:
aitbc-blockchain-node.service- active on all nodesaitbc-exchange-api.service- active on all nodesaitbc-agent-coordinator.service- active on all nodes
PostgreSQL tables verified created and accessible.
Benefits
- Eliminated SQLite corruption risk on Btrfs filesystems
- Improved database reliability and performance
- Better connection pooling and scalability
- Consistent database backend across production nodes
- Reduced maintenance overhead for database repairs
Known Limitations
- Coordinator on gitea-runner uses SQLite fallback due to pydantic-settings nested config issues
- PostgreSQL not required on gitea-runner for coordinator (SQLite is acceptable for this CI/runner node)