Posts about vscode

Setting up a GitLab environment with the GitLab Environment Toolkit

This post is a notebook. It contains instructions to set up and create a GitLab environment in Google Cloud Platform (GCP) using the GitLab Environment Toolkit (GET), installed into a VS Code Dev Container.

The idea is that it's a literate sysadmin runbook, which can be copied and repeated within my get-container.

Notebook instructions

To use this, you must be running Jupyter Notebook with the Bash kernel installed. This is explored in detail on my earlier blog post. Jupyter and the extension should already have been installed when the GET Dev Container was provisioned. If not, then re-run the playbook:

ansible-playbook $WORKSPACE/.devcontainer/get/setup.yaml

Then start jupyter:

jupyter notebook --no-browser --allow-root

(this is aliased to notebook)

Select Kernel

Once jupyter is running in the dev container, you can open this notebook and select the Bash kernel from the Select Kernel button at the top of the buffer. The Bash kernel directly runs bash shell commands, rather than python.

Use Jupyter Notebooks for bash scripting

I'm experimenting with using Jupyter to capture Linux server commands in a Notebook while I figure out doing GitLab Geo setup. It's complicated, so I want to keep good notes, but copy/paste from the terminal to a text editor is a chore I'd rather not deal with. Instead I would like to keep a literate-programming style notebook. I learnt recently that there is a Jupyter kernel for running bash instead of python, and that would be ideal.

This post describes how to set up using Jupyter Notebooks on a remote host, and then running and editing notebooks using Visual Studio Code's support for Jupyter.

You can also do this without VSCode, by SSH tunnelling a local web browser to the host. That would be better in cases where users' /home volume size is restricted. I briefly discuss this too.