Skip to main content

Python CLI to manage stacks from DNX.

Project description

one-cli

CLI to manage all stacks from DNX.

Build PyPI LICENSE

Quick start

  1. Download the latest release with the command.
curl -sSL https://raw.githubusercontent.com/DNXLabs/one-cli/master/get_one.sh | bash
  1. Test to ensure the version you installed is up-to-date.
one --version
  1. Install shell completion (Optional)
curl -sSL https://raw.githubusercontent.com/DNXLabs/one-cli/master/shell_completion.py | python3

Install specific version

export ONE_VERSION=<version>

# Linux
sudo curl -L https://github.com/DNXLabs/one-cli/releases/download/$ONE_VERSION/one_linux_amd64 -o /usr/local/bin/one
# Macos
sudo curl -L https://github.com/DNXLabs/one-cli/releases/download/$ONE_VERSION/one_macos_amd64 -o /usr/local/bin/one

sudo chmod +x /usr/local/bin/one

Install with PyPi

PyPI Project

pip3 install one-cli

# or setting a version

pip3 install one-cli==<version>

CI/CD pipelines with Docker

To use the CLI within any CI/CD pipeline we encourage to use our docker image:

dnxsolutions/one-cli

WARNING: This docker image should only be used inside CI/CD pipelines and it can generate error if used as an alias.

Usage

Usage: one [OPTIONS] COMMAND [ARGS]...

  CLI to manage all stacks from DNX.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  app        Group of app commands wrapped inside docker.
  auth       Group of auth commands.
  aws        AWS CLI alias.
  aws-v2     AWS v2 CLI alias.
  init       Create config file for CLI in current directory.
  terraform  Group of terraform commands wrapped inside docker.
  workspace  Manage workspaces.

Configuration Example

one.yaml

images:
  terraform: dnxsolutions/terraform:0.13.0-dnx1
  gsuite: dnxsolutions/aws-google-auth:latest
  azure: dnxsolutions/docker-aws-azure-ad:latest
  aws: dnxsolutions/aws:1.18.44-dnx2
  aws_2: dnxsolutions/aws:2.0.37-dnx1
  ecs_deploy: dnxsolutions/ecs-deploy:1.2.0

required_version: ">= 0.5.0, <= 0.7.0"

# ECS App
app:
  name: copacabana
  port: 80
  docker:
    file: Dockerfile
    image_name: copacabana
    registry_type: ecr
    registry_options:
      ecr_aws_account_id: <redact>
      ecr_aws_region: ap-southeast-2
      ecr_aws_assume_role: true
      ecr_aws_role: <redact>
  ecs_task_definition_file: task-definition.tpl.json

# Static App
app:
  type: static
  src: ./build
  s3_bucket_name: <redact>
  distribution_id: <redact>

workspaces:

  # ECS App example:
  mgmt_ecs_app:
    type: ecs
    aws:
      account_id: <redact>
      role: <redact>
      assume_role: true|false (default to false)
      region: ap-southeast-2
    ecs_cluster_name: cluster-01

  # Static App example:
  mgmt_static_app:
    aws:
      account_id: <redact>
      role: <redact>
      region: ap-southeast-2
      assume_role: true
    # Override the template static app
    app:
      src: ./build
      s3_bucket_name: <redact>
      distribution_id: <redact>

  # Terraform example
  mgmt:
    aws:
      account_id: <redact>
      role: <redact>
  nonprod:
    aws:
      account_id: <redact>
      role: <redact>
  prod:
    aws:
      account_id: <redact>
      role: <redact>
  default:
    aws:
      account_id: <redact>
      role: <redact>
      assume_role: true|false (default to false)

Plugin System

To give better support for customization inside the CLI we created a plugin system that you can extend code, creating new commands and groups and even modify the existing ones.

All plugins need to be python packages to work.

List of plugins

Running

$ one my_plugin
It works!

Manualy generate binary

pip install pyinstaller
pyinstaller --clean --hidden-import one.__main__ cli.py --onefile --noconsole -n one

Development

Dependencies

  • Python 3

Python Virtual Environment

# Create environment
python3 -m venv env

# To activate the environment
source env/bin/activate

# When you finish you can exit typing
deactivate

Install dependencies

pip3 install --editable .

Author

Managed by DNX Solutions.

License

Apache 2 Licensed. See LICENSE for full details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

one-cli-0.7.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

one_cli-0.7.0-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file one-cli-0.7.0.tar.gz.

File metadata

  • Download URL: one-cli-0.7.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for one-cli-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b0e8c42f28192435f069e0fd1634bc176512524180c70e99d18319c0bb0bd00e
MD5 bd86052352c38312467a5fe81be66eb2
BLAKE2b-256 73ebd1bd810681b15a7f7e2fb2cc4be5e9ae362e8ddf7a265805345e19a22ba0

See more details on using hashes here.

File details

Details for the file one_cli-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: one_cli-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for one_cli-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d875f980d77facc029bd04df8388b43f030701fdd0378a29b08681fdeef21f13
MD5 cfb193cf3cb28af0325f80a4ae622fe9
BLAKE2b-256 df73d82a65d46faad3f1065f85f5cba8c8d76ea82a222eb6c677727acfd5b7d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page