add arch docu

This commit is contained in:
Michael Jerger 2023-03-12 16:55:15 +01:00
parent ce2e2635f5
commit 3bdc75cdca
4 changed files with 174 additions and 11 deletions

View file

@ -1,11 +0,0 @@
```mermaid
classDiagram
DevopsBuild <|-- DevopsDockerBuild
DevopsBuild <|-- DevopsTerraformBuild
DevopsBuild <|-- C4kMixin
DevopsBuild *-- BuildService
DevopsDockerBuild *-- DockerBuildService
C4kMixin *-- C4kBuildService
```

110
doc/architecture/Build.md Normal file
View file

@ -0,0 +1,110 @@
# Build Frontend
```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()
copy_local_state()
rescue_local_state()
initialize_build_dir()
post_build()
init_client()
write_output(terraform)
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()
init_client()
}
class DigitaloceanBackendPropertiesMixin {
project_vars(self)
copy_build_resources_from_package(self)
init_client(self)
}
class DevopsDockerBuild {
def initialize_build_dir()
image()
drun()
dockerhub_login()
dockerhub_publish()
test()
}
class ProvsK3sMixin {
// ProvsK3sMixin -> ProvsK3sBuild
def update_runtime_config(fqdn, ipv4, ipv6=None)
write_provs_config()
provs_apply(dry_run=False)
}
class C4kMixin {
// C4kMixin -> C4kBuild
def write_c4k_config()
def write_c4k_auth()
c4k_apply(dry_run=False)
}
DevopsBuild <|-- DevopsDockerBuild
DevopsBuild <|-- DevopsTerraformBuild
DevopsBuild <|-- AwsRdsPgMixin
DevopsTerraformBuild <|-- AwsBackendPropertiesMixin
DevopsTerraformBuild <|-- DigitaloceanTerraformBuild
DevopsTerraformBuild <|--ExoscaleMixin
DevopsTerraformBuild <|--HetznerMixin
DevopsBuild <|-- ProvsK3sMixin
DigitaloceanTerraformBuild <|-- DigitaloceanBackendPropertiesMixin
AwsBackendPropertiesMixin <|-- AwsMfaMixin
DevopsBuild <|-- C4kMixin
```
# Build Frontend with application and domain
```mermaid
classDiagram
DevopsBuild <|-- DevopsDockerBuild
DevopsBuild <|-- DevopsTerraformBuild
DevopsBuild <|-- C4kMixin
DevopsBuild *-- BuildService
DevopsDockerBuild *-- DockerBuildService
C4kMixin *-- C4kBuildService
```
# Domain

View file

@ -0,0 +1,54 @@
# Build Frontend with application and domain
```mermaid
classDiagram
class DevopsBuild {
__init__(project, config)
do_sth(project)
}
class ProjectRepository {
get_build(project): Build
set_build(project, build)
}
class Build
class BuildService {
do_sth(project, build)
}
DevopsBuild *-- BuildService
BuildService *-- ProjectRepository
DevopsBuild *-- ProjectRepository
```
In case of simple operations we will not need the BuildService in between.
## Init Sequence
```mermaid
sequenceDiagram
MyBuild ->> DevOpsBuild: create_config
MyBuild ->> DevOpsBuild: __init__(project, config)
activate DevOpsBuild
DevOpsBuild ->> Build: __init__
DevOpsBuild ->> ProjectRepository: set_build(build)
deactivate DevOpsBuild
```
## do_sth Sequence
```mermaid
sequenceDiagram
MyBuild ->> DevOpsBuild: do_sth(project)
activate DevOpsBuild
DevOpsBuild ->> BuildService: do_sth(project)
activate BuildService
BuildService ->> ProjectRepository: get_build
BuildService ->> BuildService: do_some_complicated_stuff(build)
deactivate BuildService
deactivate DevOpsBuild
```

View file

@ -0,0 +1,10 @@
# Domain
```mermaid
classDiagram
class Build {
__init__(project, config)
do_sth(project)
}
```