### Installing Tau CLI with NPM Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command installs the Tau CLI tool globally using the Node Package Manager (NPM). It's a quick way to get the CLI set up if you have Node.js and NPM installed on your system. ```bash npm i @taubyte/cli ``` -------------------------------- ### Installing Tau via cURL Source: https://github.com/taubyte/tau/blob/main/README.md This command downloads and executes the Tau installation script directly from the official Tau link using cURL. It's the recommended method for quickly setting up Tau on a new system, ensuring you get the latest stable release. ```Shell curl https://get.tau.link/tau | sh ``` -------------------------------- ### Launching Tau Compute Services Source: https://github.com/taubyte/tau/blob/main/README.md This command starts the Tau compute services. It initiates the core components of the Tau cloud, making it ready to process requests and manage resources. This is the final step after installation and configuration to bring the Tau cloud online and begin operations. ```Shell tau start -s compute ``` -------------------------------- ### Installing Tau CLI with Go Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command uses the Go toolchain to fetch and install the latest version of the Tau CLI directly from its GitHub repository. This method requires a Go development environment to be set up on your machine. ```go go install github.com/taubyte/tau/tools/tau@latest ``` -------------------------------- ### Installing Taubyte Taucorder with yarn (Shell) Source: https://github.com/taubyte/tau/blob/main/pkg/taucorder/clients/js/README.md This snippet demonstrates how to install the `@taubyte/taucorder` package using the yarn package manager. It adds the package as a dependency to your project. ```Shell yarn add @taubyte/taucorder ``` -------------------------------- ### Installing Taubyte Taucorder with npm (Shell) Source: https://github.com/taubyte/tau/blob/main/pkg/taucorder/clients/js/README.md This snippet demonstrates how to install the `@taubyte/taucorder` package using the npm package manager. It adds the package as a dependency to your project. ```Shell npm install @taubyte/taucorder ``` -------------------------------- ### Installing Tau CLI via Self-Extracting Script Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command fetches a self-extracting script from `get.tau.link/cli` using `curl` and pipes it directly to `sh` for execution, providing a convenient and quick way to install the Tau CLI without manual downloads. ```bash curl https://get.tau.link/cli | sh ``` -------------------------------- ### Installing Taubyte CLI (`tau`) with npm Source: https://github.com/taubyte/tau/blob/main/tools/tau/npm/README.md This command installs the Taubyte command-line interface tool, `tau`, globally using npm. It is a prerequisite for interacting with Taubyte Cloud Networks from the terminal. ```shell npm i @taubyte/cli ``` -------------------------------- ### Installing Spore-Drive with npm Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to install the `@taubyte/spore-drive` package using the npm package manager. It's a prerequisite for using the library in a JavaScript/TypeScript project. ```sh npm install @taubyte/spore-drive ``` -------------------------------- ### Installing Spore-Drive with yarn Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to install the `@taubyte/spore-drive` package using the yarn package manager. It's an alternative to npm for managing project dependencies. ```sh yarn add @taubyte/spore-drive ``` -------------------------------- ### Setting Authentication Configurations using Object Syntax (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to define multiple authentication configurations (e.g., username/password, username/key) using a single `set` call with an object. This allows for quick setup of various authentication methods. ```ts await config.auth.set({ main: { username: "tau1", password: "testtest" }, withkey: { username: "tau2", key: "/keys/test.pem" } }); ``` -------------------------------- ### Configuring Tau for Custom ACME Server with Root CA (YAML) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This YAML configuration snippet provides an alternative for Tau's ACME setup, specifying a custom root CA file path and a CAA record for domain validation, enhancing trust and control. ```yaml domains: acme: url: https://localhost:9000/acme/acme/directory ca: root-ca: "/path/to/root/ca/file" caa-record: "myca.org" ``` -------------------------------- ### Configuring Air for Hot Reload Testing Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This snippet illustrates how to configure the `cmd` setting within the `.air.toml` file to enable hot reloading for specific Go tests. This setup allows developers to automatically re-run tests upon code changes, accelerating the development feedback loop. ```toml cmd = "go test -v --run [-tags=no_rebuild] ``` -------------------------------- ### Building Tau CLI from Source Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md These commands clone the Tau CLI source repository, navigate into the directory, and then build the executable using `go build`, placing it in the user's Go binary path. This allows for local development, customization, and building specific versions. ```bash git clone https://github.com/taubyte/tau/tools/tau cd tau go build -o ~/go/bin/tau ``` -------------------------------- ### Running Go Project Tests Source: https://github.com/taubyte/tau/blob/main/clients/http/patrick/README.md This snippet demonstrates how to execute all tests within the current Go project and its sub-packages using the standard `go test` command. It's a common way to ensure code quality and functionality. ```Go go test ./... ``` -------------------------------- ### Rebuilding CDK JS Core WASM Module (Go) Source: https://github.com/taubyte/tau/blob/main/cdk/README.md This snippet provides the command-line instructions to rebuild the `cdk/js/core.wasm` module. It involves navigating into the `plugin/` directory and executing the Go run command, which compiles and generates the WebAssembly binary. ```Go cd plugin/ go run . ``` -------------------------------- ### Initializing and Using Patrick Node REST Client Source: https://github.com/taubyte/tau/blob/main/clients/http/patrick/README.md This Go code illustrates how to initialize the Patrick Node REST client and interact with it. It shows how to create a new client instance, retrieve a list of job IDs for a given project, iterate through them to fetch individual job details (status, repository, log CID), and finally stream the job logs to standard output. Note that the `TimeStamp` field is currently not implemented. ```Go // jid is a job id c := New(ctx, URL(url string), Auth(token string), Provider(provider string)) jids, _ := c.Jobs(projectId string) for _, jid := range jobs { _job, _ := c.Job(jid) _job.Logs // cid of the job's log file _job.Status // The status of the job ( commonPatrick.JobStatus ) _job.Meta.Repository.Id // The repository the job was ran on _job.TimeStamp // NOT IMPLEMENTED, TODO made in patrick/service/http_job.go readCloser, _ := c.LogFile(_job.Logs) // Print logs of the job to stdOut os.Copy(os.Stdout, readCloser) } ``` -------------------------------- ### Deploying Cloud Infrastructure (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet initiates the deployment process using the `displace()` method on the `course` object. It then logs the progress of the deployment, providing real-time updates on the infrastructure provisioning. ```ts await course.displace(); console.log("Displacing..."); for await (const progress of await course.progress()) { console.log(progress); } console.log("Done"); ``` -------------------------------- ### Displaying Go Coverage Report by Function Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command uses the Go toolchain to print a summary of code coverage per function to the console, based on the `cover.out` file. This provides a quick overview of coverage at a granular function level. ```go go tool cover -func=cover.out ``` -------------------------------- ### Loading Spore-Drive Configuration from File System (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to load an existing Spore-Drive configuration from a specified absolute file path. The `init()` method then processes and loads the configuration data from the file. ```ts const config = new Config(`/absolute/path/to/config`); await config.init(); ``` -------------------------------- ### Displaying Go Coverage Report in HTML Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command uses the Go toolchain to open the generated `cover.out` file in a web browser, providing an interactive HTML report of code coverage. This visual representation helps in understanding which parts of the code are covered by tests. ```go go tool cover -html=cover.out ``` -------------------------------- ### Running All Tau Tests - Go Source: https://github.com/taubyte/tau/blob/main/tools/tau/tests/README.md This command executes all Go tests within the current Tau project directory and its subdirectories. It automatically compiles and runs the tests, displaying their output in the terminal. This is the standard way to run the entire test suite. ```Bash $ go test ./... ``` -------------------------------- ### Plotting a Deployment Course (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to 'plot' a deployment course using the `drive` instance. A `CourseConfig` specifies which shapes are targeted for deployment, determining which hosts will be included. ```ts const course = await drive.plot(new CourseConfig(["shape1"])); ``` -------------------------------- ### Running Taubyte CLI with Custom Port and Key (Shell) Source: https://github.com/taubyte/tau/blob/main/tools/taucorder/README.md This command executes the Taubyte application from its source, specifying a custom port for operation and a path to a swarm key for secure communication. The `fqdn` argument is a placeholder for the fully qualified domain name. ```Shell go run . use --port 4201 --key path/to/swarm.key fqdn ``` -------------------------------- ### Connecting to StepCA Docker Container (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This command executes an interactive shell (`sh`) inside the running `step-ca` Docker container, allowing direct access to its environment for further configuration. ```bash docker exec -it step-ca sh ``` -------------------------------- ### Calculating Go Test Coverage Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command runs all Go tests with specific build tags (`localAuthClient`, `projectCreateable`, `localPatrick`, `cover`, `noPrompt`) and generates a detailed code coverage profile (`cover.out`) for all packages. This profile can then be used to analyze test effectiveness. ```go go test -v ./... -tags=localAuthClient,projectCreateable,localPatrick,cover,noPrompt -coverprofile cover.out -coverpkg ./... ``` -------------------------------- ### Loading Spore-Drive Configuration in Memory (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet shows how to create a new, empty configuration object for Spore-Drive in memory. The `init()` method initializes the configuration, making it ready for defining cloud infrastructure. ```ts import { Config } from "@taubyte/spore-drive"; const config = new Config(); await config.init(); ``` -------------------------------- ### Pulling StepCA Docker Image (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This command pulls the official `smallstep/step-ca` Docker image from Docker Hub, which is the first step to setting up a local StepCA instance for testing purposes. ```bash docker pull smallstep/step-ca ``` -------------------------------- ### Generating Tau Configuration Source: https://github.com/taubyte/tau/blob/main/README.md This command generates a new Tau configuration file, specifying the domain name, enabling compute services, including all available services, setting the public IP, enabling distributed validation (--dv), and configuring for a swarm environment (--swarm). This is a crucial step for setting up a multi-node or production Tau cloud. ```Shell tau config generate -n yourdomain.com -s compute --services all --ip your_public_ip --dv --swarm ``` -------------------------------- ### Instantiating a Spore-Drive (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet shows how to create a new `Drive` instance, which is the core component for managing and deploying Tau infrastructure. It requires a `Config` object and a Tau version constant. ```ts import { Drive, TauLatest } from "@taubyte/spore-drive"; const drive = new Drive(config, TauLatest); await drive.init(); ``` -------------------------------- ### Running StepCA Docker Container (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This command runs the StepCA Docker container in detached mode, mapping port 9000, and initializing it with a name and DNS names for `localhost`. It sets up a persistent volume for StepCA data. ```bash docker run -d --name step-ca \ -v step:/home/step \ -p 9000:9000 \ -e DOCKER_STEPCA_INIT_NAME=StepCA \ -e DOCKER_STEPCA_INIT_DNS_NAMES=localhost \ smallstep/step-ca ``` -------------------------------- ### Defining a CLI Command in Go Source: https://github.com/taubyte/tau/blob/main/tools/dream/cli/command/README.md This snippet demonstrates how to define a new command using the `cli.Command` struct in Go. It initializes a command with a specified `Name`, which serves as its identifier for command-line execution. This is a foundational step for creating new command-line functionalities. ```go command := &cli.Command{ Name: "some-command" } ``` -------------------------------- ### Adding ACME Provisioner to StepCA (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This command, executed within the StepCA container, adds an ACME provisioner named `acme` to the certificate authority, enabling ACME protocol support for certificate issuance. ```bash step ca provisioner add acme --type ACME ``` -------------------------------- ### Setting Host Configurations with Granular Control (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to define host configurations with more granular control, setting individual properties like addresses, SSH details, and location. It also shows how to generate host instances for specific shapes. ```ts const host1 = config.host["host1"]; await host1.addresses.add(["1.2.3.4/24", "4.3.2.1/24"]); await host1.ssh.address.set("1.2.3.4:4242"); await host1.ssh.auth.add(["main"]); await host1.location.set("1.25, 25.1"); await host1.shape["shape1"].generate(); await host1.shape["shape2"].generate(); ``` -------------------------------- ### Running All Go Tests Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command executes all Go tests within the current module and its sub-packages, displaying verbose output. It is used to ensure the entire codebase functions as expected and to identify any regressions. ```go go test -v ./... ``` -------------------------------- ### Running Individual Go Prompts Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command executes a specific Go program located at `./prompts/internal`. It is typically used for testing or debugging individual prompt functionalities within the Tau CLI without running the entire application. ```go go run ./prompts/internal ``` -------------------------------- ### Restarting StepCA Docker Container (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This command restarts the `step-ca` Docker container, applying any configuration changes made, such as adding the ACME provisioner. ```bash docker restart step-ca ``` -------------------------------- ### Defining Cloud Infrastructure using Object Syntax (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet illustrates how to define core cloud infrastructure settings, such as domain roots and generated domains, using a single `set` call with an object. It also generates domain validation and P2P swarm configurations. ```ts await config.cloud.set({ domain: { root: "test.com", generated: "gtest.com" } }); await config.cloud.domain.validation.generate(); await config.cloud.p2p.swarm.generate(); ``` -------------------------------- ### Setting P2P Bootstrap Configurations with Granular Control (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to define P2P bootstrap nodes for a specific shape with more granular control, adding nodes individually. This allows for precise management of the peer-to-peer network's bootstrap process. ```ts await config.cloud.p2p.bootstrap.shape["shape1"].nodes.add([ "host2", "host1" ]); ``` -------------------------------- ### Setting P2P Bootstrap Configurations using Object Syntax (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet defines P2P bootstrap nodes for different shapes using a single `set` call with an object. Bootstrap nodes are crucial for the peer-to-peer network's initial connectivity. ```ts await config.cloud.p2p.set({ bootstrap: { shape1: ["host2", "host1"], shape2: ["host2", "host1"] } }); ``` -------------------------------- ### Building Offline Tau CLI Version Source: https://github.com/taubyte/tau/blob/main/tools/tau/README.md This command builds an 'offline' version of the Tau CLI, named `otau`, by including the `localAuthClient` build tag. This version is designed to fail faster if exploring an unregistered project, which can be useful for specific testing or development scenarios. ```go go build -o ~/go/bin/otau -tags=localAuthClient ``` -------------------------------- ### Running All Tau Tests Verbose - Go Source: https://github.com/taubyte/tau/blob/main/tools/tau/tests/README.md This command executes all Go tests within the current Tau project, providing detailed output for each test. The -v flag enables verbose logging, showing the name of each test function as it runs and its status. This is useful for debugging and monitoring test progress. ```Bash $ go test ./... -v ``` -------------------------------- ### Setting Host Configurations and Generating Instances (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet defines multiple host configurations, including addresses, SSH details, and location, using an object. It then generates host instances for specific shapes, linking hosts to their defined infrastructure characteristics. ```ts await config.hosts.set({ host1: { addr: ["1.2.3.4/24", "4.3.2.1/24"], ssh: { addr: "1.2.3.4", port: 4242, auth: ["main"] }, location: { lat: 1.25, long: 25.1 } }, host2: { addr: ["8.2.3.4/24", "4.3.2.8/24"], ssh: { addr: "8.2.3.4", port: 4242, auth: ["withkey"] }, location: { lat: 1.25, long: 25.1 } } }); // Generate host instances key/id await config.host["host1"].shape["shape1"].generate(); await config.host["host1"].shape["shape2"].generate(); await config.host["host2"].shape["shape1"].generate(); await config.host["host2"].shape["shape2"].generate(); ``` -------------------------------- ### Setting Authentication Configurations with Granular Control (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet illustrates how to define authentication configurations with more granular control, accessing and setting individual properties for each signer. This approach provides fine-grained management over authentication details. ```ts const mainAuth = config.auth.signer["main"]; await mainAuth.username.set("tau1"); await mainAuth.password.set("testtest"); const withKeyAuth = config.auth.signer["withkey"]; await withKeyAuth.username.set("tau2"); await withKeyAuth.key.path.set("/keys/test.pem"); ``` -------------------------------- ### Defining Cloud Infrastructure with Granular Control (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet shows how to define cloud infrastructure settings with more granular control, setting individual properties like root and generated domains separately. It also generates domain validation and P2P swarm configurations. ```ts await config.cloud.domain.root.set("test.com"); await config.cloud.domain.generated.set("gtest.com"); await config.cloud.domain.validation.generate(); await config.cloud.p2p.swarm.generate(); ``` -------------------------------- ### Setting Shape Configurations using Object Syntax (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet shows how to define multiple 'shape' configurations, which group services, ports, and plugins, using a single `set` call with an object. Shapes define the characteristics of different infrastructure deployments. ```ts await config.shapes.set({ shape1: { services: ["auth", "seer"], ports: { main: 4242, lite: 4262 } }, shape2: { services: ["gateway", "patrick", "monkey"], ports: { main: 6242, lite: 6262 }, plugins: ["plugin1@v0.1"] } }); ``` -------------------------------- ### Displaying Multi-Host Deployment Progress with Progress Bars (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This TypeScript code snippet demonstrates how to use the `@opentf/cli-pbar` library to display real-time progress for deployments across multiple hosts and tasks. It includes utility functions to extract host and task information from a given path, dynamically creates and updates progress bars for each host, and reports any errors encountered during the displacement process. The progress bars are updated with current values and suffixes indicating the task, and are ultimately marked as 'successful' or 'failed' based on the outcome of the deployment. ```typescript import { ProgressBar } from "@opentf/cli-pbar"; // Extracts the host from the given path function extractHost(path: string): string { const match = path.match(/\/([^\/]+):\d+/); return match ? match[1] : "unknown-host"; } // Extracts the task from the given path function extractTask(path: string): string { const parts = path.split("/"); return parts[parts.length - 1] || "unknown-task"; } async function displayProgress(course: Course) { const multiPBar = new ProgressBar({ size: "SMALL" }); multiPBar.start(); const taskBars: Record = {}; const errors: { host: string; task: string; error: string }[] = []; for await (const displacement of await course.progress()) { const host = extractHost(displacement.path); const task = extractTask(displacement.path); if (!taskBars[host]) { taskBars[host] = multiPBar.add({ prefix: host, suffix: "...", total: 100, }); } taskBars[host].update({ value: displacement.progress, suffix: task }); if (displacement.error) { errors.push({ host, task, error: displacement.error }); } } for (const host in taskBars) { const errorForHost = errors.find((err) => err.host === host); if (errorForHost) { taskBars[host].update({ value: 100, color: "r", suffix: "failed" }); } else { taskBars[host].update({ value: 100, suffix: "successful" }); } } multiPBar.stop(); if (errors.length > 0) { console.log("\nErrors encountered:"); errors.forEach((err) => { console.log(`Host: ${err.host}, Task: ${err.task}, Error: ${err.error}`); }); } } ``` -------------------------------- ### Setting Shape Configurations with Granular Control (TypeScript) Source: https://github.com/taubyte/tau/blob/main/pkg/spore-drive/clients/js/README.md This snippet demonstrates how to define shape configurations with more granular control, setting individual properties like services and ports for a specific shape. This allows for precise definition of infrastructure characteristics. ```ts const shape1 = config.shape["shape1"]; await shape1.services.set(["auth", "seer"]); await shape1.ports.port["main"].set(4242); await shape1.ports.port["lite"].set(4262); ``` -------------------------------- ### Configuring Tau for Custom ACME Server (YAML) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This YAML configuration snippet sets the ACME directory URL for Tau to a local StepCA instance and instructs Tau to skip CA validation, useful for testing with self-signed CAs. ```yaml domains: acme: url: https://localhost:9000/acme/acme/directory ca: skip: true ``` -------------------------------- ### Running Tau Tests with No Rebuild Tag - Go Source: https://github.com/taubyte/tau/blob/main/tools/tau/tests/README.md This command executes Go tests, specifically instructing the test framework not to rebuild the tau command if it already exists. The -tags no_rebuild flag is beneficial for faster test execution when the tau binary is already compiled and up-to-date. This avoids redundant compilation steps. ```Bash $ go test -tags no_rebuild ``` -------------------------------- ### Attaching Name Functionality to a CLI Command in Go Source: https://github.com/taubyte/tau/blob/main/tools/dream/cli/command/README.md This snippet illustrates how to attach a specific functionality, likely related to processing a 'name' argument, to an existing `cli.Command` object. It suggests that `args[0]` will be attributed to the command's name, and an error will be returned if the name is not found, implying a validation or assignment mechanism. ```go command.Name(command) ``` -------------------------------- ### Debugging Specific Tau Test with Rebuild - asd air Source: https://github.com/taubyte/tau/blob/main/tools/tau/tests/README.md This command sequence navigates to the tests directory and then uses asd air to run a specific test, rebuilding the tau command whenever relevant files change. It's designed for hot-reloading and continuous testing during development. Replace with the actual test file or function name. ```Bash $ cd tests # Rebuilds the tau command and runs the test anytime a file in the tests directory changes $ asd air ``` -------------------------------- ### Debugging Specific Tau Test Without Rebuild - asd air Source: https://github.com/taubyte/tau/blob/main/tools/tau/tests/README.md This command runs a specific test using asd air without rebuilding the tau command, useful when the tau binary is already up-to-date. The -tags no_rebuild flag prevents unnecessary recompilation, speeding up repeated test runs. Replace with the actual test file or function name. ```Bash $ asd air -tags no_rebuild ``` -------------------------------- ### Checking StepCA Health Status (Bash) Source: https://github.com/taubyte/tau/blob/main/pkg/http-auto/README.md This `curl` command checks the health endpoint of the locally running StepCA server on port 9000 to ensure it is operational and accessible. ```bash curl http://localhost:9000/health ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.