Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

ZSH in Web Terminal

The Dockerfile in this directory builds an image with ZSH installed for use in Web Terminal.

The image uses Oh My Zsh to enhance ZSH with themes and plugins. It includes the zsh-autosuggestions plugin as an example for installing ZSH plugins. You can learn more about Oh My Zsh here.

Setting $SHELL to ZSH

The $SHELL environment variable determines the default shell in your Web Terminal. You can configure this in one of two ways:

  1. From within the Web Terminal Tooling image (as configured in this directory's Dockerfile).
  2. By running the command wtoctl set shell <shell-name>.

To switch to ZSH using wtoctl, run:

wtoctl set shell <shell-name>

Upon running the above command, your web terminal will restart and you will be presented with ZSH.

Mounting your .zshrc

You can customize ZSH by mounting your .zshrc into the Web Terminal using an automount configmap.

This repository provides the configmap-creator.sh script, which allows for easily creating an automount configmap that is populated with the data of your choosing, such as a .zshrc or any other configuration files. See here for instructions on how to use it.

If you'd like to manually create an automount configmap for your .zshrc, ensure the following:

  1. The configmap exists in the same namespace as your web terminal.
  2. The configmap contains the following labels and annotations:
  labels:
    controller.devfile.io/mount-to-devworkspace: 'true'
    controller.devfile.io/watch-configmap: 'true'
  annotations:
    controller.devfile.io/mount-as: subpath
    controller.devfile.io/mount-path: <path>

Replace <path> with the desired file path of your .zshrc.

See here for an example of an automount configmap that mounts a .zshrc.

Integrating Web Terminal's Default ZSH configuration

The Web Terminal Tooling image includes a default ZSH configuration that provides:

  • Autocompletion for default tools such as oc, tkn, kn and more.
  • A helpful terminal startup message
  • As well as other defaults.

To make use of the default Web Terminal ZSH configuration, ensure your .zshrc begins with the following line:

source /tmp/initial_config/.zshrc

For an example of a custom .zshrc configuration, check here

Screenshots

#TODO: !

Build & Push Instructions

Configure the following environment variables to point to your username in your container registry:

export REGISTRY=<your container registry> 
export USER=<your registry's username>

With podman:

podman build . -t "${REGISTRY}"/${USER}/wto-tooling:zsh
podman push "${REGISTRY}"/${USER}/wto-tooling:zsh

With docker:

docker build . -t "${REGISTRY}"/${USER}/wto-tooling:zsh
docker push "${REGISTRY}"/${USER}/wto-tooling:zsh

Example

export REGISTRY="quay.io"
export USER="aobuchow"
podman build . -t "${REGISTRY}"/${USER}/wto-tooling:zsh
podman push "${REGISTRY}"/${USER}/wto-tooling:zsh