fix: make version command work anywhere, update docs
This commit is contained in:
parent
d34100ab41
commit
7dd648ceff
37
README.md
37
README.md
@ -4,27 +4,49 @@
|
|||||||
|
|
||||||
Toolset to deploy and maintain infrastructure in automated and trackable manner.
|
Toolset to deploy and maintain infrastructure in automated and trackable manner.
|
||||||
First class support for:
|
First class support for:
|
||||||
- [AWS CloudFormation](https://aws.amazon.com/cloudformation)
|
|
||||||
- [Pulumi](https://www.pulumi.com/docs/)
|
- [Pulumi](https://www.pulumi.com/docs/)
|
||||||
|
- [AWS CloudFormation](https://aws.amazon.com/cloudformation)
|
||||||
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
`$ pip install cloudbender`
|
## Container
|
||||||
|
This most likely only works on a recent Linux box/VM, which is capable of running rootless containers within containers.
|
||||||
|
Requires kernel >= 5.10, cgroupsV2 support, podman, ...
|
||||||
|
|
||||||
# State management
|
```
|
||||||
## Pulumi
|
podman run -it --rm -v .:/workspace -v $HOME/.aws/config:/workspace/.aws/config public.ecr.aws/zero-downtime/cloudbender:latest cloudbender version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Local install
|
||||||
|
1. ```pip install cloudbender```
|
||||||
|
2. ```curl -fsSL https://get.pulumi.com | sh```, see official [Docs](https://www.pulumi.com/docs/get-started/install/)
|
||||||
|
3. Ensure you either have `docker` or `podman` in your PATH.
|
||||||
|
|
||||||
|
To verify that all pieces are in place run:
|
||||||
|
```
|
||||||
|
cloudbender version
|
||||||
|
```
|
||||||
|
which should get you something like:
|
||||||
|
```
|
||||||
|
[2022-06-28 16:06:24] CloudBender: 0.13.4
|
||||||
|
[2022-06-28 16:06:24] Pulumi: v3.34.1
|
||||||
|
[2022-06-28 16:06:24] Podman/Docker: podman version 4.1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## State management
|
||||||
|
### Pulumi
|
||||||
The state for all Pulumi resources are stored on S3 in your account and in the same region as the resources being deployed.
|
The state for all Pulumi resources are stored on S3 in your account and in the same region as the resources being deployed.
|
||||||
No data is send to nor shared with the official Pulumi provided APIs.
|
No data is send to nor shared with the official Pulumi provided APIs.
|
||||||
|
|
||||||
CloudBender configures Pulumi with a local, temporary workspace on the fly. This incl. the injection of various common parameters like the AWS account ID and region etc.
|
CloudBender configures Pulumi with a local, temporary workspace on the fly. This incl. the injection of various common parameters like the AWS account ID and region etc.
|
||||||
|
|
||||||
## Cloudformation
|
### Cloudformation
|
||||||
All state is handled by AWS Cloudformation.
|
All state is handled by AWS Cloudformation.
|
||||||
The required account and region are determined by CloudBender automatically from the configuration.
|
The required account and region are determined by CloudBender automatically from the configuration.
|
||||||
|
|
||||||
|
|
||||||
# CLI
|
## CLI
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage: cloudbender [OPTIONS] COMMAND [ARGS]...
|
Usage: cloudbender [OPTIONS] COMMAND [ARGS]...
|
||||||
@ -58,9 +80,6 @@ Commands:
|
|||||||
- Within the config folder each directory represents either a stack group if it has sub-directories, or an actual Cloudformation stack in case it is a leaf folder.
|
- Within the config folder each directory represents either a stack group if it has sub-directories, or an actual Cloudformation stack in case it is a leaf folder.
|
||||||
- The actual configuration for each stack is hierachly merged. Lower level config files overwrite higher-level values. Complex data structures like dictionaries and arrays are deep merged.
|
- The actual configuration for each stack is hierachly merged. Lower level config files overwrite higher-level values. Complex data structures like dictionaries and arrays are deep merged.
|
||||||
|
|
||||||
## Quickstart
|
|
||||||
TBD
|
|
||||||
|
|
||||||
## Secrets handling
|
## Secrets handling
|
||||||
|
|
||||||
### Pulumi
|
### Pulumi
|
||||||
|
@ -24,31 +24,32 @@ logger = logging.getLogger(__name__)
|
|||||||
def cli(ctx, debug, directory):
|
def cli(ctx, debug, directory):
|
||||||
setup_logging(debug)
|
setup_logging(debug)
|
||||||
|
|
||||||
# Make sure our root is abs
|
# Skip parsing all the things if we just want the versions
|
||||||
if directory:
|
if ctx.invoked_subcommand != "version":
|
||||||
if not os.path.isabs(directory):
|
# Make sure our root is abs
|
||||||
directory = os.path.normpath(os.path.join(os.getcwd(), directory))
|
if directory:
|
||||||
elif os.getenv("CLOUDBENDER_PROJECT_ROOT"):
|
if not os.path.isabs(directory):
|
||||||
directory = os.getenv("CLOUDBENDER_PROJECT_ROOT")
|
directory = os.path.normpath(os.path.join(os.getcwd(), directory))
|
||||||
else:
|
elif os.getenv("CLOUDBENDER_PROJECT_ROOT"):
|
||||||
directory = os.getcwd()
|
directory = os.getenv("CLOUDBENDER_PROJECT_ROOT")
|
||||||
|
else:
|
||||||
|
directory = os.getcwd()
|
||||||
|
|
||||||
# Read global config
|
# Read global config
|
||||||
try:
|
try:
|
||||||
cb = CloudBender(directory)
|
cb = CloudBender(directory)
|
||||||
except InvalidProjectDir as e:
|
except InvalidProjectDir as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cb.read_config()
|
cb.read_config()
|
||||||
cb.dump_config()
|
cb.dump_config()
|
||||||
|
|
||||||
ctx.obj = cb
|
ctx.obj = cb
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.pass_obj
|
def version():
|
||||||
def version(cb):
|
|
||||||
"""Displays own version and all dependencies"""
|
"""Displays own version and all dependencies"""
|
||||||
logger.error(f"CloudBender: {__version__}")
|
logger.error(f"CloudBender: {__version__}")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user