DRAFT: Taskfile.yaml to facilitate orchestration of Cosmos#2839
DRAFT: Taskfile.yaml to facilitate orchestration of Cosmos#2839haisamido wants to merge 3 commits intoOpenC3:mainfrom
Conversation
Introduced a comprehensive Taskfile.yaml that provides an alternative to openc3.sh for managing Docker containers and development workflows: - Added container lifecycle tasks (start, run, stop, build, cleanup) - Added CLI wrapper tasks for plugin generation and validation - Added test runner tasks for RSpec, Playwright, and coverage - Added utility tasks for encoding, hashing, and image management - Added local development tasks for Ruby, Python, and frontend - Parameterized container runtime via CONTAINER_BIN variable (docker/podman) - Included success message with access instructions after startup Created architecture.md documenting the system architecture: - Added Mermaid diagram showing all services and dependencies - Documented service descriptions for proxy, API, core, and data layers - Listed Docker volumes and their purposes - Described network ports and communication patterns - Outlined service dependency tree and startup sequence - Summarized the technology stack
…ADME
Taskfile.yaml:
- Added PORT variable with default value of 2900 for configurable web interface access
- Added ANSI color code variables (YELLOW_BOLD, CYAN_BOLD, RESET) for terminal styling
- Added silent: true to tasks (default, start, run, stop, logs, ps, cli, cliroot,
cli-help, generate:plugin, generate:target, cli-validate, cli-load, xtce-import,
xtce-export) to suppress command echoing for cleaner output
- Replaced hardcoded localhost:2900 references with {{.PORT}} variable in descriptions
- Added colored startup message to run task displaying web interface URL
- Added progress echo statements to stop task showing each container being stopped
with "(if running)" suffix for better user feedback
- Added completion message "COSMOS containers stopped." at end of stop task
README.md:
- Added Dependencies section with Taskfile subsection
- Added link to Taskfile website and installation guide
|
|
One of my requirements for COSMOS is that it only requires Docker/Docker Compose. This appears like it would add another dependency on the host system. Is that accurate? Also what is the advantage over the existing openc3.sh/openc3.bat? |
Very important question! Why a Taskfile for OpenC3 COSMOS
What the Taskfile ProvidesDiscoverability — task
task: Available tasks for this project:
* api-cmd-tlm-test: Run cmd-tlm-api RSpec tests
* api-script-runner-test: Run script-runner-api RSpec tests
* build: Build all COSMOS Docker containers from source
* build-image: Build a specific Docker image
* build-ubi: Build COSMOS UBI containers
* cleanup: Remove all Docker volumes and data (DESTRUCTIVE!)
* cleanup-force: Remove all Docker volumes without confirmation
* cleanup-local: Remove Docker volumes and local plugin files
* cli: Run COSMOS CLI commands in a container
* cli-help: Show COSMOS CLI help
* cli-load: Load a plugin
* cli-validate: Validate a plugin
* cliroot: Run COSMOS CLI commands as root user
* default: Show available tasks
* frontend-build: Build frontend shared packages
* frontend-install: Install frontend dependencies
* frontend-lint: Run ESLint on frontend code
* hooks-install: Install git hooks
* logs: Follow logs from all containers
* ps: Show status of COSMOS containers
* python-coverage: Run Python tests with coverage
* python-install: Install Python dependencies
* python-lint: Run Python linter (ruff)
* python-test: Run Python tests
* ruby-build: Compile Ruby C extensions
* ruby-install: Install Ruby dependencies
* ruby-test: Run Ruby RSpec tests
* run: Start COSMOS containers in detached mode
* run-ubi: Run COSMOS with UBI containers
* setup: Run initial setup (download certificates, etc.)
* start: Build and run COSMOS (development) or just run (runtime)
* start-ubi: Build and run COSMOS with UBI images
* stop: Stop all COSMOS containers gracefully
* test-hash: Run comprehensive tests with coverage
* test-playwright: Run Playwright end-to-end tests
* test-playwright-build: Build the plugin for Playwright tests
* test-playwright-install: Install Playwright and dependencies
* test-playwright-run: Run Playwright tests
* test-rspec: Run RSpec tests against Ruby code
* util-clean: Remove node_modules, coverage, etc.
* util-encode: Encode a string to base64
* util-hash: Hash a string using SHA-256
* util-load: Load Docker images from tar files
* util-push: Push images to Docker repository
* util-save: Save Docker images to tar files
* util-tag: Tag images from one repo to another
* xtce-export: Convert COSMOS plugin to XTCE format
* xtce-import: Convert XTCE file to COSMOS configuration
* generate:plugin: Generate a new plugin
* generate:target: Generate a new targetWorking directory handling — Each task declares its Co-located documentation — Declarative environment — vars:
CONTAINER_BIN: '{{.CONTAINER_BIN | default "docker"}}'
PORT: '{{.PORT | default "2900"}}'Safety — Destructive operations use a built-in Composition — Automation Possibilities
CostOne static binary ( |
|
Another example: task --summary run
task: run
Start all OpenC3 COSMOS containers in detached mode.
Containers will run in the background. Access COSMOS at http://localhost:2900
Common services:
- openc3-operator - Main orchestration service
- openc3-cosmos-cmd-tlm-api - Command/Telemetry API
- openc3-cosmos-script-runner-api - Script execution service
- openc3-redis - Redis database
- openc3-buckets - Object storage
vars:
CONTAINER_BIN: "docker"
ENV_FILE: ".env"
COMPOSE_FILE: "compose.yaml"
COMPOSE_BUILD_FILE: "compose-build.yaml"
PORT: "2900"
YELLOW_BOLD: "\033[1;33m"
CYAN_BOLD: "\033[1;36m"
RESET: "\033[0m"
env:
OPENC3_DEMO: "1"
OPENC3_DEPENDENCY_REGISTRY: "docker.io"
OPENC3_REGISTRY: "docker.io"
OPENC3_LOCAL_MODE: "1"
OPENC3_REDIS_EPHEMERAL_HOSTNAME: "openc3-redis-ephemeral"
OPENC3_REDIS_HOSTNAME: "openc3-redis"
OPENC3_PLUGIN_DEFAULT_VOLUME: "/plugins/DEFAULT"
OPENC3_SR_REDIS_USERNAME: "scriptrunner"
OPENC3_GEMS_VOLUME: "/gems"
OPENC3_UBI_TAG: "9.6"
OPENC3_UBI_IMAGE: "ironbank/redhat/ubi/ubi9-minimal"
MIGRATION_FILES_BEFORE_PAUSE: "10"
OPENC3_TSDB_USERNAME: "openc3quest"
SECRET_KEY_BASE: "bdb4300d46c9d4f116ce3dbbd54cac6b20802d8be1c2333cf5f6f90b1627799ac5d043e8460744077bc0bd6aacdd5c4bf53f499a68303c6752e7f327b874b96a"
OPENC3_ENTERPRISE_REGISTRY: "ghcr.io"
OPENC3_BUCKET_URL: "http://openc3-buckets:9000"
OPENC3_LOGS_BUCKET: "logs"
OPENC3_TOOLS_BUCKET: "tools"
OPENC3_UBI_REGISTRY: "registry1.dso.mil"
OPENC3_IMAGE_SUFFIX: ""
OPENC3_TAG: "latest"
ALPINE_BUILD: "3"
OPENC3_BUCKET_USERNAME: "openc3bucket"
OPENC3_SR_BUCKET_PASSWORD: "scriptrunnerbucketpassword"
OPENC3_SERVICE_PASSWORD: "openc3service"
PYPI_URL: "https://pypi.org"
MIGRATION_PAUSE_SECONDS: "30"
OPENC3_NAMESPACE: "openc3inc"
OPENC3_REDIS_USERNAME: "openc3"
OPENC3_REDIS_PORT: "6379"
OPENC3_TSDB_QUERY_PORT: "8812"
OPENC3_REDIS_PASSWORD: "openc3password"
RUBYGEMS_URL: "https://rubygems.org"
OPENC3_BUCKET_PASSWORD: "openc3bucketpassword"
ALPINE_VERSION: "3.22"
MIGRATION_SLEEP_SECONDS: "0.5"
OPENC3_REDIS_EPHEMERAL_PORT: "6380"
OPENC3_TSDB_HOSTNAME: "openc3-tsdb"
NPM_URL: "https://registry.npmjs.org"
OPENC3_CONFIG_BUCKET: "config"
OPENC3_SR_REDIS_PASSWORD: "scriptrunnerpassword"
OPENC3_SR_BUCKET_USERNAME: "scriptrunnerbucket"
OPENC3_CLOUD: "local"
OPENC3_AWS_ARN_PREFIX: "arn:aws"
OPENC3_TSDB_INGEST_PORT: "9000"
OPENC3_TSDB_PASSWORD: "openc3questpassword"
MAVEN_URL: "https://repo.maven.apache.org/maven2"
OPENC3_ENTERPRISE_NAMESPACE: "openc3"
APK_URL: "https://dl-cdn.alpinelinux.org"
MIGRATION_BATCH_SIZE: "1000"
commands:
- Task: _check-root
- docker compose -f compose.yaml up -d
- echo ""
echo -e "\033[1;33mCOSMOS is started. Access the web interface at:\033[0m"
echo -e " \033[1;36mhttp://localhost:2900\033[0m"
echo "" |



Closes #2840