Metadata-Version: 2.4
Name: stratactl
Version: 1.0.1
Summary: StrataCTL — bootstrap StrataCI into a customer AWS account and install/update/uninstall StrataBI modules via an ephemeral CodeBuild runner.
Author-email: Shaleio LLC <info@shaleio.com>
License: Apache-2.0
Project-URL: Homepage, https://shaleio.com
Project-URL: Documentation, https://shaleio.com/docs
Project-URL: Source, https://github.com/shaleio/stratactl
Project-URL: Issues, https://github.com/shaleio/stratactl/issues
Keywords: stratabi,aws,codebuild,opentofu,terraform,cli,analytics
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Installation/Setup
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: boto3>=1.34
Requires-Dist: pyyaml>=6
Requires-Dist: platformdirs>=4
Provides-Extra: runner
Requires-Dist: cryptography>=42; extra == "runner"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: build>=1; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"

# StrataCTL

The local command-line tool for operators. It installs, updates, and removes
StrataBI modules and the StrataBI platform in **your** AWS account, fetches the
account-entitled runtime, and version-controls dashboards. It runs on your machine
with your own AWS credentials — it is not a hosted service.

The same `strata` package is also the **runner program** that executes inside the
ephemeral CodeBuild runner (`python -m strata.runner`).

## Install

```bash
python3 -m venv ~/.venvs/strata && source ~/.venvs/strata/bin/activate
pip install -e .            # from this directory; exposes the `stratactl` command
stratactl --help
```

## Configure

`strata init` collects a deployment's configuration into `strata.yaml` (the source
of truth) and generates the Terraform variable files — you don't hand-edit `.tfvars`.

```bash
stratactl init                     # interactive; re-run to reuse answers + fill gaps
stratactl init --non-interactive   # config + defaults only (automation)
```

Settings resolve in this precedence (highest first): **CLI flag → env (`STRATA_*`)
→ `./.stratactl.toml` → `~/.stratactl/config.toml` → AWS SSM (`/strataci/hq/*`) →
packaged defaults**. Point it at a customer account by pasting the
`stratactl_customer_config` output from `strataci-runner` into your config, and set
your license token:

```bash
export STRATA_HQ_TOKEN=<your license token>
```

AWS credentials come from your normal profile/keys (`--profile`, `AWS_PROFILE`, env).
What you can deploy is governed by your own IAM in the target account.

## Commands

```bash
stratactl init                            # configure a deployment (writes strata.yaml + tfvars)
stratactl fetch-runtime --version 1.0.0   # pull the account-entitled runtime wheel -> ./dist (verified)
stratactl install <module>                # entitlement -> runner -> tofu apply, in your account
stratactl install-stratabi                # install the StrataBI platform (Enterprise)
stratactl install-stratabi-dev            # install the Developer/Community edition
stratactl update <module> --to <version>
stratactl uninstall <module>              # runs the module's tofu destroy (always available)
stratactl list                            # what's installed + delivery mode
stratactl logs <job-id>                   # tail/replay a runner build
stratactl dashboards pull|push|list|diff  # git-sync dashboards (no runner needed)
```

`--source stratahq` (default) fetches a signed bundle from Shaleio's control plane;
`--source customer_s3` installs from your own bucket (offline / air-gapped).

## End-to-end: deploy StrataBI Enterprise

```bash
# 0. one-time per account: scaffold the runner  (see ../strataci-runner)
# 1. build the runtime container image          (see ../build_template)  -> ECR image URI
# 2. configure + deploy:
export STRATA_HQ_TOKEN=<token>
stratactl init            # set stratabi_image=<ECR URI>, vpc_id, subnets, allowed_ip_cidrs
stratactl install-stratabi
stratactl list
```

Your `strata init` values ride through to the ephemeral runner automatically (the
CLI uploads them; the runner applies them over the bundle's baked defaults), so the
platform deploys with your networking/image without any manual `.tfvars` on the runner.

## Layout

| Path | What |
|------|------|
| `src/strata/commands/` | CLI subcommands (`init`, `install`, `fetch_runtime`, `dashboards`, …) |
| `src/strata/hq/` | StrataHQ client (SigV4-signed entitlement calls) |
| `src/strata/runner/` | the program that runs inside CodeBuild |
| `src/strata/install/` | the `strata init` wizard (schema / prompt / store / tfvars) |
| `src/strata/artifacts/` | bundle download / verify / manifest |
| `tests/` | unit tests (`pytest`) |
