Skip to content

feat(cli): add Python stackctl with overlays and SOPS; wrap bash script#322

Open
wax911 wants to merge 9 commits into
devfrom
build/ochestration-management
Open

feat(cli): add Python stackctl with overlays and SOPS; wrap bash script#322
wax911 wants to merge 9 commits into
devfrom
build/ochestration-management

Conversation

@wax911
Copy link
Copy Markdown
Member

@wax911 wax911 commented Oct 16, 2025

  • Add tools/stackctl_cli.py with commands: render, deploy (--follow-logs), down, status, logs, env, secrets (encrypt/decrypt), doctor run

  • Support environment overlays via environments//.overlay.yml (deep-merge)

  • Reuse tools/render_compose.py for per-service env interpolation and absolutized paths

  • Replace bash stackctl.sh with wrapper delegating to Python CLI and mapping legacy flags (e.g., --no-logs -> --no-follow-logs)

  • Add .sops.yaml.example and remove tracked .sops.yaml to encourage local policy and encrypted files in VCS

  • Update tools/requirements.txt (typer, rich, mergedeep)

  • Expand .gitignore for Python/virtualenv/VS Code and ensure .env is ignored

Copilot AI review requested due to automatic review settings October 16, 2025 18:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive Python-based replacement for the existing bash stackctl.sh script, adding support for environment overlays, SOPS-based secret management, and improved CLI functionality. The changes modernize the stack management workflow while maintaining backward compatibility through a bash wrapper.

Key changes:

  • New Python CLI (tools/stackctl_cli.py) with enhanced features including environment overlays and SOPS integration
  • Bash script converted to compatibility wrapper that maps legacy flags to Python CLI
  • SOPS configuration moved from tracked .sops.yaml to example file to encourage local customization

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/stackctl_cli.py New Python CLI implementation with commands for render, deploy, logs, env management, secrets handling, and doctor checks
tools/requirements.txt Added Python dependencies (typer, rich, mergedeep) for the new CLI
stackctl.sh Converted from full implementation to compatibility wrapper delegating to Python CLI
.sops.yaml.example Example SOPS configuration file for users to customize locally
.sops.yaml Removed tracked SOPS configuration to prevent accidental key exposure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tools/stackctl_cli.py Outdated
Comment thread tools/stackctl_cli.py Outdated
Comment thread tools/stackctl_cli.py Outdated
Comment thread stackctl.sh Outdated
@wax911 wax911 force-pushed the build/ochestration-management branch from fbacd96 to 4c97b9b Compare October 16, 2025 18:37
@wax911
Copy link
Copy Markdown
Member Author

wax911 commented Jan 7, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown

Copilot AI commented Jan 7, 2026

@wax911 I've opened a new pull request, #374, to work on those changes. Once the pull request is ready, I'll request review from you.

wax911 and others added 9 commits March 12, 2026 10:05
- Add tools/stackctl_cli.py with commands: render, deploy (--follow-logs), down, status, logs, env, secrets (encrypt/decrypt), doctor run

- Support environment overlays via environments/<env>/<stack>.overlay.yml (deep-merge)

- Reuse tools/render_compose.py for per-service env interpolation and absolutized paths

- Replace bash stackctl.sh with wrapper delegating to Python CLI and mapping legacy flags (e.g., --no-logs -> --no-follow-logs)

- Add .sops.yaml.example and remove tracked .sops.yaml to encourage local policy and encrypted files in VCS

- Update tools/requirements.txt (typer, rich, mergedeep)

- Expand .gitignore for Python/virtualenv/VS Code and ensure .env is ignored
…to deploy

- Treat no-command ("") as a request for --help (do not implicitly run deploy)
- Print explicit ERROR for unknown commands and display help
- Remove legacy fallback behavior in stackctl.sh compatibility wrapper
…ements

- Add environments/local overlays for infrastructure and observability

- Add pytest test for deep-merge overlay behavior

- Update tools/requirements.txt to include pytest
- Add placeholder apisix/api-gateway/.env.example.enc.yaml

- Add docs/SOPS-usage.md with examples for local encrypt/decrypt
- Add docs/SOPS-usage.md and example encrypted file for apisix api-gateway
Introduce run_py and check_py_cli helpers and centralize all python3 calls
through run_py. Add info/warn/die helpers and improved error messages.

Add a bootstrap command that:
- copies .env.example -> .env when missing
- installs tools/requirements.txt into active venv (warn if no venv)
- checks Docker presence and Docker Swarm state, with guidance

Also keep legacy flag mappings for deploy and ensure help is shown for
empty/unknown commands.
Introduce a "Bootstrap (developer setup)" section showing ./stackctl.sh --bootstrap and what it does:
- copies missing .env files from .env.example
- installs Python requirements when a virtualenv is active
- checks Docker installation and Docker Swarm status

Notes that the helper is a safe convenience (won't overwrite or commit .env files) and links to tools/README.md for more details.
…g, unused var (#374)

* Initial plan

* fix(cli): address PR review comments - cross-platform time, formatting, unused var

Co-authored-by: wax911 <7859175+wax911@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wax911 <7859175+wax911@users.noreply.github.com>
@wax911 wax911 force-pushed the build/ochestration-management branch from 1de7bd0 to c8b1656 Compare March 12, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants