diff --git a/README.md b/README.md index 918b36c..aeccb26 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,91 @@ ![release prod](https://github.com/DomainDrivenArchitecture/dda-devops-build/workflows/release%20prod/badge.svg) -dda-devops-build provide a environment to tie several DevOps tools together for easy interoperation. Supported tools are: -* aws with - * simple api-key auth - * mfa & assume-role auth -* hetzner with simple api-key auth -* terraform v0.11, v0.12 supporting - * local file backends - * s3 backends -* docker / dockerhub -* user / team credentials managed by gopass -* dda-pallet +dda-devops-build integrates all the tools we use to work with clouds & provide some nice functions around. + +Tools we support are + +* terraform: for setting up the plain infrastructure around. +* docker: for creating images +* c4k: for generating kubernetes manifests +* provs: for setting up small single-node k3s clusters +* gopass: for credential management on devops computers +* cloud providers: hetzner, digitalocean, aws + +In addition we provide a ReleaseMixin for release related tasks like tag / publish & version-bump + +```mermaid +classDiagram + class DevopsBuild { + name() + build_path() + initialize_build_dir() + } + + + class DevopsTerraformBuild { + terraform_build_commons_path() + project_vars() + initialize_build_dir() + post_build() + read_output_json() + plan() + plan_fail_on_diff() + apply(auto_approve=False) + refresh() + destroy(auto_approve=False) + tf_import(tf_import_name, tf_import_resource,) + print_terraform_command(terraform) + } + + class DevopsImageBuild { + def initialize_build_dir() + image() + drun() + dockerhub_login() + dockerhub_publish() + test() + } + + class ReleaseMixin { + prepare_release() + tag_and_push_release() + } + + class ProvsK3sBuild { + def update_runtime_config(dns_record) + write_provs_config() + provs_apply(dry_run=False) + } + + class C4kBuild { + def update_runtime_config(dns_record) + def write_c4k_config() + def write_c4k_auth() + c4k_apply(dry_run=False) + } + + DevopsBuild <|-- DevopsImageBuild + DevopsBuild <|-- DevopsTerraformBuild + DevopsBuild <|-- ReleaseMixin + DevopsBuild <|-- ProvsK3sBuild + DevopsBuild <|-- C4kBuild + +``` + +Principles we follow are: + +* Seperate build artefacts from version controlled code +* Domain Driven Design - in order to stay sustainable # Setup -Ensure that yout python3 version is at least Python 3.7! +Ensure that yout python3 version is at least Python 3.10 ``` sudo apt install python3-pip -pip3 install pip3 --upgrade -pip3 install pybuilder ddadevops deprecation +pip3 install -r requirements.txt export PATH=$PATH:~/.local/bin - -# in case of using terraform -pip3 install dda-python-terraform packaging - -# in case of using AwsMixin -pip3 install boto3 - -# in case of using AwsMfaMixin -pip3 install boto3 mfa ``` # Example Build diff --git a/doc/architecture/BuildAndMixins.md b/doc/architecture/BuildAndMixins.md deleted file mode 100644 index 6418255..0000000 --- a/doc/architecture/BuildAndMixins.md +++ /dev/null @@ -1,98 +0,0 @@ -# Overview of Build and Mixins - -* Build can be used standalone -* Mixin can be added to Build - -```mermaid -classDiagram - class DevopsBuild { - name() - build_path() - initialize_build_dir() - } - - - class DevopsTerraformBuild { - terraform_build_commons_path() - project_vars() - copy_build_resource_file_from_package(name) - copy_build_resources_from_package() - copy_build_resources_from_dir() - initialize_build_dir() - post_build() - read_output_json() - plan() - plan_fail_on_diff() - apply(auto_approve=False) - refresh() - destroy(auto_approve=False) - tf_import(tf_import_name, tf_import_resource,) - print_terraform_command(terraform) - } - - class HetznerMixin { - // HetznerMixin -> HetznerTerraformBuild - project_vars() - copy_build_resources_from_package() - } - - class ExoscaleMixin { - // ExoscaleMixin -> ExoscaleTerraformBuild - project_vars() - copy_build_resources_from_package() - } - - class AwsBackendPropertiesMixin { - def project_vars() - copy_build_resources_from_package() - } - - class DigitaloceanBackendPropertiesMixin { - project_vars(self) - copy_build_resources_from_package(self) - } - - class DevopsImageBuild { - def initialize_build_dir() - image() - drun() - dockerhub_login() - dockerhub_publish() - test() - } - - class ReleaseMixin { - prepare_release() - tag_and_push_release() - } - - class ProvsK3sBuild { - // ProvsK3sBuild -> ProvsK3sBuild - def update_runtime_config(fqdn, ipv4, ipv6=None) - write_provs_config() - provs_apply(dry_run=False) - } - - class C4kMixin { - // C4kMixin -> C4k - def write_c4k_config() - def write_c4k_auth() - c4k_apply(dry_run=False) - } - - DevopsBuild <|-- DevopsImageBuild - DevopsBuild <|-- DevopsTerraformBuild - DevopsBuild <|-- AwsRdsPgMixin - DevopsBuild <|-- ReleaseMixin - - DevopsTerraformBuild <|-- AwsBackendPropertiesMixin - DevopsTerraformBuild <|-- DigitaloceanTerraformBuild - DevopsTerraformBuild <|--ExoscaleMixin - DevopsTerraformBuild <|--HetznerMixin - DevopsBuild <|-- ProvsK3sBuild - DigitaloceanTerraformBuild <|-- DigitaloceanBackendPropertiesMixin - AwsBackendPropertiesMixin <|-- AwsMfaMixin - - DevopsBuild <|-- C4kMixin - -```