58 Commits

Author SHA1 Message Date
a38cc08809 feat: skip leadership wait for rqlite nodes with existing state and add ports 4002/5002 to clear script 2025-08-09 08:45:47 +03:00
355c1c66b9 feat: add configurable P2P port for node startup in Makefile and CLI flags 2025-08-09 08:38:44 +03:00
a59d0f1fd6 feat: add configurable RQLite host advertising modes (auto/localhost/ip) 2025-08-09 08:19:18 +03:00
05798471dd fix: standardize rqlite join addresses to use host:port format without http scheme 2025-08-08 20:30:46 +03:00
b744f7f513 refactor: standardize ports (LibP2P 4001, RQLite 5001/7001) and remove .env configuration 2025-08-08 20:09:28 +03:00
8d57fc8f98 Remove bootstrap main.go file as part of project restructuring 2025-08-07 08:40:38 +03:00
d32a6934e9 Enhance AI_CONTEXT.md with additional functional requirements and improve formatting for clarity; include detailed descriptions for database operations, key-value storage, pub/sub messaging, and peer discovery. 2025-08-06 20:47:03 +03:00
9b69aa4432 Update documentation to reflect changes in node startup commands; unify bootstrap and regular node commands to use make run-node for improved clarity and ease of use. 2025-08-06 20:43:49 +03:00
f62b9c6423 Merge branch 'main' of https://git.debros.io/DeBros/network 2025-08-06 20:25:51 +03:00
8d9996e87a Add new main files for bootstrap and unified-node commands 2025-08-06 19:59:09 +03:00
9de528815c Disable RQLite authentication for testing
- Remove -auth flag from RQLite startup command
- Remove authentication credential loading logic
- Simplify join address handling without credentials
- Clean up unused authentication helper functions

This allows testing basic cluster functionality without auth complexity.
2025-08-06 13:35:50 +03:00
3af1b58eb4 Add comprehensive production security for RQLite clustering
Production Security Features:
- RQLite authentication with secure user management
- Firewall configuration with IP-based restrictions
- Automated credential generation and storage
- Authenticated cluster join addresses
- Credential masking in logs for security
- Helper scripts for secure RQLite connections

Network Architecture:
- Port 4000: Public LibP2P P2P (encrypted)
- Port 4001/4002: RQLite cluster (IP-restricted to cluster members)
- UFW firewall rules restricting RQLite access to cluster IPs only

Security Components:
- /opt/debros/configs/rqlite-users.json: User authentication
- /opt/debros/keys/rqlite-cluster-auth: Secure credential storage
- Automatic credential masking in logs
- Production-ready setup script

This implements enterprise-grade security for public network deployment
while maintaining seamless cluster communication between trusted nodes.
2025-08-06 13:29:09 +03:00
16a70a03aa Add comprehensive network connectivity diagnostics
- Add automated network diagnostics for RQLite join addresses
- Test port connectivity with netcat, HTTP responses, ping, and DNS
- Provide detailed troubleshooting information in logs
- Help identify exact causes of RQLite cluster join failures
- Test connectivity before attempting RQLite cluster join

This will help diagnose the 'invalid join address' error by showing exactly
why the connection to 57.129.81.31:4001 is failing.
2025-08-06 13:08:27 +03:00
56f0a01b79 Add RQLite join address connectivity testing
- Test join address reachability before attempting to join cluster
- Fall back to starting new cluster if join address is unreachable
- Add comprehensive logging for join address testing
- Prevent RQLite fatal errors when bootstrap node is down

