Enhance Docker integration and API for container management

- Implemented Docker container scanning and periodic updates in the Server initialization.
- Added new RPC endpoints for managing Docker containers, including start, stop, and restart functionalities.
- Updated the API to handle package management for Docker-based applications.
- Improved environment variable handling for user-specific configurations in Podman and Docker clients.
- Enhanced the development startup script to include Docker container management and provide clearer instructions for full stack setup.
This commit is contained in:
Dorian
2026-01-27 23:21:26 +00:00
parent 3b3f70276f
commit 30ed48ad1b
17 changed files with 2076 additions and 20 deletions

View File

@@ -55,7 +55,7 @@ case $choice in
;;
2)
echo ""
echo "🔧 Starting FULL STACK (Archipelago backend + frontend)..."
echo "🔧 Starting FULL STACK (Archipelago backend + frontend + Docker apps)..."
# Kill ports
echo " 🧹 Cleaning up ports 5959 and 8100..."
@@ -63,6 +63,26 @@ case $choice in
lsof -ti:8100 | xargs kill -9 2>/dev/null || true
sleep 1
# Start Docker containers first
echo ""
echo " 🐳 Starting Docker containers..."
if [ -f "$PROJECT_ROOT/start-docker-apps.sh" ]; then
bash "$PROJECT_ROOT/start-docker-apps.sh"
if [ $? -ne 0 ]; then
echo "❌ Failed to start Docker containers."
echo " You can continue without Docker, but apps won't be available."
read -p " Continue anyway? (y/N) " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
else
echo "⚠️ start-docker-apps.sh not found, skipping Docker startup."
echo " Apps will not be available."
fi
echo ""
# Check if backend can build
echo " 🔨 Checking backend build..."
if [ ! -d "$BACKEND_DIR" ]; then
@@ -91,6 +111,7 @@ case $choice in
export ARCHIPELAGO_LOG_LEVEL=debug
export ARCHIPELAGO_PORT_OFFSET=10000
export ARCHIPELAGO_BITCOIN_SIMULATION=mock
export ARCHIPELAGO_CONTAINER_RUNTIME=docker
cargo run --bin archipelago > /tmp/archipelago-backend.log 2>&1 &
BACKEND_PID=$!
@@ -130,10 +151,12 @@ case $choice in
npm install
fi
# Trap to kill backend on exit
# Trap to kill backend on exit (Docker containers keep running)
trap "kill $BACKEND_PID 2>/dev/null" EXIT
echo " (Press Ctrl+C to stop both servers)"
echo ""
echo " (Press Ctrl+C to stop servers)"
echo " 💡 Docker containers will keep running. Use 'docker compose down' to stop them."
echo ""
npm run dev
;;
@@ -196,17 +219,27 @@ case $choice in
echo " cd $FRONTEND_DIR"
echo " npm run dev:mock"
echo ""
echo "For full stack (Archipelago backend + frontend):"
echo " Terminal 1 (Backend):"
echo "For full stack (Docker apps + Archipelago backend + frontend):"
echo " Terminal 1 (Docker Apps):"
echo " cd $PROJECT_ROOT"
echo " ./start-docker-apps.sh"
echo ""
echo " Terminal 2 (Backend):"
echo " cd $BACKEND_DIR"
echo " export ARCHIPELAGO_CONTAINER_RUNTIME=docker"
echo " export ARCHIPELAGO_DEV_MODE=true"
echo " cargo run --bin archipelago"
echo ""
echo " Terminal 2 (Frontend):"
echo " Terminal 3 (Frontend):"
echo " cd $FRONTEND_DIR"
echo " npm run dev"
echo ""
echo "Then open: http://localhost:8100"
echo ""
echo "To stop Docker apps:"
echo " cd $PROJECT_ROOT"
echo " ./stop-docker-apps.sh"
echo ""
echo "Mock backend dev modes:"
echo " VITE_DEV_MODE=setup - First-time setup flow"
echo " VITE_DEV_MODE=onboarding - Onboarding flow"