Skip to main content
This guide details the onboarding process for engineers and operators. It covers the transition from a fresh repository clone to a verified, running development environment using the palyra CLI and its built-in automation.

Environment Bootstrapping

The Palyra repository utilizes a set of bootstrap scripts to ensure consistent toolchains across different operating systems. These scripts prepare the environment for cargo and the palyra CLI.

The Bootstrap Process

  1. Toolchain Verification: Checks for rustc, cargo, and required LLVM/Clang dependencies for Wasm compilation.
  2. Dependency Installation: Installs system-level dependencies (e.g., sqlite3, openssl, pkg-config).
  3. CLI Compilation: Builds the palyra CLI binary from source.

Initialization with palyra setup

The palyra setup command is the primary entry point for configuring a new installation. It supports both automated and interactive “Wizard” modes to generate the necessary configuration files and directory structures.

Setup Modes and Flows

The setup process is governed by the InitModeArg and WizardOverridesArg structures crates/palyra-cli/src/commands/setup.rs#4-10.
FlowDescriptionKey Arguments
QuickstartMinimal interaction; sets up a local daemon with OpenAI/Anthropic defaults.--flow quickstart --wizard
ManualStep-by-step configuration of TLS, ports, and provider settings.--flow manual --wizard
RemoteConfigures the CLI to connect to an existing remote gateway.--mode remote --flow remote

The Onboarding Wizard

The Wizard implementation uses a WizardSession that interacts with a WizardBackend to handle user input crates/palyra-cli/src/commands/wizard.rs#155-161. It supports various step types:

Wizard Logic Flow

The following diagram illustrates the flow from the CLI command to the generation of configuration. Setup Wizard Data Flow Sources: crates/palyra-cli/src/commands/setup.rs#3-55, crates/palyra-cli/src/commands/wizard.rs#147-157, crates/palyra-cli/src/commands/configure.rs#6-78

Profile Management

Palyra uses a profile system to manage multiple environments (e.g., local, staging, prod) within the same installation. Profiles are stored in a CliProfilesDocument located at cli/profiles.toml within the state root crates/palyra-cli/src/app/mod.rs#82-89.

Profile Structure

Each CliConnectionProfile tracks:

Profile Commands

Sources: crates/palyra-cli/src/app/mod.rs#24-31, crates/palyra-cli/src/commands/profile.rs#10-32, crates/palyra-cli/src/args/profile.rs#49-163

Environment Verification with palyra doctor

The doctor command provides a comprehensive diagnostic and repair suite. It identifies inconsistencies in configuration, state, and connectivity.

Diagnostic Categories

The doctor command executes a series of DoctorRepairStep checks crates/palyra-cli/src/commands/doctor/recovery.rs#105-118:
  1. Toolchain: Verifies required binaries and versions.
  2. Configuration: Checks for schema mismatches or missing files crates/palyra-cli/src/commands/doctor/recovery.rs#179-191.
  3. Connectivity: Tests gRPC and HTTP gateway reachability crates/palyra-cli/src/commands/doctor/recovery.rs#206-208.
  4. Security: Audits the AccessRegistry and AuthProfileRegistry crates/palyra-cli/src/commands/doctor/recovery.rs#195-205.

Repair and Rollback

When run with --repair, the doctor generates a DoctorRepairPlan crates/palyra-cli/src/commands/doctor/recovery.rs#172-176. Doctor Diagnostic and Repair Architecture Sources: crates/palyra-cli/src/commands/doctor/recovery.rs#48-102, crates/palyra-cli/src/commands/doctor/recovery.rs#141-169, crates/palyra-cli/tests/wizard_cli.rs#58-66

Summary of Setup Commands

CommandPurpose
palyra setup --wizardGuided first-time installation and provider configuration.
palyra profile listView all configured environments and the active profile.
palyra profile use <name>Switch the active CLI context.
palyra doctorRun diagnostics on the current environment.
palyra doctor --repairInteractively fix identified issues and misconfigurations.
Sources: crates/palyra-cli/tests/help_snapshots/setup-help.txt#1-115, crates/palyra-cli/tests/help_snapshots/profile-help.txt#1-64