This repository contains configuration and scripts for recreating my development environment on a new laptop or VDE.
I use Obsidian for note taking. Notes are stored as Markdown files and synced to a Git repository.
Install the following community plugins:
- Dataview: Creates dashboards for tracking tasks and other metadata.
- Git: Automatically synchronises the vault with GitHub.
- Templater: Applies templates to notes in different vault directories.
Visual Studio Code is the primary IDE.
Development takes place on an Ubuntu VDE connected through VS Code Remote SSH. A Fedora-based Distrobox provides the terminal development environment.
Install the following extensions:
- Remote - SSH
- Python
- Pylance
- Terraform
- YAML
- Markdown previewer
- One Dark Pro theme
The underlying VDE may need to be replaced when its Ubuntu version is upgraded. Distrobox reduces the amount of setup that must be repeated by providing a portable, Fedora-based development environment.
The Devbox image includes:
- Zsh and Powerlevel10k
- Python
- Poetry
- Terraform
- AWS CLI v2
- Docker CLI
- Git
- Common terminal and build tools
Local workstation
└── Visual Studio Code
└── Remote SSH
└── Ubuntu VDE
├── Git repositories
├── Docker Engine
├── Source-controlled shell configuration
└── Fedora Distrobox
├── Python and Poetry
├── Terraform
├── AWS CLI
├── Docker CLI
└── Development dependencies
Visual Studio Code edits files directly on the VDE.
Git repositories and shell configuration are stored in the VDE home directory. Distrobox shares this home directory, so the same files are available inside Devbox.
Docker Engine runs on the VDE. The Docker CLI inside Devbox connects to that daemon through /var/run/docker.sock. This is not Docker-in-Docker.
ch-laptop-setup/
├── Dockerfile
├── README.md
├── dotfiles/
│ ├── .zshrc
│ └── .p10k.zsh
└── scripts/
├── enter-devbox.sh
└── setup-docker-access.sh
The Ubuntu VDE must have:
- Docker Engine
- Distrobox
- Zsh
- Git
- Linuxbrew (Homebrew)
Docker must work without sudo on the VDE before configuring Devbox.
The source-controlled Zsh files are stored under dotfiles/.
Link them into the VDE home directory:
ln -sfn \
"$HOME/Documents/git/ch-laptop-setup/dotfiles/.zshrc" \
"$HOME/.zshrc"
ln -sfn \
"$HOME/Documents/git/ch-laptop-setup/dotfiles/.p10k.zsh" \
"$HOME/.p10k.zsh"Verify the links:
readlink -f ~/.zshrc
readlink -f ~/.p10k.zshCheck their syntax:
zsh -n ~/.zshrc
zsh -n ~/.p10k.zshNo output means the syntax is valid.
Restart Zsh:
exec zshThe same configuration is used on the VDE and inside Devbox because Distrobox shares the VDE home directory.
Powerlevel10k displays a DEVBOX segment whenever $CONTAINER_ID is set.
From the root of this repository:
docker build \
--tag devbox:latest \
.Confirm that the image exists:
docker image ls devboxTest the main tools:
docker run --rm devbox:latest python3 --version
docker run --rm devbox:latest poetry --version
docker run --rm devbox:latest terraform version
docker run --rm devbox:latest aws --version
docker run --rm devbox:latest zsh --version
docker run --rm devbox:latest docker --versionCreate the Distrobox from the local image:
distrobox create \
--name devbox \
--image devbox:latestEnter it:
distrobox enter devboxThe initial entry may take longer while Distrobox installs its integration packages.
Verify that the shell is inside Devbox:
echo "$CONTAINER_ID"
cat /etc/os-releaseExpected results include:
devbox
and Fedora operating system information.
Verify the installed tools:
python3 --version
poetry --version
terraform version
aws --version
docker --version
git --versionDocker Engine runs on the VDE, while Devbox contains the Docker CLI.
The first attempt to use Docker inside a newly created Devbox may return:
permission denied while trying to connect to the Docker API at unix:///var/run/docker.sock
Run the setup script from inside Devbox:
cd ~/Documents/git/ch-laptop-setup
./scripts/setup-docker-access.shIf the script is not executable:
chmod +x scripts/setup-docker-access.shThe script detects the numeric group ID that owns the Docker socket and adds the Devbox user to the matching group.
Restart Devbox to activate the new group membership:
exit
distrobox stop devbox
distrobox enter devboxVerify access:
id
docker ps -a
docker run --rm hello-worldThe id output should include the group that owns the Docker socket, for example:
998(docker)
This configuration persists for the lifetime of the Devbox container. The setup script must be run again if Devbox is deleted and recreated.
Docker socket access grants substantial control over the VDE. Do not make
/var/run/docker.sockworld-writable.
Repositories stored under the shared VDE home directory can be bind-mounted into application containers:
docker run --rm \
--mount type=bind,src="$PWD",dst=/workspace \
--workdir /workspace \
alpine:latest \
ls -laThe source path must exist on the VDE because the Docker daemon runs on the VDE.
Repositories under the following path are suitable:
~/Documents/git
VS Code remains connected to the Ubuntu VDE through Remote SSH. New integrated terminals are configured to run enter-devbox.sh, which enters Devbox automatically.
The launcher:
- Initialises the Linuxbrew PATH.
- Checks whether Devbox already exists.
- Enters the existing Devbox.
- Creates Devbox if the container is missing but the image exists.
- Falls back to a VDE Zsh shell if Devbox cannot be entered.
Ensure the launcher is executable:
chmod +x \
~/Documents/git/ch-laptop-setup/scripts/enter-devbox.shCheck its syntax:
bash -n \
~/Documents/git/ch-laptop-setup/scripts/enter-devbox.shTest it manually:
~/Documents/git/ch-laptop-setup/scripts/enter-devbox.shWhile connected to the VDE:
- Open the Command Palette.
- Select
Preferences: Open Remote Settings (JSON). - Add the following settings:
{
"terminal.integrated.profiles.linux": {
"Devbox": {
"path": "/home/connor.hindle/Documents/git/ch-laptop-setup/scripts/enter-devbox.sh",
"icon": "terminal-linux"
},
"VDE Zsh": {
"path": "/usr/bin/zsh",
"args": ["-l"],
"icon": "terminal"
}
},
"terminal.integrated.defaultProfile.linux": "Devbox"
}If the remote settings file already contains other properties, merge these properties into the existing JSON rather than replacing the whole file.
Close existing integrated terminals and create a new terminal.
New terminals should enter Devbox automatically and display the DEVBOX Powerlevel10k segment.
When direct access to the Ubuntu VDE is needed, use the terminal profile dropdown and select VDE Zsh.
This configuration only places the integrated terminal inside Devbox. VS Code Server and Remote SSH continue to run on the VDE.
Connect to the VDE through VS Code Remote SSH and open a new integrated terminal.
The terminal should enter Devbox automatically.
Confirm this using the prompt or:
echo "$CONTAINER_ID"Open a repository:
cd ~/Documents/git/my-projectUpdate the Dockerfile when changing:
- Fedora version
- Python packages