This fixes the issue where secondary nodes fail with 'invalid join address'
when the primary bootstrap node is not accessible on port 4001.
2025-08-06 13:05:58 +03:00
e6a305a8a7 Fix RQLite join address validation and improve error handling
- Replace hardcoded fallback IP with localhost for better compatibility
- Add join address format validation
- Improve logging for better troubleshooting
- Add detailed RQLite startup logging with full args
2025-08-06 13:00:55 +03:00
79efd7b2c5 Fix RQLite advertised addresses for proper cluster formation
- Add automatic external IP detection for RQLite advertised addresses
- Use 0.0.0.0 for binding but actual IP for advertising to other nodes
- Add -http-adv-addr and -raft-adv-addr parameters to RQLite startup
- Resolves 'advertised HTTP address is not routable' error
- Enables proper RQLite cluster formation between nodes
2025-08-06 11:29:06 +03:00
2181b5ced0 Fix RQLite bind addresses to allow external connections
- Change RQLite HTTP bind from localhost to 0.0.0.0
- Change RQLite Raft bind from localhost to 0.0.0.0
- This allows secondary bootstrap nodes and regular nodes to join the cluster
- Resolves 'invalid join address' error for secondary bootstrap nodes
2025-08-06 11:24:40 +03:00
b529c32742 Update pkg/constants/bootstrap.go 2025-08-06 05:56:45 +00:00
089916b5dd Fix port conflict between RQLite and LibP2P
CRITICAL FIX: Separate RQLite and LibP2P ports to prevent service startup failures

Changes:
- LibP2P now uses port 4000 (was conflicting with RQLite on 4001)
- RQLite continues to use port 4001 for HTTP API
- RQLite Raft uses port 4002
- Updated bootstrap peer configurations to use port 4000
- Updated install script port configurations
- Fixed firewall configuration to allow correct ports

This resolves the 'bind: address already in use' error that was preventing
the debros-node service from starting properly.
2025-08-06 08:44:23 +03:00
cc276ccc22 Fix install script service management to only use debros-node
- Remove references to debros-bootstrap service in update logic
- Standardize on single debros-node service for all node types
- Fix service stopping/starting during updates
- Clean up legacy service references
2025-08-06 08:39:44 +03:00
79d4a3980f Add peer-id command to CLI for easy peer ID retrieval 2025-08-06 08:39:14 +03:00
dfa4de33b4 Fix multi-bootstrap RQLite cluster setup
- Primary bootstrap (57.129.81.31): starts new cluster (no join address)
- Secondary bootstrap (38.242.250.186): joins primary bootstrap cluster
- Regular nodes: join primary bootstrap cluster

This allows both VPS servers to be bootstrap nodes while forming a
proper RQLite cluster where the secondary bootstrap joins the primary
instead of trying to start its own independent cluster.

Should resolve the leadership establishment timeout on the second VPS.
2025-08-06 08:21:21 +03:00
37bf582932 Fix bootstrap node detection to prevent self-join in RQLite
The VPS at 57.129.81.31 was incorrectly trying to join itself as a
regular node instead of being detected as a bootstrap node.

Added isLocalIP() function to check if bootstrap peer IPs match
local machine IPs using 'ip addr show' and 'hostname -I' commands.

This should resolve the 'invalid join address' error where the
bootstrap node was trying to join http://57.129.81.31:4001 (itself).
2025-08-06 08:14:29 +03:00
5cef68c132 Fix bootstrap peer ID mismatch for 57.129.81.31
The actual running bootstrap node has peer ID:
12D3KooWJvJj94TmNwG1sntDWgAXi7MN3xxLLkoQzgHX6gQ22eKi

But the constants file had the wrong peer ID:
12D3KooWQRK2duw5B5LXi8gA7HBBFiCsLvwyph2ZU9VBmvbE1Nei

This mismatch was causing nodes to fail to connect to the bootstrap
node, leading to the 'invalid join address' error from RQLite.
2025-08-06 08:10:28 +03:00
480354267a Fix RQLite join address for regular nodes
- Regular nodes now join actual bootstrap nodes instead of localhost:4001
- Extract IP from bootstrap peer multiaddrs for RQLite join address
- Add fallback to first known bootstrap node (57.129.81.31:4001)
- This fixes the 'fatal: http://localhost:4001 is an invalid join address' error

Regular nodes will now properly join the RQLite cluster of bootstrap nodes
instead of trying to join themselves, which was causing startup failures.
2025-08-06 08:02:43 +03:00
3975b5a59d Fix debros-node service failing due to invalid -port flag
- Remove invalid -port flag from systemd service ExecStart command
- The node binary doesn't support -port flag, it uses hardcoded port 4001
- Fix variable name RAFT_NODE_PORT to RAFT_PORT in two places
- Update check_existing_installation to only check for node binary since bootstrap binary was removed

