From d51fd2da4665f98a4ca123f8073adb9f938e9bf0 Mon Sep 17 00:00:00 2001 From: Eric Lavigne Date: Wed, 24 Sep 2025 10:50:17 -0600 Subject: [PATCH] SERVER-111374: Update docs to recommend cloning in a named volume for devcontainers (#41736) GitOrigin-RevId: b2ae307b6831f2669f044af0253f80bb490c2b38 --- .devcontainer/devcontainer.json | 1 + docs/devcontainer-setup.md | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4966fb40d47..37f1510e636 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -42,6 +42,7 @@ "venvActivation": "echo 'source ${containerWorkspaceFolder}/python3-venv/bin/activate && ${containerWorkspaceFolder}/buildscripts/poetry_sync.sh' >> ~/.bashrc && echo 'source ${containerWorkspaceFolder}/python3-venv/bin/activate && ${containerWorkspaceFolder}/buildscripts/poetry_sync.sh' >> ~/.zshrc;", "createDataDir": "sudo mkdir -p /data/db && sudo chown -R $(whoami): /data/db" }, + "shutdownAction": "none", "customizations": { "vscode": { "settings": { diff --git a/docs/devcontainer-setup.md b/docs/devcontainer-setup.md index 16f33ef70d7..d324d38cd3a 100644 --- a/docs/devcontainer-setup.md +++ b/docs/devcontainer-setup.md @@ -27,20 +27,31 @@ Afterwards, it is recommended to increase the amount of CPU and Memory available ## Setup Instructions -### 1. Clone the MongoDB Repository +### 1. Install the Remote Containers VSCode Extension + +Install the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension from the VSCode marketplace. + +### 2. Clone the MongoDB Repository in a Named Container Volume + +For best performance and compatibility (especially with Bazel on macOS), **do not clone the repository to your local filesystem first**. Instead, open VSCode and use the VSCode command palette: + +1. Open the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac). +2. Run **"Dev Containers: Clone Repository in Named Container Volume..."** +3. Enter the repository URL (it is recommended you use the ssh url) +4. Use whatever name you like for the named volume, this name will be presented in the docker volume list if you need to reference it later. +5. VS Code will automatically set up the devcontainer in an isolated volume, improving performance and resolving compatibility issues with Bazel on macOS filesystems over using a bind-mounted workspace. + +If you have already cloned the repository locally, you can still use the command above for a better experience. + +### 3. Fetch Complete Git History (Recommended) + +After the container opens for the first time, it's recommended to run the following command in the terminal to fetch the complete git history since the above clone workflow may only do a shallow clone: ```bash -git clone https://github.com/mongodb/mongo.git -cd mongo +git fetch --unshallow --all ``` -### 2. Install the Remote Containers VSCode Extension - -Install the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension from the VSCode marketplace. - -### 3. Open the clone in VSCode - -You may be automatically prompted to open the devcontainer and can confirm. If this does not happen, open the VSCode command palette and enter ">Dev Containers: Reopen in Container". +This ensures you have access to the full repository history and all branches, which may be needed for certain development workflows (e.g., `bazel build install-dist`). ### 4. Access Your Development Environment