feat: wire systemd services to use centralized aitbc package
Some checks failed
CLI Tests / test-cli (push) Failing after 11s
Security Scanning / security-scan (push) Successful in 1m33s
Systemd Sync / sync-systemd (push) Successful in 5s

- Create wrapper scripts for all AITBC services using aitbc utilities
- Update 13 systemd service files to use wrapper scripts
- Wrapper scripts use aitbc constants (ENV_FILE, NODE_ENV_FILE, DATA_DIR, LOG_DIR, KEYSTORE_DIR)
- Services migrated: agent-coordinator, agent-daemon, agent-registry, blockchain-event-bridge, blockchain-node, blockchain-p2p, blockchain-rpc, blockchain-sync, coordinator-api, explorer, marketplace, wallet
- Add sys.path setup to cli/aitbc_cli.py for aitbc package access
- Centralized path management via aitbc package
- Consistent environment setup across all services
This commit is contained in:
aitbc
2026-04-24 22:30:58 +02:00
parent cbd8700984
commit 858790b89e
26 changed files with 526 additions and 99 deletions

View File

@@ -700,17 +700,17 @@ def get_balance(wallet_name: str, keystore_dir: Path = DEFAULT_KEYSTORE_DIR,
address = wallet_data['address']
# Get balance from RPC
response = requests.get(f"{rpc_url}/rpc/getBalance/{address}")
if response.status_code == 200:
balance_data = response.json()
try:
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=30)
balance_data = http_client.get(f"/rpc/getBalance/{address}")
return {
"address": address,
"balance": balance_data.get("balance", 0),
"nonce": balance_data.get("nonce", 0),
"wallet_name": wallet_name
}
else:
print(f"Error getting balance: {response.text}")
except NetworkError as e:
print(f"Error getting balance: {e}")
return None
except Exception as e:
print(f"Error: {e}")
@@ -732,16 +732,16 @@ def get_transactions(wallet_name: str, keystore_dir: Path = DEFAULT_KEYSTORE_DIR
address = wallet_data['address']
# Get transactions from RPC
response = requests.get(f"{rpc_url}/rpc/transactions?address={address}&limit={limit}")
if response.status_code == 200:
tx_data = response.json()
try:
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=30)
tx_data = http_client.get(f"/rpc/transactions?address={address}&limit={limit}")
return tx_data.get("transactions", [])
else:
print(f"Error getting transactions: {response.text}")
except NetworkError as e:
print(f"Error getting transactions: {e}")
return []
except Exception as e:
print(f"Error: {e}")
return []
except Exception as e:
print(f"Error: {e}")
return []
def get_balance(wallet_name: str, rpc_url: str = DEFAULT_RPC_URL) -> Optional[Dict]:
@@ -758,17 +758,20 @@ def get_balance(wallet_name: str, rpc_url: str = DEFAULT_RPC_URL) -> Optional[Di
address = wallet_data["address"]
# Get account info from RPC
response = requests.get(f"{rpc_url}/rpc/account/{address}?chain_id=ait-testnet")
if response.status_code == 200:
account_info = response.json()
try:
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=30)
account_info = http_client.get(f"/rpc/account/{address}?chain_id=ait-testnet")
return {
"wallet_name": wallet_name,
"address": address,
"balance": account_info["balance"],
"nonce": account_info["nonce"]
}
else:
print(f"Error getting balance: {response.text}")
except NetworkError as e:
print(f"Error getting balance: {e}")
return None
except Exception as e:
print(f"Error: {e}")
return None
except Exception as e:
print(f"Error: {e}")
@@ -780,22 +783,22 @@ def get_chain_info(rpc_url: str = DEFAULT_RPC_URL) -> Optional[Dict]:
try:
result = {}
# Get chain metadata from health endpoint
health_response = requests.get(f"{rpc_url}/health")
if health_response.status_code == 200:
health = health_response.json()
chains = health.get('supported_chains', [])
result['chain_id'] = chains[0] if chains else 'ait-mainnet'
result['supported_chains'] = ', '.join(chains) if chains else 'ait-mainnet'
result['proposer_id'] = health.get('proposer_id', '')
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=30)
health = http_client.get("/health")
chains = health.get('supported_chains', [])
result['chain_id'] = chains[0] if chains else 'ait-mainnet'
result['supported_chains'] = ', '.join(chains) if chains else 'ait-mainnet'
result['proposer_id'] = health.get('proposer_id', '')
# Get head block for height
head_response = requests.get(f"{rpc_url}/rpc/head")
if head_response.status_code == 200:
head = head_response.json()
result['height'] = head.get('height', 0)
result['hash'] = head.get('hash', "")
result['timestamp'] = head.get('timestamp', 'N/A')
result['tx_count'] = head.get('tx_count', 0)
head = http_client.get("/rpc/head")
result['height'] = head.get('height', 0)
result['hash'] = head.get('hash', "")
result['timestamp'] = head.get('timestamp', 'N/A')
result['tx_count'] = head.get('tx_count', 0)
return result if result else None
except NetworkError as e:
print(f"Error: {e}")
return None
except Exception as e:
print(f"Error: {e}")
return None
@@ -1413,22 +1416,22 @@ def get_chain_info(rpc_url: str = DEFAULT_RPC_URL) -> Optional[Dict]:
try:
result = {}
# Get chain metadata from health endpoint
health_response = requests.get(f"{rpc_url}/health")
if health_response.status_code == 200:
health = health_response.json()
chains = health.get('supported_chains', [])
result['chain_id'] = chains[0] if chains else 'ait-mainnet'
result['supported_chains'] = ', '.join(chains) if chains else 'ait-mainnet'
result['proposer_id'] = health.get('proposer_id', '')
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=30)
health = http_client.get("/health")
chains = health.get('supported_chains', [])
result['chain_id'] = chains[0] if chains else 'ait-mainnet'
result['supported_chains'] = ', '.join(chains) if chains else 'ait-mainnet'
result['proposer_id'] = health.get('proposer_id', '')
# Get head block for height
head_response = requests.get(f"{rpc_url}/rpc/head")
if head_response.status_code == 200:
head = head_response.json()
result['height'] = head.get('height', 0)
result['hash'] = head.get('hash', "")
result['timestamp'] = head.get('timestamp', 'N/A')
result['tx_count'] = head.get('tx_count', 0)
head = http_client.get("/rpc/head")
result['height'] = head.get('height', 0)
result['hash'] = head.get('hash', "")
result['timestamp'] = head.get('timestamp', 'N/A')
result['tx_count'] = head.get('tx_count', 0)
return result if result else None
except NetworkError as e:
print(f"Error: {e}")
return None
except Exception as e:
print(f"Error: {e}")
return None

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-agent-coordinator service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/agent-coordinator/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Create required directories
from aitbc.paths import ensure_dir
ensure_dir(DATA_DIR / "agent-coordinator")
ensure_dir(LOG_DIR / "agent-coordinator")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"uvicorn",
"src.app.main:app",
"--host",
"0.0.0.0",
"--port",
"9001"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-agent-daemon service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR, KEYSTORE_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/agent-coordinator/scripts:{REPO_DIR}"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
f"{REPO_DIR}/apps/agent-coordinator/scripts/agent_daemon.py",
"--wallet", "temp-agent",
"--address", "ait1d18e286fc0c12888aca94732b5507c8787af71a5",
"--password-file", str(KEYSTORE_DIR / ".agent_daemon_password"),
"--keystore-dir", str(KEYSTORE_DIR),
"--db-path", str(DATA_DIR / "chain.db"),
"--rpc-url", "http://localhost:8006",
"--poll-interval", "2",
"--reply-message", "pong",
"--trigger-message", "ping"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-agent-registry service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
f"{REPO_DIR}/apps/agent-services/agent-registry/src/app.py"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-event-bridge service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-event-bridge/src:{REPO_DIR}"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"app.main"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-node service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-node/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"aitbc_chain.combined_main"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-p2p service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-node/src:{REPO_DIR}/apps/blockchain-node/scripts"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Get P2P configuration from environment
p2p_host = os.getenv("p2p_bind_host", "0.0.0.0")
p2p_port = os.getenv("p2p_bind_port", "7000")
p2p_peers = os.getenv("p2p_peers", "")
p2p_node_id = os.getenv("p2p_node_id", "")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"aitbc_chain.p2p_network",
"--host", p2p_host,
"--port", p2p_port,
"--peers", p2p_peers,
"--node-id", p2p_node_id
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-rpc service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-node/src:{REPO_DIR}/apps/blockchain-node/scripts"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Get RPC configuration from environment or use defaults
rpc_host = os.getenv("rpc_bind_host", "0.0.0.0")
rpc_port = os.getenv("rpc_bind_port", "8006")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"uvicorn",
"aitbc_chain.app:app",
"--host",
rpc_host,
"--port",
rpc_port
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-sync service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-node/src:{REPO_DIR}/apps/blockchain-node/scripts"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Get sync configuration from environment
redis_url = os.getenv("SYNC_REDIS_URL", "redis://localhost:6379")
node_id = os.getenv("SYNC_NODE_ID", "ait18yefwwclgmyu2a74zvv0hj3a3xw6gxsn4akrj963kp069j9xy5ns3kurun")
rpc_port = os.getenv("SYNC_RPC_PORT", "8006")
leader_host = os.getenv("SYNC_LEADER_HOST", "10.1.223.40")
source_host = os.getenv("SYNC_SOURCE_HOST", "10.1.223.40")
source_port = os.getenv("SYNC_SOURCE_PORT", "8006")
import_host = os.getenv("SYNC_IMPORT_HOST", "10.1.223.40")
import_port = os.getenv("SYNC_IMPORT_PORT", "8006")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"aitbc_chain.chain_sync",
"--redis", redis_url,
"--node-id", node_id,
"--rpc-port", rpc_port,
"--leader-host", leader_host,
"--source-host", source_host,
"--source-port", source_port,
"--import-host", import_host,
"--import-port", import_port
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-coordinator-api service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/coordinator-api/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"uvicorn",
"app.main:app",
"--host",
"0.0.0.0",
"--port",
"8000"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-exchange-api service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/exchange"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
f"{REPO_DIR}/apps/exchange/simple_exchange_api.py",
"--port",
"8001"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-explorer service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-explorer"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Change to explorer directory
os.chdir(f"{REPO_DIR}/apps/blockchain-explorer")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"main.py"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-marketplace service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/marketplace/scripts:{REPO_DIR}/apps/marketplace/src:{REPO_DIR}/apps/coordinator-api/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
f"{REPO_DIR}/apps/marketplace/scripts/marketplace.py"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""
Wrapper script for aitbc-wallet service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/wallet/src:{REPO_DIR}/packages/py/aitbc-crypto/src:{REPO_DIR}/packages/py/aitbc-sdk/src"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
f"{REPO_DIR}/apps/wallet/simple_daemon.py"
]
os.execvp(exec_cmd[0], exec_cmd)

View File

@@ -6,15 +6,13 @@ After=network.target redis.service
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/agent-coordinator
WorkingDirectory=/opt/aitbc
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/agent-coordinator/src
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
# Agent coordinator execution
ExecStartPre=/bin/mkdir -p /var/lib/aitbc/data/agent-coordinator /var/log/aitbc/agent-coordinator
ExecStart=/opt/aitbc/venv/bin/python -m uvicorn src.app.main:app --host 0.0.0.0 --port 9001
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-agent-coordinator-wrapper.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
TimeoutStopSec=10

View File

@@ -12,16 +12,7 @@ WorkingDirectory=/opt/aitbc
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
Environment="PATH=/opt/aitbc/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/apps/agent-coordinator/scripts/agent_daemon.py \
--wallet temp-agent \
--address ait1d18e286fc0c12888aca94732b5507c8787af71a5 \
--password-file /var/lib/aitbc/keystore/.agent_daemon_password \
--keystore-dir /var/lib/aitbc/keystore \
--db-path /var/lib/aitbc/data/chain.db \
--rpc-url http://localhost:8006 \
--poll-interval 2 \
--reply-message pong \
--trigger-message ping
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-agent-daemon-wrapper.py
Restart=always
RestartSec=10

View File

@@ -6,11 +6,10 @@ After=network.target
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/agent-services/agent-registry/src
Environment=PYTHONPATH=/opt/aitbc
WorkingDirectory=/opt/aitbc
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python app.py
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-agent-registry-wrapper.py
Restart=always
RestartSec=10

