Skip to content

Conversation

@VAIBHAVSING
Copy link
Owner

@VAIBHAVSING VAIBHAVSING commented Oct 30, 2025

Summary

This PR consolidates the storage architecture from 2 separate volumes to 1 unified volume across both Docker and Azure Container Instances deployments.

Problem

Previously, we mounted 2 separate Azure File Shares:

  • workspace volume → /workspace (user code/projects)
  • home volume → /home/dev8 (configs, extensions, packages)

This created unnecessary complexity in:

  • Azure storage management (2 file shares per workspace)
  • Docker volume configuration
  • Orchestration code (agent service)

Solution

Now we use a single unified volume:

  • dev8-data/home/dev8 (contains everything)
    • User configs, extensions, packages stored directly in /home/dev8
    • Workspace files stored in /home/dev8/workspace subdirectory

Changes Made

1. Agent Service (apps/agent/)

  • internal/azure/client.go:

    • Removed HomeFileShareName field from ContainerGroupSpec
    • Single volume dev8-data mounted to /home/dev8
    • Updated WORKSPACE_DIR env var: /workspace/home/dev8/workspace
  • internal/services/environment.go:

    • Changed from creating 2 file shares to 1 unified file share
    • Simplified parallel operations (3 goroutines → 2)
    • Updated VS Code Desktop URL path
  • internal/models/environment.go:

    • Updated documentation comments

2. Docker Configuration

  • docker-compose.yml & docker-compose.prod.yml:

    • Single volume dev8-data replaces dev8-home + dev8-workspace
    • Simplified volume configuration
  • deploy-to-aci.sh:

    • Creates single file share dev8-data (200GB quota)
    • Updated documentation

3. Documentation

  • Updated comments and logs throughout to reflect unified volume structure

Testing

  • ✅ Code compiles successfully
  • ✅ Azure client tests pass
  • ✅ Consistent with existing Docker Compose configuration

Benefits

  • 🎯 Simplified storage management (1 volume vs 2)
  • 💰 Reduced Azure storage costs (1 file share per workspace)
  • 🔧 Easier maintenance and troubleshooting
  • 📦 Consistent architecture across local Docker and cloud ACI
  • 🚀 All data in one place for backups/migrations

Migration Notes

For existing workspaces:

  • Old workspaces with 2 volumes will continue to work
  • New workspaces will use the unified volume structure
  • Manual migration guide available in documentation

Volume Structure

dev8-data (Azure File Share)
└── /home/dev8/
    ├── .sdkman/           # Java, Kotlin, Scala
    ├── .linuxbrew/        # Ruby, PostgreSQL  
    ├── .npm/              # Node packages
    ├── .local/            # Python packages
    ├── .cargo/            # Rust packages
    ├── .vscode-server/    # VS Code extensions
    └── workspace/         # User projects ← subdirectory

Files Changed

  • apps/agent/internal/azure/client.go (-29 lines)
  • apps/agent/internal/services/environment.go (-35 lines)
  • apps/agent/internal/models/environment.go (comments)
  • docker/docker-compose.yml (-29 lines)
  • docker/docker-compose.prod.yml (-13 lines)
  • docker/deploy-to-aci.sh (updated comments)
  • Documentation updates

Total: -76 net lines, simplified architecture

Summary by CodeRabbit

  • New Features

    • Added configurable container image name parameter to agent configuration.
  • Chores

    • Consolidated persistent storage volumes into a single unified volume for home and workspace directories.
    • Updated Docker deployment documentation and Azure container scripts to reflect the new unified storage architecture.
    • Updated API documentation with new connection endpoint examples.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Walkthrough

Consolidates separate Azure File shares (home and workspace) into a single unified volume throughout the codebase. Updates agent configuration, environment service logic, container provisioning, and Docker compose files to reference the consolidated storage model. Updates example API documentation URLs to reflect new workspace endpoints.

Changes