This resolves the service startup failure where the service was exiting with:
'flag provided but not defined: -port'
2025-08-06 07:51:23 +03:00
b9ef151643 Merge branch 'main' of https://git.debros.io/DeBros/network 2025-08-05 22:28:34 +03:00
cd74a2df68 Refactor node and bootstrap configurations for improved clarity and consistency; unify RQLite and Raft ports across nodes, update environment setup, and enhance logging for node operations. 2025-08-05 22:28:12 +03:00
f470884b42 Fix spacing issues in install script that were causing command failures
- Fixed variable references with extra spaces that caused chmod commands to fail
- Corrected '' variable interpolation in permission commands
- Script now properly sets directory permissions without syntax errors
2025-08-04 19:03:11 +03:00
0a0756d4da Update RQLite raft port to 7001 in configuration files 2025-08-04 18:51:42 +03:00
cad45efb71 Refactor go.mod to remove indirect dependency on godotenv and update RQLite node configuration 2025-08-04 18:51:11 +03:00
bf32cc2a49 Add production environment support for bootstrap peers and RQLite connections 2025-08-04 18:31:49 +03:00
9832e97ed8 Add additional bootstrap peer IDs for enhanced connectivity 2025-08-04 17:25:21 +03:00
7fd9870d0f Update bootstrap address for improved peer connectivity 2025-08-04 17:22:14 +03:00
115b64d8d2 Add additional bootstrap addresses for improved connectivity 2025-08-04 17:15:01 +03:00
0cabfd6381 Clean up output messages: remove duplicate 'node' and Node Type line
- Remove duplicate 'node node' references in service start messages
- Remove 'Node Type: node' line from completion output
- Simplify service messages to 'Starting/Started DeBros Network service'
- Simplify final success messages to remove redundant 'node' references
- Clean, professional output without confusing terminology duplication
2025-08-04 17:01:29 +03:00
d447f6546b Force NODE_TYPE to 'node' in update mode to complete bootstrap migration
- Remove logic that detects existing bootstrap.yaml and sets NODE_TYPE to 'bootstrap'
- Always use NODE_TYPE='node' in update mode for consistent terminology
- This ensures all services, configs, and outputs use 'node' terminology
- Completes the full migration from bootstrap to node naming convention
- Existing bootstrap installations will be updated to use node terminology
2025-08-04 16:58:07 +03:00
4f204a37f4 Fix final bootstrap port references in completion output
- Replace BOOTSTRAP_PORT, RQLITE_BOOTSTRAP_PORT, RAFT_BOOTSTRAP_PORT
  with NODE_PORT, RQLITE_NODE_PORT, RAFT_NODE_PORT in completion output
