- Log full message content instead of just hash - Log full tool input arguments - Log full tool output/results - Add model info to session and token events No privacy restrictions for internal monitoring.
79 lines
2.4 KiB
Bash
Executable File
79 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Oh My OpenCode Free - Reload Script
|
|
# Reloads configuration changes without full rebuild when possible
|
|
|
|
set -e
|
|
|
|
echo "🔄 Reloading Oh My OpenCode Free Edition..."
|
|
|
|
if command -v docker &> /dev/null; then
|
|
CONTAINER_CMD="docker"
|
|
elif command -v podman &> /dev/null; then
|
|
CONTAINER_CMD="podman"
|
|
else
|
|
echo "❌ Neither Docker nor Podman found."
|
|
exit 1
|
|
fi
|
|
|
|
echo "📦 Using $CONTAINER_CMD"
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
CONTAINER_NAME="leader"
|
|
|
|
# Check if container exists and is running
|
|
if ! $CONTAINER_CMD ps -q -f name="$CONTAINER_NAME" | grep -q .; then
|
|
echo "❌ Container '$CONTAINER_NAME' is not running."
|
|
echo "💡 Run './start.sh' first to start the container."
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Container '$CONTAINER_NAME' is running."
|
|
|
|
# Check if config files have changed (now requires rebuild)
|
|
CONFIG_CHANGED=false
|
|
if [ "docker/shared-config/oh-my-opencode.json" -nt ".last_reload" ] 2>/dev/null || \
|
|
[ "docker/shared-config/opencode.jsonc" -nt ".last_reload" ] 2>/dev/null; then
|
|
REBUILD_NEEDED=true
|
|
echo "📝 Configuration files have changed - rebuild required."
|
|
fi
|
|
|
|
# Check if Dockerfile or docker-compose changed (requires rebuild)
|
|
REBUILD_NEEDED=false
|
|
if [ "docker/Dockerfile.leader" -nt ".last_reload" ] 2>/dev/null || \
|
|
[ "docker/docker-compose.yml" -nt ".last_reload" ] 2>/dev/null; then
|
|
REBUILD_NEEDED=true
|
|
echo "🏗️ Docker files changed - full rebuild required."
|
|
fi
|
|
|
|
if [ "$REBUILD_NEEDED" = true ]; then
|
|
echo "🔄 Performing full container rebuild..."
|
|
|
|
# Stop current container
|
|
echo "🛑 Stopping current container..."
|
|
$CONTAINER_CMD compose -f docker/docker-compose.yml down
|
|
|
|
# Rebuild and start
|
|
echo "🏗️ Rebuilding and starting container..."
|
|
$CONTAINER_CMD compose -f docker/docker-compose.yml up -d --build
|
|
|
|
echo "⏳ Waiting for rebuild to complete..."
|
|
sleep 10
|
|
|
|
# Verify new container is running
|
|
if $CONTAINER_CMD ps -q -f name="$CONTAINER_NAME" | grep -q .; then
|
|
echo "✅ Container rebuilt and running successfully!"
|
|
echo "🌐 Server available at: http://localhost:8080"
|
|
echo "📋 Attach with: opencode attach http://localhost:8080"
|
|
else
|
|
echo "❌ Failed to rebuild container. Check logs:"
|
|
echo " $CONTAINER_CMD logs $CONTAINER_NAME"
|
|
exit 1
|
|
fi
|
|
|
|
fi
|
|
|
|
# Update last reload timestamp
|
|
touch .last_reload
|
|
|
|
echo "🎯 Reload complete! Configuration changes are now active." |