Cohort / File(s) Summary
Agent Configuration & Provisioning
apps/agent/internal/azure/client.go, apps/agent/internal/config/config.go, apps/agent/internal/models/environment.go
Removes separate HomeFileShareName from container spec; consolidates to single FileShareName field. Adds new ContainerImageName configuration field with environment variable support. Updates comments to reflect unified volume mounting at /home/dev8 with workspace subdirectory.
Environment Service
apps/agent/internal/services/environment.go
Refactors to create and manage single unified volume (fs-{workspaceID}) instead of separate workspace/home shares. Updates concurrent operations flow, error handling, and logging. Changes container image resolution to combine registry path when ACR is configured. Modifies VSCode Desktop URL path and removes home-volume-specific validations.
API Documentation
apps/agent/API_DOCUMENTATION.md
Updates example response URLs: switches vscode URL from HTTPS to HTTP endpoint and updates hostname references.
Docker Configuration
docker/docker-compose.yml, docker/docker-compose.prod.yml
Replaces separate dev8-home and dev8-workspace volume definitions with single dev8-data volume. Updates service mounts to reference consolidated volume at /home/dev8 path.
Docker Deployment
docker/deploy-to-aci.sh, docker/CONTAINER_CAPABILITIES.md
Updates Azure File share references from separate dev8-home/dev8-workspace to single dev8-data share. Increases consolidated share quota to 200. Updates backup/restore workflow and mount paths. Removes legacy multi-mount limitation notes.
Docker Documentation
docker/README.md
Consolidates "Azure File Shares" section into single "Azure File Share"; updates deployment instructions to reference unified dev8-data share and removes separate share setup references.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant EnvService as Environment Service
    participant Volume as Azure File Share
    participant Container as Container Group

    rect rgb(200, 220, 255)
    note over EnvService,Container: New Unified Flow
    Client->>EnvService: Create Environment
    EnvService->>Volume: Create unified fs-{workspaceID}
    Volume-->>EnvService: Share created
    EnvService->>Container: Create container with unified volume
    Container-->>EnvService: Container started
    EnvService-->>Client: Environment ready
    end

    rect rgb(255, 220, 200)
    note over EnvService,Container: Previous Separate Flow (removed)
    Client->>EnvService: Create Environment
    EnvService->>Volume: Create home share (parallel)
    EnvService->>Volume: Create workspace share (parallel)
    Volume-->>EnvService: Both shares ready
    EnvService->>Container: Create container with 2 volumes
    Container-->>EnvService: Container started
    EnvService-->>Client: Environment ready
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • services/environment.go: Major refactoring of environment creation, validation, and cleanup logic with concurrent operation flow changes; multiple control paths affected
  • azure/client.go: Public API modification removing HomeFileShareName field; requires validation that all callers updated appropriately
  • docker-compose files: Three configuration files with structural changes to volume definitions and mount paths; verify consistency across prod/non-prod variants
  • Cross-cutting consistency: Changes span from Go configuration/service layer through Docker compose definitions; verify all layers reference unified volume naming consistently

Possibly related PRs

Suggested labels

backend, enhancement

Poem

🐰 Hops 'round the volumes with glee,
One share where two used to be!
Home and workspace, now unified and neat,
Storage consolidation is quite the treat! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning While the pull request description is comprehensive and well-organized with detailed explanations of the problem, solution, changes, and benefits, it does not follow the required repository template structure. The description is missing several critical sections specified in the template: the "Type of Change" checkboxes for categorization, the "Related Issue" reference, the "Testing" section with specific checkboxes, the code quality "Checklist", and the "Environment Tested" section. Although the author provided useful testing information and detailed change documentation, the format diverges significantly from the prescribed template format rather than using its structured sections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Consolidate Azure volumes from 2 to 1 unified volume" directly and clearly summarizes the main change in the changeset. The title is specific, concise, and accurately reflects the core objective of consolidating storage from two separate Azure File Shares into a single unified volume across Docker and Azure Container Instances deployments. A teammate scanning the commit history would immediately understand the primary change without ambiguity or vague terminology.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch volume-reduce

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/agent/internal/azure/client.go (1)

107-117: Update Dockerfile defaults and entrypoint scripts to use new workspace path.

The env var update is correct, but several foundational references still default to /workspace:

  • docker/images/00-base/Dockerfile:85: WORKSPACE_DIR=/workspace/home/dev8/workspace
  • docker/images/20-vscode/entrypoint.sh:18: fallback default /workspace/home/dev8/workspace
  • docker/images/30-ai-tools/entrypoint.sh:18: fallback default /workspace/home/dev8/workspace
  • apps/supervisor/internal/config/config.go:65: config fallback /workspace/home/dev8/workspace
  • Volume mount targets in docker/docker-compose.yml:73, docker/Makefile:64, docker/scripts/build.sh:148: ensure mount target aligns (either mount to /home/dev8/workspace or keep /workspace consistency with all defaults)

Without these updates, the env var set in azure/client.go:112 won't prevent fallback to unmounted paths.

🧹 Nitpick comments (1)
apps/agent/internal/config/config.go (1)

24-29: Consider adding validation for ContainerImageName.

The new ContainerImageName field is loaded from the environment but isn't validated in the Validate() method (lines 199-228), unlike ContainerImage which is validated at line 215. If this field is required for operation, consider adding validation. If it's optional, documenting this with a comment would be helpful.

Can you verify whether ContainerImageName requires validation, or if it's intentionally optional?

Also applies to: 72-72

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed4265 and a4bdad5.