- Ensures all port variables are correctly defined and displayed
- Completes the full bootstrap-to-node terminology migration
2025-08-04 16:55:20 +03:00
946e2568bb Fix ExecStart command in systemd service to use NODE_PORT instead of BOOTSTRAP_PORT
- Update service creation to use NODE_PORT instead of undefined BOOTSTRAP_PORT
- This fixes the service startup failure where the wrong port variable was referenced
- Service command now correctly uses: /opt/debros/bin/node -data /opt/debros/data/node -port 4001
2025-08-04 16:54:52 +03:00
8b1fbdd9e3 Rename all bootstrap references to node in installation script
- Replace BOOTSTRAP_PORT with NODE_PORT (4001)
- Replace RQLITE_BOOTSTRAP_PORT with RQLITE_NODE_PORT (5001)
- Replace RAFT_BOOTSTRAP_PORT with RAFT_NODE_PORT (7001)
- Update port checks to use new node port variables
- Update configuration generation to use NODE_PORT variables
- Update firewall configuration to use node ports
- Update systemd service creation to use node terminology
- Simplify port management by removing separate bootstrap/node distinctions
- All installations now use consistent 'node' terminology
2025-08-04 16:51:52 +03:00
73d4d2b17b Fix Text file busy error during binary updates
- Stop running services before copying new binaries during update mode
- Wait 3 seconds for services to fully stop
- Restart services after successful binary update
- Prevents 'Text file busy' error when overwriting executable files
- Only affects update mode, fresh installs work normally
2025-08-04 16:46:41 +03:00
7e849ed778 Fix port conflict during updates
- Skip port availability check during update mode
- Existing services will be using the ports, so checking causes false conflicts
- Add log message explaining why port check is skipped
- This fixes the 'Port 4001 is already in use' error during updates
2025-08-04 16:43:37 +03:00
94ea521ffa Comprehensive README cleanup: Remove node type references and clarify permissions
- Remove references to bootstrap/regular node distinctions throughout
- Update ports from ranges (4001-4003) to single ports (4001)
- Change 'Node Types' section to 'Node Setup'
- Remove node type selection references in deployment section
- Update table of contents to reflect structural changes
- Clarify script execution requires elevated privileges (sudo bash)
- Add user permission guidance for server setup
- Simplify network discovery descriptions
- Update firewall and service management descriptions
- Keep development section intact as it still uses separate binaries
2025-08-04 16:35:49 +03:00
3d7b090b22 Update README to reflect install script changes
- Remove references to node type selection in deployment section
- Update directory structure to show single node configuration
- Update service management commands to use debros-node instead of debros-bootstrap
- Update configuration examples to show single node.yaml file
- Simplify node setup section to reflect bootstrap nodes named 'node'
- Update all maintenance and monitoring commands
- Keep development section unchanged as it still uses separate bootstrap/node binaries
2025-08-04 16:28:37 +03:00
e165dfd689 Fix script issues with root detection and node configuration
- Fix root confirmation prompt to use echo -n and read instead of read -rp
- Fix non-interactive mode to use NODE_TYPE='node' instead of 'bootstrap'
- Simplify firewall configuration to always use bootstrap ports for node
- Fix final installation summary to show correct ports for node type
- Ensure consistent behavior across all node type checks
2025-08-04 16:26:59 +03:00
6b0951c601 Remove node type selection and default to bootstrap node named 'node'
- Removed interactive node type selection (bootstrap vs regular)
- Set NODE_TYPE to 'node' by default
- Configure as bootstrap node but with 'node' naming
- Use bootstrap ports and configuration settings
- Simplified installation process by removing node type choice
2025-08-04 16:24:41 +03:00
676536d310 Implement root execution with security warning
- Add security warning when running as root
- Require explicit confirmation in interactive mode
- Allow automatic proceeding in non-interactive mode
- Use sudo alias approach for clean root execution
- Maintain security consciousness while enabling automation
- Prevent accidental root execution without user awareness
2025-08-04 16:03:04 +03:00
ec3cca20aa Fix script hanging issues - Add comprehensive non-interactive mode
Major fixes for script reliability:

Interactive Mode Issues:
- Added NON_INTERACTIVE detection when run via curl | bash
- Automatic defaults for config wizard in non-interactive mode
- Sensible fallbacks for existing installation handling

Potential Hang Points Fixed:
- Non-interactive mode uses bootstrap node type by default
- Placeholder Solana wallet for automated installs
- Auto-update existing installations without prompts
- Fixed log function definition order issue

Error Handling Improvements:
- Better network operation error handling
- Cleaner function organization
- Removed duplicate log function code

Now supports both interactive and non-interactive usage modes safely.
2025-08-04 15:10:17 +03:00
63ab2d54ac Add missing RQLite installation to install script
- Added install_rqlite() function with architecture detection
- Downloads and installs RQLite v8.30.0 from GitHub releases
- Supports amd64, arm64, and arm architectures
- Checks if RQLite is already installed before downloading
- Installs both rqlited and rqlite binaries to /usr/local/bin
- Added RQLite installation to main() function flow
- Verifies installation success and displays version
2025-08-04 14:57:32 +03:00
ee08f80821 Fix installation script URLs in README
- Update installation command to use correct Gitea repository URL
- Fix both installation and update commands to point to git.debros.io
- Replace GitHub URLs with proper DeBros Gitea instance URLs
2025-08-04 14:47:21 +03:00