### Run Tilt Example Source: https://docs.tilt.dev/example_java.html Commands to clone the repository and start the Tilt development environment. ```bash git clone https://github.com/tilt-dev/tilt-example-java cd tilt-example-java/0-base tilt up ``` -------------------------------- ### Initialize Tilt Project Source: https://docs.tilt.dev/example_static_html.html Commands to clone the example repository and start the Tilt development environment. ```shell git clone https://github.com/tilt-dev/tilt-example-html cd tilt-example-html/0-base tilt up ``` -------------------------------- ### Example Tiltfile Configuration Source: https://docs.tilt.dev/tiltfile_authoring.html A complete example showing how to structure a Tiltfile with deployment, build, and resource watch definitions. ```Starlark # Deploy: tell Tilt what YAML to deploy k8s_yaml('app.yaml') # Build: tell Tilt what images to build from which directories docker_build('companyname/frontend', 'frontend') docker_build('companyname/backend', 'backend') # ... # Watch: tell Tilt how to connect locally (optional) k8s_resource('frontend', port_forwards=8080) ``` -------------------------------- ### Install Tilt on Windows Source: https://docs.tilt.dev/index.html Use this command to install the Tilt binary on Windows systems. It downloads and executes a PowerShell installation script. ```powershell iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.ps1')) ``` -------------------------------- ### Example: Building an Image with Tilt Docker Source: https://docs.tilt.dev/cli/tilt_docker.html This example shows how to use 'tilt docker' to build a Docker image. It specifies a Dockerfile and the build context. ```bash tilt docker -- build -f path/to/Dockerfile . ``` -------------------------------- ### Add Tilt Scoop Bucket and Install Source: https://docs.tilt.dev/install.html Adds the Tilt development Scoop bucket and then installs Tilt on Windows using Scoop. ```bash scoop bucket add tilt-dev https://github.com/tilt-dev/scoop-bucket scoop install tilt ``` -------------------------------- ### Install and Enable MicroK8s Features Source: https://docs.tilt.dev/choosing_clusters.html Installs MicroK8s using snap and enables DNS and registry services. Ensure you have snapd installed and sufficient permissions. ```bash sudo snap install microk8s --classic && \ sudo microk8s.enable dns && \ sudo microk8s.enable registry ``` -------------------------------- ### Install Extension from Default Repo Source: https://docs.tilt.dev/cli/tilt_create_ext.html Installs an extension named 'cancel' from the 'default' extension repository. This is a common way to add pre-defined extensions to your Tilt setup. ```bash # Installs the extension from the extension repo 'default' under the path './cancel'. tilt create ext cancel ``` -------------------------------- ### Install and run a local nodejs server Source: https://docs.tilt.dev/snippets.html Manages dependency installation and server startup for a Node.js application. ```python local_resource( 'local-js-server', cmd='yarn install', deps=['package.json', 'yarn.lock'], serve_cmd='yarn start' ) ``` -------------------------------- ### Verify Docker Installation Source: https://docs.tilt.dev/tutorial/1-prerequisites.html Runs the hello-world container to confirm Docker is installed and functioning correctly. ```bash docker run --rm hello-world ``` -------------------------------- ### Install Extension with Custom Arguments Source: https://docs.tilt.dev/cli/tilt_create_ext.html Installs an extension named 'my-kubefwd' from the 'default' repository, passing custom arguments like '--namespaces=default' to the extension. Use this when an extension requires specific configuration during installation. ```bash # Installs the extension from the extension repo 'default' under # and with custom argument '--namespaces=default' passed to the extension. tilt create ext my-kubefwd --path=./kubefwd -- --namespaces=default ``` -------------------------------- ### Tilt Verify Install Command Source: https://docs.tilt.dev/cli/tilt_verify-install.html The basic command to verify your Tilt installation. Use this to ensure Tilt is set up correctly. ```bash tilt verify-install [flags] ``` -------------------------------- ### Tilt CLI: Example of Creating a Filewatch Source: https://docs.tilt.dev/cli/tilt_create_filewatch.html Example demonstrating how to create a filewatch named 'fw' that monitors the 'src' and 'web' directories, while ignoring the 'web/node_modules' path. ```bash tilt create fw src-and-web src web --ignore=web/node_modules ``` -------------------------------- ### Explain Resource Fields Source: https://docs.tilt.dev/cli/tilt_explain.html Use this command to get the documentation of a resource and its fields. For example, to get documentation for 'cmds'. ```bash tilt explain RESOURCE ``` -------------------------------- ### Start Tilt with specific services enabled Source: https://docs.tilt.dev/tiltfile_config.html Initiate Tilt with a predefined set of services ('a', 'b', and 'd') enabled. This is an alternative to starting with all disabled. ```bash tilt up a b d ``` -------------------------------- ### Start the Tilt language server Source: https://docs.tilt.dev/editor.html Run this command in your terminal to start the Tilt language server locally. ```bash tilt lsp start ``` -------------------------------- ### Install Tilt on macOS/Linux Source: https://docs.tilt.dev/index.html Use this command to install the Tilt binary on macOS and Linux systems. It downloads and executes an installation script. ```bash curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash ``` -------------------------------- ### Verify Tilt Installation Source: https://docs.tilt.dev/install.html Checks if Tilt has been installed correctly by displaying its version. Run this command after installation. ```bash tilt version ``` -------------------------------- ### View Tilt CI output Source: https://docs.tilt.dev/extensions.html Example output when running Tilt with the hello_world extension. ```text Initial Build • (Tiltfile) Loading Tiltfile at: /home/nick/src/scratch/Tiltfile Hello world! Successfully loaded Tiltfile (1.990905ms) ERROR: No resources found. Check out https://docs.tilt.dev/tutorial.html to get started! ``` -------------------------------- ### Basic Tilt Up Command Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt with optional Tilt flags and Tiltfile arguments. Tiltfile arguments are interpreted as the list of services to start by default. ```bash tilt up [] [-- ] ``` -------------------------------- ### Manual Tilt Install (Linux) Source: https://docs.tilt.dev/install.html Manually installs Tilt on Linux by downloading a tarball, extracting the binary, and moving it to a directory in your PATH. ```bash curl -fsSL https://github.com/tilt-dev/tilt/releases/download/v0.37.4/tilt.0.37.4.linux.x86_64.tar.gz | tar -xzv tilt && \ sudo mv tilt /usr/local/bin/tilt ``` -------------------------------- ### Create a simple command Source: https://docs.tilt.dev/cli/tilt_create_cmd.html Example of creating a basic command named 'my-cmd' that executes 'echo hello world'. ```bash tilt create cmd my-cmd echo hello world ``` -------------------------------- ### Tilt Verify Install Help Options Source: https://docs.tilt.dev/cli/tilt_verify-install.html Displays help information for the 'verify-install' command. Use this to see available flags specific to this command. ```bash -h, --help help for verify-install ``` -------------------------------- ### Start Process with Wrapper Script Source: https://docs.tilt.dev/live_update_reference.html Use a wrapper script to start your process. This allows for restarts by invoking a separate restart script. Requires shell access in the container. ```bash /path/to/start.sh /path/to/bin ``` -------------------------------- ### Start Tilt with all services disabled Source: https://docs.tilt.dev/tiltfile_config.html Use this command to start Tilt without any services enabled by default. Resources can be enabled later via the UI or CLI. ```bash tilt up ``` -------------------------------- ### Install Tilt with Homebrew Source: https://docs.tilt.dev/install.html Installs Tilt using the Homebrew package manager on macOS or Linux. ```bash brew install tilt ``` -------------------------------- ### Manual Tilt Install (Windows) Source: https://docs.tilt.dev/install.html Manually installs Tilt on Windows by downloading a zip archive, extracting the executable, and moving it to a specified directory. ```powershell Invoke-WebRequest "https://github.com/tilt-dev/tilt/releases/download/v0.37.4/tilt.0.37.4.windows.x86_64.zip" -OutFile "tilt.zip" Expand-Archive "tilt.zip" -DestinationPath "tilt" Move-Item -Force -Path "tilt\tilt.exe" -Destination "$home\bin\tilt.exe" ``` -------------------------------- ### Run Installation Script with `local()` Source: https://docs.tilt.dev/custom_resource.html Use the `local` Tiltfile function to run arbitrary shell scripts for installing custom resource operators. Note that `local` runs on every Tiltfile reload and blocks startup. ```python local('./install-my-crd-operator.sh') ``` -------------------------------- ### Install Tilt with asdf Source: https://docs.tilt.dev/install.html Manages Tilt installations using the asdf version manager. This includes adding the plugin, installing a specific version, and setting it globally. ```bash asdf plugin add tilt asdf install tilt 0.37.4 asdf global tilt 0.37.4 ``` -------------------------------- ### Example Usage of Tilt Dump Image Deploy Ref Source: https://docs.tilt.dev/cli/tilt_dump_image-deploy-ref.html Example of how to use the 'tilt dump image-deploy-ref' command within a custom build script. It echoes the output of the command, which is the deploy ref of the image. ```bash tilt dump image-deploy-ref $EXPECTED_REF ``` -------------------------------- ### Tilt Up with Web Mode Configuration Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt, configuring the web mode to use either local development assets or production assets. ```bash tilt up --web-mode ``` -------------------------------- ### Install Docker on Linux Source: https://docs.tilt.dev/tutorial/1-prerequisites.html Uses a convenience script to auto-detect the Linux distribution. ```bash curl -fsSL https://get.docker.com | sh ``` -------------------------------- ### Tilt Up with Custom Host Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt, configuring the host for the Tilt HTTP server and default port-forwards. Use with caution for remote access. ```bash tilt up --host ``` -------------------------------- ### Get UI Resources Source: https://docs.tilt.dev/resource_dependencies.html Use this CLI command to list all resources Tilt is aware of in the UI. This is useful for exploring your development environment. ```bash tilt get uiresources ``` -------------------------------- ### Configure Resource Trigger Modes Source: https://docs.tilt.dev/manual_update_control.html Examples showing how to set automatic or manual trigger modes for specific resources or globally. ```python # TriggerMode = Auto by default k8s_resource('snack') ``` ```python # TriggerMode = Manual k8s_resource('snack', trigger_mode=TRIGGER_MODE_MANUAL) ``` ```python trigger_mode(TRIGGER_MODE_MANUAL) ... # TriggerMode = Manual (default set above) k8s_resource('snack') # TriggerMode = Auto (can override the above default # for specific resources) k8s_resource('bar', trigger_mode=TRIGGER_MODE_AUTO) ``` -------------------------------- ### Upgrade Tilt on Windows using PowerShell Source: https://docs.tilt.dev/upgrade.html Use PowerShell to download and execute the install script for upgrading Tilt on Windows. ```powershell iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.ps1')) ``` -------------------------------- ### Tilt Up with Verbose Logging Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt with verbose logging enabled for more detailed output. ```bash tilt up -v ``` -------------------------------- ### Explain Specific Resource Field Source: https://docs.tilt.dev/cli/tilt_explain.html Use this command to get the documentation of a specific field within a resource. For example, to get documentation for the 'spec.args' field of 'cmds'. ```bash tilt explain cmds.spec.args ``` -------------------------------- ### Benchmark with Local Resource Source: https://docs.tilt.dev/example_static_html.html Uses local_resource to execute a shell command for tracking deployment start times. ```python k8s_resource('example-html', port_forwards=8000, resource_deps=['deploy']) # Records the time from a code change to a new process. # Normally, you would let Tilt do deploys automatically, but this # shows you how to set up a custom workflow that measures it. local_resource( 'deploy', 'date +%s > start-time.txt') ``` -------------------------------- ### Run Tilt Demo Source: https://docs.tilt.dev/cli/tilt_demo.html This is the basic command to start a demo of Tilt. It will automatically create a local Kubernetes cluster and clone a sample project to run. ```bash tilt demo [flags] ``` -------------------------------- ### Install Fish Completions for Every Session Source: https://docs.tilt.dev/cli/tilt_completion_fish.html To permanently install autocompletion scripts for every new fish shell session, redirect the output to the specified file in your fish configuration directory. A new shell must be started for this to take effect. ```bash tilt completion fish > ~/.config/fish/completions/tilt.fish ``` -------------------------------- ### Get Current Working Directory Source: https://docs.tilt.dev/api.html The `os.getcwd()` function returns the current working directory, which is the directory containing the executing Tiltfile. Any subprocesses launched will also use this directory as their starting point. ```python os.getcwd() ``` -------------------------------- ### Specify Resource Dependencies Source: https://docs.tilt.dev/resource_dependencies.html Configure startup order by defining dependencies between resources. `frontend` will not be deployed until `database` is ready. This also affects `tilt up` commands. ```python k8s_resource('frontend', resource_deps=['database']) ``` -------------------------------- ### tilt up command Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt and runs services defined in the Tiltfile. Supports Tilt flags and Tiltfile arguments. ```APIDOC ## tilt up ### Description Starts Tilt and runs services defined in the Tiltfile. Supports two types of arguments: Tilt flags and Tiltfile arguments. By default, Tiltfile arguments are interpreted as the list of services to start. If no Tiltfile arguments are provided, all services are started. This default behavior changes if the Tiltfile uses `config.parse` or `config.set_enabled_resources`. ### Synopsis ``` tilt up [] [-- ] ``` ### Options #### Tilt Flags - **--context** (string) - Kubernetes context override. Equivalent to `kubectl --context`. - **-f, --file** (string) - Path to Tiltfile (default "Tiltfile"). - **-h, --help** - Help for the `up` command. - **--host** (string) - Host for the Tilt HTTP server and default host for any port-forwards. Defaults to localhost. Overrides `TILT_HOST` env variable. - **--legacy** - If true, Tilt will open in legacy terminal mode. - **--log-level** (string) - Specify a log level. One of "warn", "error". - **--log-resource** (strings) - Specify one or more resources to print logs for, e.g. "(Tiltfile)", "nginx", etc. If not specified, prints all resources. - **--log-source** (string) - Specify a log source. One of "all", "build", "runtime" (default "all"). - **--namespace** (string) - Default namespace for Kubernetes resources (overrides default namespace from active context in kubeconfig). - **--output-snapshot-on-exit** (string) - If specified, Tilt will dump a snapshot of its state to the specified path when it exits. - **--port** (int) - Port for the Tilt HTTP server. Set to 0 to disable. Overrides `TILT_PORT` env variable (default 10350). - **--stream** - If true, Tilt will stream logs in the terminal. - **--update-mode** (string) - Control the strategy Tilt uses for updating instances. Possible values: [auto image container exec] (default "auto"). - **--web-mode** (WebMode) - Values: local, prod. Controls whether to use prod assets or a local dev server. (If flag not specified: if Tilt was built from source, it will use a local asset server; otherwise, prod assets.) (default default). - **--webdev-port** (int) - Port for the Tilt Dev Webpack server. Only applies when using `--web-mode=local` (default 46764). #### Inherited Options - **-d, --debug** - Enable debug logging. - **--klog** (int) - Enable Kubernetes API logging. Uses klog v-levels (0-4 are debug logs, 5-9 are tracing logs). - **-v, --verbose** - Enable verbose logging. ### SEE ALSO * tilt - Multi-service development with no stress ``` -------------------------------- ### Run Tilt Up Directly Source: https://docs.tilt.dev/tutorial/2-tilt-up.html Clone the sample project and run `tilt up` directly if you already have a local Kubernetes cluster. Remember to run `tilt down` to clean up afterwards. ```bash git clone https://github.com/tilt-dev/tilt-avatars.git cd tilt-avatars/ tilt up ``` -------------------------------- ### Install Tilt with Conda Forge Source: https://docs.tilt.dev/install.html Installs Tilt using Conda Forge. Ensure you have Conda installed and configured with the conda-forge channel. ```bash conda config --add channels conda-forge conda install tilt ``` -------------------------------- ### Run Tilt Demo Command Source: https://docs.tilt.dev/tutorial/2-tilt-up.html Use this command to set up a temporary Kubernetes cluster, clone the Tilt Avatars project, and launch a Tilt session. It handles all setup and cleanup. ```bash tilt demo ``` -------------------------------- ### Hello World Tiltfile Source: https://docs.tilt.dev/tiltfile_authoring.html A simple print statement to verify that Tilt is correctly executing the configuration file. ```Starlark print('Hello Tiltfile') ``` -------------------------------- ### Start Go HTTP Server Source: https://docs.tilt.dev/example_go.html A basic Go HTTP server using gorilla/mux for routing. Ensure the server is configured to listen on the correct port for Tilt port-forwarding. ```go func main() { http.Handle("/", NewExampleRouter()) log.Println("Serving on port 8000") err := http.ListenAndServe(":8000", nil) if err != nil { log.Fatalf("Server exited with: %v", err) } } ``` -------------------------------- ### Wait to launch resource until first file change Source: https://docs.tilt.dev/snippets.html Delay resource startup until a file dependency is modified after the initial Tilt session starts. ```Starlark # Kubernetes `my-resource` will wait for a file in the image build context to change before start k8s_resource("my-resource", auto_init=False, trigger_mode=TRIGGER_MODE_AUTO) # Local resource `my-resource` will wait for a file in `./my-resource` to change before start local_resource("my-resource", serve_cmd="./run.sh", auto_init=False, trigger_mode=TRIGGER_MODE_AUTO, deps=['./my-resource']) ``` -------------------------------- ### Tilt Up with Custom HTTP Port Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt, configuring a custom port for the Tilt HTTP server. Set to 0 to disable the server. ```bash tilt up --port ``` -------------------------------- ### Enable specific resources via CLI arguments Source: https://docs.tilt.dev/disable_resources.html Use tilt up to specify which resources to run upon startup, disabling all others. ```bash # enable only the resources named 'frontend' and 'glitch', # all other resources will be disabled and visible in the UI $ tilt up frontend glitch ``` -------------------------------- ### Apply Configuration from File or Directory Source: https://docs.tilt.dev/cli/tilt_apply.html Use this command to apply configurations defined in a file or a kustomize directory. Specify the file with -f or the directory with -k. ```bash tilt apply (-f FILENAME | -k DIRECTORY) ``` -------------------------------- ### Manual Tilt Install (macOS) Source: https://docs.tilt.dev/install.html Manually installs Tilt on macOS by downloading a tarball, extracting the binary, and moving it to a directory in your PATH. ```bash curl -fsSL https://github.com/tilt-dev/tilt/releases/download/v0.37.4/tilt.0.37.4.mac.x86_64.tar.gz | tar -xzv tilt && \ sudo mv tilt /usr/local/bin/tilt ``` -------------------------------- ### Tilt Alpha Get Command Usage Source: https://docs.tilt.dev/cli/tilt_alpha_get.html This snippet shows the basic usage and available options for the `tilt alpha get` command. ```APIDOC ## tilt alpha get TYPE [NAME | -l label] ### Description Display one or many resources. ### Options - `--allow-missing-template-keys` (bool) - If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true) - `--field-selector` (string) - Selector (field query) to filter on, supports '=', '==', and '!='. (e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. - `-h`, `--help` - help for get - `--host` (string) - Host for the Tilt HTTP server. Only necessary if you started Tilt with --host. Overrides TILT_HOST env variable. (default "localhost") - `--ignore-not-found` (bool) - If the requested object does not exist the command will return exit code 0. - `-L`, `--label-columns` (strings) - Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... - `--no-headers` (bool) - When using the default or custom-column output format, don't print headers (default print headers). - `-o`, `--output` (string) - Output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns [https://kubernetes.io/docs/reference/kubectl/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/]. - `--port` (int) - Port for the Tilt HTTP server. Only necessary if you started Tilt with --port. Overrides TILT_PORT env variable. (default 10350) - `-l`, `--selector` (string) - Selector (label query) to filter on, supports '=', '==', and '!='. (e.g. -l key1=value1,key2=value2) - `--show-kind` (bool) - If present, list the resource type for the requested object(s). - `--show-labels` (bool) - When printing, show all labels as the last column (default hide labels column). - `--show-managed-fields` (bool) - If true, keep the managedFields when printing objects in JSON or YAML format. - `--sort-by` (string) - If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string. - `--template` (string) - Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. - `-w`, `--watch` (bool) - After listing/getting the requested object, watch for changes. Uninitialized objects are excluded if no object name is provided. - `--watch-only` (bool) - Watch for changes to the requested object(s), without listing/getting first. ### Options inherited from parent commands - `-d`, `--debug` (bool) - Enable debug logging - `--klog` (int) - Enable Kubernetes API logging. Uses klog v-levels (0-4 are debug logs, 5-9 are tracing logs) - `-v`, `--verbose` (bool) - Enable verbose logging ``` -------------------------------- ### Build and run a local go server Source: https://docs.tilt.dev/snippets.html Configures a local resource that builds and serves a Go application. ```python local_resource( 'local-myserver', cmd='go build ./cmd/myserver', serve_cmd='./myserver --port=8001', deps=['cmd/myserver'] ) ``` -------------------------------- ### Upgrade Tilt on macOS or Linux using Install Script Source: https://docs.tilt.dev/upgrade.html Rerun the install script to upgrade Tilt on macOS or Linux. This is the most common upgrade method. ```bash curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash ``` -------------------------------- ### Install Tilt via Script (macOS/Linux) Source: https://docs.tilt.dev/install.html Installs the latest version of Tilt using a curl script. This method is suitable for macOS and Linux users. ```bash curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash ``` -------------------------------- ### Integrating Helmfile with Tilt Source: https://docs.tilt.dev/helm.html This example shows how to integrate `helmfile` with Tilt by creating a helper function to manage Helm configurations defined in a `helmfile.yaml`. It watches the helmfile and applies the generated Kubernetes configuration. ```python # Helper function to read K8s config YAML from helmfile. def helmfile(file): watch_file(file) return local("helmfile -f %s template" % file) # Tell Tilt to apply to k8s config generated by helmfile. k8s_yaml(helmfile("k8s/staging/helmfile.yaml")) ``` -------------------------------- ### Manually Upgrade Tilt on Linux Source: https://docs.tilt.dev/upgrade.html Download the release binary, extract it, and move it to the PATH for manual upgrades on Linux. This example uses version 0.37.4. ```bash curl -fsSL https://github.com/tilt-dev/tilt/releases/download/v0.37.4/tilt.0.37.4.linux.x86_64.tar.gz | tar -xzv tilt && \ sudo mv tilt /usr/local/bin/tilt ``` -------------------------------- ### Add Yarn Install Button to Resource Source: https://docs.tilt.dev/buttons.html Attaches a button to a specific resource (e.g., 'letters') that runs 'yarn install' when clicked. Logs are directed to the resource's log. ```python load('ext://uibutton', 'cmd_button') cmd_button('letters:yarn install', argv=['sh', '-c', 'cd letters && yarn install'], resource='letters', icon_name='cloud_download', text='yarn install', ) ``` -------------------------------- ### Install Extension from a Specific Repo Source: https://docs.tilt.dev/cli/tilt_create_ext.html Installs an extension named 'cancel' from a specific repository named 'dev'. Use this when you have multiple extension repositories registered and need to target a particular one. ```bash # Installs the extension from the extension repo 'dev' under the path './cancel' tilt create ext cancel --repo=dev ``` -------------------------------- ### Local Resource for Benchmarking Source: https://docs.tilt.dev/example_csharp.html This Tiltfile snippet defines a local resource named 'deploy' that executes a shell script './record-start-time.sh'. It's used to benchmark deployment times. ```python local_resource( 'deploy', './record-start-time.sh', deps=['./record-start-time.sh'] ) ``` -------------------------------- ### Run Installation Script in Parallel with `local_resource()` Source: https://docs.tilt.dev/custom_resource.html Use `local_resource()` to run installation scripts in parallel. This function allows specifying a name, command, and whether parallel execution is allowed. It can be used with `resource_deps` to manage dependencies. ```python local_resource( name='my-crd-operator', cmd='./install-my-crd-operator.sh', allow_parallel=True) k8s_resource( name='custom-resource', resource_deps=['my-crd-operator']) ``` -------------------------------- ### Example OpenTelemetry Spans Source: https://docs.tilt.dev/debug_faq.html This is an example of the OpenTelemetry span data in JSON format that Tilt sends via STDIN to the command specified in `experimental_telemetry_cmd`. Each JSON object represents user activity within the last minute. ```json {"SpanContext":{"TraceID":"00000000000000000000000000000000","SpanID":"0000000000000000","TraceFlags":1},"ParentSpanID":"0000000000000000","SpanKind":1,"Name":"tilt.dev/usage/update","StartTime":"2019-12-11T12:18:30.702255-05:00","EndTime":"2019-12-11T12:18:31.920728054-05:00","Attributes":null,"MessageEvents":null,"Links":null,"Status":0,"HasRemoteParent":false,"DroppedAttributeCount":0,"DroppedMessageEventCount":0,"DroppedLinkCount":0,"ChildSpanCount":0} {"SpanContext":{"TraceID":"00000000000000000000000000000000","SpanID":"0000000000000000","TraceFlags":1},"ParentSpanID":"0000000000000000","SpanKind":1,"Name":"tilt.dev/usage/update","StartTime":"2019-12-11T12:18:31.922581-05:00","EndTime":"2019-12-11T12:18:32.257773437-05:00","Attributes":null,"MessageEvents":null,"Links":null,"Status":0,"HasRemoteParent":false,"DroppedAttributeCount":0,"DroppedMessageEventCount":0,"DroppedLinkCount":0,"ChildSpanCount":0} ``` -------------------------------- ### Tilt Describe Command Usage Source: https://docs.tilt.dev/cli/tilt_describe.html Shows the basic usage of the 'tilt describe' command, including how to specify resources by filename, type, name prefix, or label. ```bash tilt describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME) ``` -------------------------------- ### Configure a readiness probe Source: https://docs.tilt.dev/local_resource.html Define a readiness probe to ensure a local resource is fully initialized before Tilt proceeds with dependent resources. ```python local_resource( "probe-example", serve_cmd="./myserver --port=8001", readiness_probe=probe( period_secs=15, http_get=http_get_action(port=8001, path="/health") ) ) ``` -------------------------------- ### Tilt CLI Options for 'get' Command Source: https://docs.tilt.dev/cli/tilt_alpha_get.html Explore the various options available for the 'tilt alpha get' command to customize output and filtering. These options control aspects like error handling, field selection, output format, and watching for changes. ```bash --allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true) ``` ```bash --field-selector string Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type. ``` ```bash -h, --help help for get ``` ```bash --host string Host for the Tilt HTTP server. Only necessary if you started Tilt with --host. Overrides TILT_HOST env variable. (default "localhost") ``` ```bash --ignore-not-found If the requested object does not exist the command will return exit code 0. ``` ```bash -L, --label-columns strings Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2... ``` ```bash --no-headers When using the default or custom-column output format, don't print headers (default print headers). ``` ```bash -o, --output string Output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns [https://kubernetes.io/docs/reference/kubectl/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://kubernetes.io/docs/reference/kubectl/jsonpath/]. ``` ```bash --port int Port for the Tilt HTTP server. Only necessary if you started Tilt with --port. Overrides TILT_PORT env variable. (default 10350) ``` ```bash -l, --selector string Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) ``` ```bash --show-kind If present, list the resource type for the requested object(s). ``` ```bash --show-labels When printing, show all labels as the last column (default hide labels column) ``` ```bash --show-managed-fields If true, keep the managedFields when printing objects in JSON or YAML format. ``` ```bash --sort-by string If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string. ``` ```bash --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. ``` ```bash -w, --watch After listing/getting the requested object, watch for changes. Uninitialized objects are excluded if no object name is provided. ``` ```bash --watch-only Watch for changes to the requested object(s), without listing/getting first. ``` -------------------------------- ### Disable automatic startup Source: https://docs.tilt.dev/docker_compose.html Prevent a service from starting automatically when Tilt launches. ```python dc_resource('storybook', auto_init=False) ``` -------------------------------- ### Basic Tiltfile Configuration Source: https://docs.tilt.dev/example_static_html.html Defines the Docker build, Kubernetes YAML loading, and port forwarding for the static server. ```python docker_build('example-html-image', '.') k8s_yaml('kubernetes.yaml') k8s_resource('example-html', port_forwards=8000) ``` -------------------------------- ### v1alpha1.HTTPGetAction Type Source: https://docs.tilt.dev/api.html HTTPGetAction describes an action based on HTTP Get requests. ```APIDOC ## v1alpha1.HTTPGetAction ### Description HTTPGetAction describes an action based on HTTP Get requests. ``` -------------------------------- ### Define Dockerfile for Node.js Source: https://docs.tilt.dev/docker_compose.html Standard Dockerfile setup for a Node.js application environment. ```dockerfile FROM node:9-alpine WORKDIR /var/www/app ADD package.json . RUN npm install ADD . . ``` -------------------------------- ### Basic Usage of tilt get Source: https://docs.tilt.dev/cli/tilt_get.html Use this command to display one or more resources. You can specify the resource type and optionally filter by name or label. ```bash tilt get TYPE [NAME | -l label] ``` -------------------------------- ### Tilt Up with Debug Logging Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt with debug logging enabled for more detailed output. ```bash tilt up -d ``` -------------------------------- ### Manually Upgrade Tilt on Windows Source: https://docs.tilt.dev/upgrade.html Download the release zip, extract it, and move the executable to the bin directory for manual upgrades on Windows. This example uses version 0.37.4. ```powershell Invoke-WebRequest "https://github.com/tilt-dev/tilt/releases/download/v0.37.4/tilt.0.37.4.windows.x86_64.zip" -OutFile "tilt.zip" Expand-Archive "tilt.zip" -DestinationPath "tilt" Move-Item -Force -Path "tilt\tilt.exe" -Destination "$home\bin\tilt.exe" ``` -------------------------------- ### Disable all resources by default in Tiltfile Source: https://docs.tilt.dev/disable_resources.html Use config.clear_enabled_resources() to start Tilt with all resources disabled. ```python # from your Tiltfile config.clear_enabled_resources() ``` -------------------------------- ### Create a resource using a Go template Source: https://docs.tilt.dev/cli/tilt_create.html This command allows you to create resources using Go templates. You can provide the template as a string or a path to a template file. ```bash tilt create -f FILENAME -o go-template --template "{{.metadata.name}}" ``` -------------------------------- ### Define Extension Function Source: https://docs.tilt.dev/contribute_extension.html Example of a simple function definition within a Tiltfile extension. ```python def hi(): print("Hello world!") ``` -------------------------------- ### Create a resource with debug logging enabled Source: https://docs.tilt.dev/cli/tilt_create.html Enable debug logging for the 'tilt create' command by using the -d flag. This is useful for troubleshooting. ```bash tilt create -f FILENAME -d ``` -------------------------------- ### Deploy an existing Helm chart Source: https://docs.tilt.dev/helm.html Use the helm_resource extension to install charts from remote repositories. ```python # Tiltfile load('ext://helm_resource', 'helm_resource', 'helm_repo') helm_repo('bitnami', 'https://charts.bitnami.com/bitnami') helm_resource('mysql', 'bitnami/mysql', resource_deps=['bitnami']) ``` -------------------------------- ### Enable All Resources Source: https://docs.tilt.dev/cli/tilt_enable.html Enables all resources defined in the Tilt configuration. ```bash tilt enable --all ``` -------------------------------- ### Knative Extension Commands Source: https://docs.tilt.dev/custom_resource.html Commands for installing the Knative operator and injecting images into Knative Services. ```python knative_install knative_yaml ``` -------------------------------- ### Tilt Up with Specific Tiltfile Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt using a specified Tiltfile instead of the default 'Tiltfile'. ```bash tilt up -f ``` -------------------------------- ### Configure LiveUpdate with sync and run steps Source: https://docs.tilt.dev/live_update_reference.html Demonstrates using sync and run steps within docker_build, including conditional execution via triggers. ```python docker_build('my-img', '.', live_update=[ sync('./src', '/app'), run('/app/setup.sh'), run('cd /app/web && yarn install', trigger='./src/web/yarn.lock'), run('/app/run_configs.sh', trigger=['./configs/foo.yaml', './configs/bar.yaml']) ]) ``` -------------------------------- ### Configure Docker Compose Services Source: https://docs.tilt.dev/docker_compose.html Example docker-compose.yml defining a Redis cache and a Node.js application. ```yaml version: "3.9" services: redis: image: redis container_name: cache expose: - 6379 app: image: tilt.dev/express-redis-app links: - redis ports: - 3000:3000 environment: - REDIS_URL=redis://cache - NODE_ENV=development - PORT=3000 command: sh -c 'node server.js' ``` -------------------------------- ### Load and Use Local Extension Source: https://docs.tilt.dev/contribute_extension.html Configure the extension repository path and load the custom function into a project Tiltfile. ```python v1alpha1.extension_repo(name='default', url='file:///usr/nick/src/tilt-extensions') load('ext://extension_name', 'hi') hi() ``` -------------------------------- ### Build a Bazel image for local use Source: https://docs.tilt.dev/integrating_bazel_with_tilt.html Run this command to build a Bazel image and load it into the local Docker daemon. ```bash bazel run //path/to/my-command:image -- --norun ``` -------------------------------- ### initial_sync Source: https://docs.tilt.dev/api.html Syncs all files to the container when it starts or restarts. When included in a `live_update`, Tilt performs a full sync of all files matching the live update’s `sync` rules the first time a container starts (or whenever it restarts), without waiting for file-change events. This is useful when using pre-built images that may not contain the latest local source files. ```APIDOC ## initial_sync ### Description Syncs all files to the container when it starts or restarts. When included in a `live_update`, Tilt performs a full sync of all files matching the live update’s `sync` rules the first time a container starts (or whenever it restarts), without waiting for file-change events. This is useful when using pre-built images that may not contain the latest local source files. ### Parameters None ### Request Example ```python initial_sync() ``` ### Response #### Success Response (200) This function does not return a value, but initiates an initial sync. #### Response Example None ``` -------------------------------- ### Upgrade Tilt with Conda Source: https://docs.tilt.dev/upgrade.html Update Tilt from the conda-forge channel. Use this if Tilt was installed via Conda. ```bash conda update -c conda-forge tilt ``` -------------------------------- ### Tiltfile for Basic Go Deployment Source: https://docs.tilt.dev/example_go.html Configures Tilt to build a Docker image, deploy a Kubernetes YAML, and set up port forwarding for a Go application. Ensure image and resource names match between Tiltfile and Kubernetes manifests. ```python docker_build('example-go-image', '.', dockerfile='deployments/Dockerfile') k8s_yaml('deployments/kubernetes.yaml') k8s_resource('example-go', port_forwards=8000) ``` -------------------------------- ### Tilt Up with Specific Log Level Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt with a specified log level to control the verbosity of output. ```bash tilt up --log-level ``` -------------------------------- ### Manage Backend Repo with Tilt (Sibling Directory) Source: https://docs.tilt.dev/multiple_repos.html Include a backend Tiltfile from a sibling directory. This approach requires the user to manually clone the backend repository alongside the main project. ```python if not os.path.exists('../backend'): fail('Please "git clone" the backend repo in ../backend!') include('../backend/Tiltfile') ``` -------------------------------- ### Tilt Up with Kubernetes Context Override Source: https://docs.tilt.dev/cli/tilt_up.html Starts Tilt, overriding the Kubernetes context to be used for resource deployment. ```bash tilt up --context ``` -------------------------------- ### Tilt Analytics Help Options Source: https://docs.tilt.dev/cli/tilt_analytics.html Displays help information for the 'tilt analytics' command, including available flags. ```bash -h, --help help for analytics ``` -------------------------------- ### Configure Tiltfile for Deployment Source: https://docs.tilt.dev/example_java.html Basic Tilt configuration to build a Docker image and deploy to Kubernetes. ```python docker_build('example-java-image', '.') k8s_yaml('kubernetes.yaml') k8s_resource('example-java', port_forwards=8000) ```