Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions run_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,33 @@ ensure_minimum_balance() {
echo ""
}

# Function to add a volume to a service in a Docker Compose file
add_volume_to_service() {
local compose_file="$1"
local service_name="$2"
local volume_name="$3"
local volume_path="$4"

# Check if the Docker Compose file exists
if [ ! -f "$compose_file" ]; then
echo "Docker Compose file '$compose_file' not found."
return 1
fi

# Check if the service exists in the Docker Compose file
if ! grep -q "^[[:space:]]*${service_name}:" "$compose_file"; then
echo "Service '$service_name' not found in '$compose_file'."
return 1
fi

# Check if the volume is already defined for the service
if grep -q "^[[:space:]]*volumes:" "$compose_file"; then
sed -i "/^[[:space:]]*volumes:/a \ \ \ \ \ \ - ${volume_path}:${volume_name}:Z" "$compose_file"
else
sed -i "/^[[:space:]]*${service_name}:/a \ \ \ \ volumes:\n\ \ \ \ \ \ - ${volume_path}:${volume_name}:Z" "$compose_file"
fi
}


# ------------------
# Script starts here
Expand Down Expand Up @@ -413,5 +440,7 @@ poetry run autonomy deploy build --n $n_agents -ltm

cd ..

add_volume_to_service "$PWD/trader_service/abci_build/docker-compose.yaml" "trader_abci_0" "/data" "$PWD/../.trader_runner/"

# Run the deployment
poetry run autonomy deploy run --build-dir $directory --detach