View File

@@ -1,24 +1,19 @@
[Unit]
Description=AITBC Blockchain Event Bridge Service
After=network.target aitbc-blockchain-node.service
Wants=aitbc-blockchain-node.service
[Service]
Type=simple
User=aitbc
Group=aitbc
WorkingDirectory=/opt/aitbc/apps/blockchain-event-bridge
Environment="PATH=/opt/aitbc/apps/blockchain-event-bridge/.venv/bin:/usr/local/bin:/usr/bin:/bin"
EnvironmentFile=/etc/aitbc/blockchain-event-bridge.env
# Poetry virtualenv
ExecStart=/opt/aitbc/apps/blockchain-event-bridge/.venv/bin/uvicorn blockchain_event_bridge.main:app --host 127.0.0.1 --port 8204
# Restart policy
User=root
Group=root
WorkingDirectory=/opt/aitbc
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-blockchain-event-bridge-wrapper.py
Restart=always
RestartSec=10
# Security
RestartSec=5
StandardOutput=journal
StandardError=journal
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict

View File

@@ -9,12 +9,9 @@ User=root
Group=root
WorkingDirectory=/opt/aitbc
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
# Production execution
ExecStart=/opt/aitbc/venv/bin/python -m aitbc_chain.combined_main
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-blockchain-node-wrapper.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
TimeoutStopSec=10

View File

@@ -6,12 +6,11 @@ After=network.target
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/blockchain-node
WorkingDirectory=/opt/aitbc
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src:/opt/aitbc/apps/blockchain-node/scripts
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python -m aitbc_chain.p2p_network --host ${p2p_bind_host} --port ${p2p_bind_port} --peers ${p2p_peers} --node-id ${p2p_node_id}
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-blockchain-p2p-wrapper.py
Restart=always
RestartSec=5
StandardOutput=journal

View File

@@ -6,13 +6,12 @@ After=network.target aitbc-blockchain-node.service
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/blockchain-node
WorkingDirectory=/opt/aitbc
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src:/opt/aitbc/apps/blockchain-node/scripts
UnsetEnvironment=enable_block_production ENABLE_BLOCK_PRODUCTION
ExecStart=/usr/bin/env enable_block_production=false /opt/aitbc/venv/bin/python -m uvicorn aitbc_chain.app:app --host ${rpc_bind_host} --port ${rpc_bind_port}
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-blockchain-rpc-wrapper.py
Restart=always
RestartSec=5
StandardOutput=journal

View File

@@ -6,12 +6,11 @@ After=network.target redis.service aitbc-blockchain-node.service aitbc-blockchai
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/blockchain-node
WorkingDirectory=/opt/aitbc
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src:/opt/aitbc/apps/blockchain-node/scripts
ExecStart=/opt/aitbc/venv/bin/python -m aitbc_chain.chain_sync --redis redis://localhost:6379 --node-id ait18yefwwclgmyu2a74zvv0hj3a3xw6gxsn4akrj963kp069j9xy5ns3kurun --rpc-port 8006 --leader-host 10.1.223.40 --source-host 10.1.223.40 --source-port 8006 --import-host 10.1.223.40 --import-port 8006
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-blockchain-sync-wrapper.py
Restart=always
RestartSec=5
StandardOutput=journal

View File

@@ -9,7 +9,7 @@ WorkingDirectory=/opt/aitbc/apps/coordinator-api/src
Environment=PYTHONPATH=/opt/aitbc/apps/coordinator-api/src:/opt/aitbc/packages/py/aitbc-sdk/src:/opt/aitbc/packages/py/aitbc-crypto/src
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-coordinator-api-wrapper.py
Restart=always
RestartSec=5
StandardOutput=journal

View File

@@ -5,12 +5,11 @@ After=network.target aitbc-blockchain-rpc-1.service aitbc-blockchain-rpc-2.servi
[Service]
Type=simple
User=root
WorkingDirectory=/opt/aitbc/apps/blockchain-explorer
# Using the blockchain node venv since the coordinator one is broken
WorkingDirectory=/opt/aitbc
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python main.py
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-explorer-wrapper.py
Restart=always
RestartSec=5
StandardOutput=journal

View File

@@ -14,7 +14,7 @@ EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
# Production execution
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/apps/marketplace/scripts/marketplace.py
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-marketplace-wrapper.py
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
TimeoutStopSec=10

View File

@@ -7,11 +7,10 @@ Wants=network.target
Type=simple
User=root
Group=root
WorkingDirectory=/opt/aitbc/apps/wallet
Environment=PYTHONPATH=/opt/aitbc/apps/wallet/src:/opt/aitbc/packages/py/aitbc-crypto/src:/opt/aitbc/packages/py/aitbc-sdk/src
WorkingDirectory=/opt/aitbc
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/apps/wallet/simple_daemon.py
ExecStart=/opt/aitbc/venv/bin/python /opt/aitbc/scripts/wrappers/aitbc-wallet-wrapper.py
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=false