feat: wire systemd services to use centralized aitbc package
- 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:
39
scripts/wrappers/aitbc-agent-coordinator-wrapper.py
Executable file
39
scripts/wrappers/aitbc-agent-coordinator-wrapper.py
Executable 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)
|
||||
38
scripts/wrappers/aitbc-agent-daemon-wrapper.py
Executable file
38
scripts/wrappers/aitbc-agent-daemon-wrapper.py
Executable 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)
|
||||
29
scripts/wrappers/aitbc-agent-registry-wrapper.py
Executable file
29
scripts/wrappers/aitbc-agent-registry-wrapper.py
Executable 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)
|
||||
30
scripts/wrappers/aitbc-blockchain-event-bridge-wrapper.py
Executable file
30
scripts/wrappers/aitbc-blockchain-event-bridge-wrapper.py
Executable 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)
|
||||
30
scripts/wrappers/aitbc-blockchain-node-wrapper.py
Executable file
30
scripts/wrappers/aitbc-blockchain-node-wrapper.py
Executable 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)
|
||||
40
scripts/wrappers/aitbc-blockchain-p2p-wrapper.py
Executable file
40
scripts/wrappers/aitbc-blockchain-p2p-wrapper.py
Executable 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)
|
||||
39
scripts/wrappers/aitbc-blockchain-rpc-wrapper.py
Executable file
39
scripts/wrappers/aitbc-blockchain-rpc-wrapper.py
Executable 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)
|
||||
48
scripts/wrappers/aitbc-blockchain-sync-wrapper.py
Executable file
48
scripts/wrappers/aitbc-blockchain-sync-wrapper.py
Executable 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)
|
||||
35
scripts/wrappers/aitbc-coordinator-api-wrapper.py
Executable file
35
scripts/wrappers/aitbc-coordinator-api-wrapper.py
Executable 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)
|
||||
31
scripts/wrappers/aitbc-exchange-api-wrapper.py
Normal file
31
scripts/wrappers/aitbc-exchange-api-wrapper.py
Normal 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)
|
||||
32
scripts/wrappers/aitbc-explorer-wrapper.py
Executable file
32
scripts/wrappers/aitbc-explorer-wrapper.py
Executable 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)
|
||||
29
scripts/wrappers/aitbc-marketplace-wrapper.py
Executable file
29
scripts/wrappers/aitbc-marketplace-wrapper.py
Executable 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)
|
||||
29
scripts/wrappers/aitbc-wallet-wrapper.py
Executable file
29
scripts/wrappers/aitbc-wallet-wrapper.py
Executable 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)
|
||||
Reference in New Issue
Block a user