Install
This page tells how to install localspace and how to set up your machine for it. You do these tasks one time for each machine.
Requirements
Section titled “Requirements”localspace runs on macOS and Linux, on amd64 and arm64 processors. These programs must be on your machine:
git, because each source of a workspace is a git branch or checkout.- Docker, for the services with a Dockerfile and for resources such as Postgres and Redis. OrbStack, Docker Desktop, colima or any
dockerCLI context works.
The proxy for public URLs runs in a container. The DNS server of localspace also runs in a container. Docker must run when you start a workspace with an exposed service.
Install lo
Section titled “Install lo”The script below downloads the release for your system, makes sure that the checksum is correct, and installs lo in ~/.local/bin.
os=$(uname -s | tr A-Z a-z); arch=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')base=https://github.com/sanlilab/localspace/releases/latest/downloadcurl -fsSL -O "$base/localspace_${os}_${arch}" -O "$base/checksums.txt"shasum -a 256 --check --ignore-missing checksums.txtmkdir -p ~/.local/bin && install -m 755 "localspace_${os}_${arch}" ~/.local/bin/localspaceln -sf localspace ~/.local/bin/lo- Run the script in a terminal.
- Make sure that
~/.local/binis in yourPATH. - Run
lo version. It prints the version oflo.
The file is named localspace, and lo is a link to it. The two names run the same program.
Set up the machine
Section titled “Set up the machine”Public URLs such as https://storefront.shop-a.lo must work on your machine. For this, two settings are necessary. The names in the .lo domain must go to your machine. Your system must trust the certificates of the proxy. lo setup does the two tasks.
- Run
lo setup. - Enter your password at the
sudoprompt.loshows the commands thatsudoruns before it runs them.
lo setup does these tasks:
- It writes the resolver file of the domain, so that the names in the
.lodomain go to the DNS server of localspace. The DNS server runs in a container. - It adds the local certificate authority of the proxy to the trust store of your system.
sudo prompts for your password one time for the two tasks. If your machine is set up, lo setup prints This machine is set up. and changes nothing.
If a browser continues to warn about certificates, restart the browser. Firefox has a separate trust store and does not use the trust store of your system.
To change the domain or the other proxy settings, see machine settings.
Check for a new release
Section titled “Check for a new release”Run lo about --check to see the version of lo, the directories that it uses, and if a newer release is available:
lo about --checkThe command sends a request to GitHub for the newest release. If a newer release is available, the output has a line that starts with update and gives the address of the release. Run the install script again to update lo.
Add shell completion
Section titled “Add shell completion”lo completion <shell> prints a completion script for bash, zsh, fish or powershell. The script completes the names of commands and flags. It also completes the names of workspaces, services and templates.
To use completion in the current shell only, load the script:
source <(lo completion zsh)To use completion in each new shell, write the script to the place where your shell reads completions. These commands are for zsh. Use lo completion <shell> --help for the other shells.
# macOSlo completion zsh > $(brew --prefix)/share/zsh/site-functions/_lo
# Linuxlo completion zsh > "${fpath[1]}/_lo"Start a new shell to load the script. If completion is not on in your zsh, add autoload -U compinit; compinit to ~/.zshrc.
Check the installation
Section titled “Check the installation”Run lo doctor to make sure that the installation works:
lo doctorThe command runs the checks of each module. Each line starts with ok or shows the problem that the check found. The checks include these items:
gitruns.- The machine settings file is valid.
- Each template is valid.
- The checkout of each recorded source is there.
- The Docker daemon answers.
lo doctor exits with code 1 if one check fails.