This release is a pre-release and may not be stable for production use.
dda-devops-build
|
team@social.meissa-gmbh.de | Website & Blog
dda-devops-build provide a envioronment 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
Setup
sudo apt install python3-pip
pip3 install pip3 --upgrade --user
pip3 install pybuilder ddadevops deprecation --user
export PATH=$PATH:~/.local/bin
# in case of using terraform
pip3 install python-terraform --user
# in case of using AwsMixin
pip3 install boto3 --user
# in case of using AwsMfaMixin
pip3 install boto3 mfa --user
Example Build
lets assume the following poject structure
my-project
| -> my-module
| | -> build.py
| | -> some-terraform.tf
| -> an-other-module
| -> target (here will the build happen)
| | -> ...
from pybuilder.core import task, init
from ddadevops import *
name = 'my-project'
MODULE = 'my-module'
PROJECT_ROOT_PATH = '..'
class MyBuild(DevopsTerraformBuild):
pass
@init
def initialize(project):
project.build_depends_on('ddadevops>=0.5.0')
account_name = 'my-aws-account-name'
account_id = 'my-aws-account-id'
stage = 'my stage i.e. dev|test|prod'
additional_vars = {'var_to_use_insied_terraform': '...'}
additional_var_files = ['variable-' + account_name + '-' + stage + '.tfvars']
config = create_devops_terraform_build_config(stage, PROJECT_ROOT_PATH,
MODULE, additional_vars,
additional_tfvar_files=additional_var_files)
build = MyBuild(project, config)
build.initialize_build_dir()
@task
def plan(project):
build = get_devops_build(project)
build.plan()
@task
def apply(project):
build = get_devops_build(project)
build.apply()
@task
def destroy(project):
build = get_devops_build(project)
build.destroy()
@task
def tf_import(project):
build = get_devops_build(project)
build.tf_import('aws_resource.choosen_name', 'the_aws_id')
Feature aws-backend
Will use a file backend.dev.live.properties where dev is the [account-name], live is the [stage].
the backend.dev.live.properties file content:
key = ".."
region = "the aws region"
profile = "the profile used for aws"
bucket = "the s3 bucket name"
kms_key_id = "the aws key id"
the build.py file content:
class MyBuild(AwsBackendPropertiesMixin, DevopsTerraformBuild):
pass
@init
def initialize(project):
project.build_depends_on('ddadevops>=0.5.0')
account_name = 'my-aws-account-name'
account_id = 'my-aws-account-id'
stage = 'my stage i.e. dev|test|prod'
additional_vars = {}
config = create_devops_terraform_build_config(stage, PROJECT_ROOT_PATH,
MODULE, additional_vars)
config = add_aws_backend_properties_mixin_config(config, account_name)
build = MyBuild(project, config)
build.initialize_build_dir()
Feature aws-mfa-assume-role
In order to use aws assume role in combination with the mfa-tool (pip install mfa):
the build.py file content:
class MyBuild(class MyBuild(AwsMfaMixin, DevopsTerraformBuild):
pass
@init
def initialize(project):
project.build_depends_on('ddadevops>=0.5.0')
account_name = 'my-aws-account-name'
account_id = 'my-aws-account-id'
stage = 'my stage i.e. dev|test|prod'
additional_vars = {}
config = create_devops_terraform_build_config(stage, PROJECT_ROOT_PATH,
MODULE, additional_vars)
config = add_aws_backend_properties_mixin_config(config, account_name)
config = add_aws_mfa_mixin_config(config, account_id, 'eu-central-1',
mfa_role='my_developer_role',
mfa_account_prefix='company-',
mfa_login_account_suffix='users_are_defined_here')
build = MyBuild(project, config)
build.initialize_build_dir()
@task
def access(project):
build = get_devops_build(project)
build.get_mfa_session()
Feature DdaDockerBuild
The docker build supports image building, tagging, testing and login to dockerhost. For bash based builds we support often used script-parts as predefined functions see install_functions.sh.
A full working example: doc/example/50_docker_module
Feature AwsRdsPgMixin
The AwsRdsPgMixin provides
- execute_pg_rds_sql - function will optionally resolve dns-c-names for trusted ssl-handshakes
- alter_db_user_password
- add_new_user
- deactivate_user
the build.py file content:
class MyBuild(..., AwsRdsPgMixin):
pass
@init
def initialize(project):
project.build_depends_on('ddadevops>=0.8.0')
...
config = add_aws_rds_pg_mixin_config(config,
stage + "-db.bcsimport.kauf." + account_name + ".breuni.de",
"kauf_bcsimport",
rds_resolve_dns=True,)
build = MyBuild(project, config)
build.initialize_build_dir()
@task
def rotate_credentials_in(project):
build = get_devops_build(project)
build.alter_db_user_password('/postgres/support')
build.alter_db_user_password('/postgres/superuser')
build.add_new_user('/postgres/superuser', '/postgres/app', 'pg_group_role')
@task
def rotate_credentials_out(project):
build = get_devops_build(project)
build.deactivate_user('/postgres/superuser', 'old_user_name')
Releasing and updating
Publish snapshot
- every push will be published as dev-dependency
Release
- git commit -am "release"
- git tag -am "release" version
- git push --follow-tags
- increase version no in build.py
- git commit -am "version bump"
- git push
- pip3 install --upgrade --user ddadevops
License
Copyright © 2019 meissa GmbH Licensed under the Apache License, Version 2.0 (the "License")
Metadata
Release files for ddadevops 0.8.11.dev20200706072608
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ddadevops-0.8.11.dev20200706072608.tar.gz | 18.8 kB | Without provenance | Details for ddadevops-0.8.11.dev20200706072608.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ddadevops-0.8.11.dev20200706072608-py3-none-any.whl | Python 3 | none | any | Details for ddadevops-0.8.11.dev20200706072608-py3-none-any.whl |
Total release size: 40.6 kB
Release files / ddadevops-0.8.11.dev20200706072608.tar.gz
| Download URL | ddadevops-0.8.11.dev20200706072608.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07acc032b391aad9760af603205b5420049b427ce46442958b67b2b0abae325a
|
|
BLAKE2b-256 checksum How to use checksums |
c7aa9bd615a8527f2429bd8931de2b0ae8439cc703d81e699401d7ace9f34269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|
Release files / ddadevops-0.8.11.dev20200706072608-py3-none-any.whl
| Download URL | ddadevops-0.8.11.dev20200706072608-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90323f7b9efbb4ab0c24d8c613118eac3954f2d147f9860a9bfe8dd083979e22
|
|
BLAKE2b-256 checksum How to use checksums |
558616e7ab53a361faf2513638e28ede934e3fd7465d9e38289a6b1904dcc3a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|
Security for ddadevops 0.8.11.dev20200706072608
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.