How to develop with Tilt
How to use Tilt to leverage developing towards Bifrost
Incomplete guide, needs to be reformatted and Windows instructions should be correct, but the Linux/OS X hasn't been completed.
Linux/MacOS Installation
Prerequisites
Make sure the following is installed
- Docker Desktop
- Python 3
Installing Dependencies
Needed for Linux (if not using brew):
Kind isn't available with PacMan, but you can install it manually by going to the Kind documentation
Windows Installation
Prerequisites
Make sure the following is installed:
- Scoop
- Python3
- Docker Desktop
Set the execution policy for Windows, by opening Windows Powershell
and running:
Install Dependencies
Make sure scoop is up to date:
Add Tilt bucket to scoop:
Install dependencies:
Installing Tilt
Tilt isn't available for scoop, so you have to download it directly from source:
Detailed instructions with doc links:
- Scoop package manager https://scoop.sh/ (remember to run
scoop bucket add main
to add package registry) - Docker Desktop https://www.docker.com/products/docker-desktop
- Python 3 (needed for Tilt): Usually it's
scoop install main/python
however, scoop didn't set up the command properly on Windows, so best is just to use the desktop installer for Python - Kind
Scoop:
scoop bucket add main scoop install main/kind
docs: https://github.com/kubernetes-sigs/kind/releases releases: https://kind.sigs.k8s.io/docs/user/quick-start/
- ctlptl: https://github.com/tilt-dev/ctlptl
scoop bucket add tilt-dev https://github.com/tilt-dev/scoop-bucket scoop install ctlptl
To set up Kind, you can do (make sure to restart/refresh the terminal after installing tools to prevent path errors): ctlptl create cluster kind --registry=ctlptl-registry
Use k9s or kubectl to check cluster scoop install k9s
(when running the k9s command, press 0
to see all pods`
- Tilt:
For Tilt you need to set a ExecutionPolicy in Windows, open the Windows Powershell app and run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.ps1'))
https://docs.tilt.dev/
(don't listen to this, I got several errors after trying to switch back, you might be able to do it after installing everything)
After running the command, you can switch back to using a more restrictive policy Set-ExecutionPolicy -ExecutionPolicy Restricted
(default for Windows)
Final stretch:
Install the relevant Git repository, set up an application secret ( https://frost.code.bitkraken.no/user/settings/applications ) to pull down the repository. Save the secret (i.e your private 1pass, don't share with other team members, they can create their own and we should keep them separated) so you can use it on other things later.
You probably need pnpm (and node) installed Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression
https://pnpm.io/installation
Remember to restart your IDE (vscode at least) after installing pnpm so it's recognized in the terminal
Make sure that you've logged in to the package registry docker login frost.code.bitkraken.no
(some of the Tilt config uses the credentials on your host machine, not the ones passed into Tilt)
Recommended vscode extensions:
- Tilt id: Tchoupinax.tilt
Finally you can run Tilt up
in the folder of a project. The current version at the time of the Tilt project doesn't wait for everything to come up/might miss some resources like CRDs from Mariadb, secrets etc. so you might have to restart the wordpress deployment a few times, expect some errors object is being deleted: users.k8s.mariadb.com "default-wordpress-user" already exists
, just wait for the object to be deleted before restarting. This can be fixed by separating out db handling.
In prod it's a non-issue since all the required resources already exists. It can be fixed for Tilt as well, but the current local dev is more intended a prototype/see if the workflow works, kinks can be fixed later.