📒 Files selected for processing (10)
  • apps/agent/API_DOCUMENTATION.md (1 hunks)
  • apps/agent/internal/azure/client.go (2 hunks)
  • apps/agent/internal/config/config.go (2 hunks)
  • apps/agent/internal/models/environment.go (2 hunks)
  • apps/agent/internal/services/environment.go (10 hunks)
  • docker/CONTAINER_CAPABILITIES.md (1 hunks)
  • docker/README.md (2 hunks)
  • docker/deploy-to-aci.sh (2 hunks)
  • docker/docker-compose.prod.yml (1 hunks)
  • docker/docker-compose.yml (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
docker/deploy-to-aci.sh (1)
docker/shared/scripts/common.sh (1)
  • log_info (15-17)
apps/agent/internal/services/environment.go (1)
apps/agent/internal/models/environment.go (2)
  • ErrInternalServer (323-325)
  • ErrNotFound (319-321)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-base
  • GitHub Check: Build and Push
🔇 Additional comments (8)
docker/docker-compose.prod.yml (1)

73-85: LGTM! Clean consolidation to unified volume.

The single volume configuration is well-documented and correctly structured. The comments clearly explain the new layout where workspace data resides at /home/dev8/workspace within the unified volume.

docker/README.md (2)

100-104: LGTM! Clear documentation of unified volume structure.

The volume documentation accurately describes the consolidated storage approach with helpful details about what's stored under /home/dev8.


461-464: LGTM! Documentation reflects unified storage approach.

The Azure File Share section correctly documents the single dev8-data share creation with appropriate quota for combined home and workspace data.

docker/docker-compose.yml (1)

69-75: LGTM! Unified volume configuration is consistent.

The docker-compose configuration correctly implements the single dev8-data volume with clear documentation. The mount path and volume declaration align with the production configuration.

Also applies to: 99-109

apps/agent/internal/models/environment.go (1)

31-31: LGTM! Documentation updates reflect unified volume structure.

The comment updates accurately describe the consolidated storage approach and clarify the purpose of the unified AzureFileShare field.

Also applies to: 56-56

docker/CONTAINER_CAPABILITIES.md (1)

247-263: LGTM! Backup/restore workflow correctly updated.

All volume references in the backup/restore examples have been consistently updated from docker_dev8-home to docker_dev8-data, maintaining the workflow's functionality.

docker/deploy-to-aci.sh (2)

145-154: LGTM! Deployment script correctly implements unified storage.

The script properly creates a single dev8-data file share with an appropriate 200GB quota for combined home and workspace data. The comments clearly explain the storage structure.


216-217: LGTM! Volume mount configuration is correct.

The Azure File volume mount is correctly configured to use the unified dev8-data share at /home/dev8, consistent with the docker-compose configurations.

Comment on lines +274 to +275
"vscode": "http://ws-clxxx-yyyy-zzzz-aaaa-cccc.centralindia.azurecontainer.io",
"ssh": "ssh dev8@ws-clxxx-yyyy-zzzz-aaaa-cccc.centralindia.azurecontainer.io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix inconsistent workspace IDs in example response.

The connection URLs use workspace ID clxxx-yyyy-zzzz-aaaa-cccc (line 274-275), but other fields in the same response use clxxx-yyyy-zzzz-aaaa-bbbb:

  • Line 260: "id": "clxxx-yyyy-zzzz-aaaa-bbbb"
  • Line 271: "azureFileShare": "fs-clxxx-yyyy-zzzz-aaaa-bbbb"
  • Line 272: "azureFqdn": "ws-clxxx-yyyy-zzzz-aaaa-bbbb.centralindia.azurecontainer.io"

All fields in the example response should use the same workspace ID for consistency.

Additionally, note the protocol change from https to http at line 274, while line 340 uses https for the same URL type. Ensure this is intentional.

Apply this diff to fix the workspace ID consistency:

-        "vscode": "http://ws-clxxx-yyyy-zzzz-aaaa-cccc.centralindia.azurecontainer.io",
-        "ssh": "ssh [email protected]"
+        "vscode": "http://ws-clxxx-yyyy-zzzz-aaaa-bbbb.centralindia.azurecontainer.io",
+        "ssh": "ssh [email protected]"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"vscode": "http://ws-clxxx-yyyy-zzzz-aaaa-cccc.centralindia.azurecontainer.io",
"ssh": "ssh dev8@ws-clxxx-yyyy-zzzz-aaaa-cccc.centralindia.azurecontainer.io"
"vscode": "http://ws-clxxx-yyyy-zzzz-aaaa-bbbb.centralindia.azurecontainer.io",
"ssh": "ssh dev8@ws-clxxx-yyyy-zzzz-aaaa-bbbb.centralindia.azurecontainer.io"
🤖 Prompt for AI Agents
In apps/agent/API_DOCUMENTATION.md around lines 260–275, the example response
mixes workspace IDs (some use clxxx-yyyy-zzzz-aaaa-bbbb while the vscode/ssh
URLs use clxxx-yyyy-zzzz-aaaa-cccc) and the vscode URL uses http while elsewhere
https is used; update the vscode and ssh connection strings to use the same
workspace ID clxxx-yyyy-zzzz-aaaa-bbbb as the other fields and change the
protocol to https for the vscode URL (ensure ssh remains a valid ssh URI with
the corrected host) so all example fields are consistent.

@VAIBHAVSING VAIBHAVSING merged commit b93c5b7 into main Oct 30, 2025
12 of 13 checks passed
@VAIBHAVSING VAIBHAVSING deleted the volume-reduce branch October 30, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants