|
|
||
|---|---|---|
| .. | ||
| Caddyfile | ||
| README.md | ||
| Tiltfile | ||
Local development environment with tilt.dev and minikube
This is still a work in progress.
tiltis useful when you have to develop k8s code and need a local cluster for your edit/compile/test cycle.tiltcan also be used with bare processes but we haven't converted and optimized our build pipeline to it. Thetiltteam have given us a starting point (thanks!). For now, (until we convert, test and optimize this approach) please still usesg start.
(Instructions assume you are in this directory)
-
Install tilt
-
Install minikube
-
Generate manifests from the minikube overlay and copy the
generated-clusterdirectory into this directory. -
mkdir tilt-watch-targets -
Prepare the cluster:
minikube start kubectl create namespace ns-sourcegraph kubectl -n ns-sourcegraph apply --prune -l deploy=sourcegraph -f generated-cluster --recursive kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --port=3080 --target-port=3080 minikube service list -
From the
minikube service listoutput take the exposed port and modify the Caddyfile. -
caddy run(this makes Sourcegraph from the minikube cluster available at https://sourcegraph.test:3443) -
tilt up(starts tilt)
Tilt will start an initial build of the frontend and deploy it. Whenever you are done editing and want to trigger another build, touch tilt-watch-targets/frontend.
Similar to the frontend you can add other custom_build statements to your Tiltfile to build and watch the other servers.
There are many Tiltfile modifications that can help accelerate the edit/build/deploy cycle: https://docs.tilt.dev/example_go.html