dbt-platform-helper 11.0.1__py3-none-any.whl → 11.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbt-platform-helper might be problematic. Click here for more details.
- dbt_platform_helper/COMMANDS.md +83 -20
- dbt_platform_helper/commands/database.py +97 -18
- dbt_platform_helper/commands/environment.py +6 -518
- dbt_platform_helper/commands/pipeline.py +103 -12
- dbt_platform_helper/domain/__init__.py +0 -0
- dbt_platform_helper/domain/database_copy.py +220 -0
- dbt_platform_helper/domain/maintenance_page.py +459 -0
- dbt_platform_helper/providers/load_balancers.py +51 -0
- dbt_platform_helper/templates/environment-pipelines/main.tf +52 -0
- dbt_platform_helper/utils/aws.py +47 -37
- dbt_platform_helper/utils/validation.py +29 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.2.0.dist-info}/METADATA +2 -1
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.2.0.dist-info}/RECORD +16 -12
- dbt_platform_helper/commands/database_helpers.py +0 -145
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.2.0.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.2.0.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.2.0.dist-info}/entry_points.txt +0 -0
dbt_platform_helper/COMMANDS.md
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
- [platform-helper database](#platform-helper-database)
|
|
43
43
|
- [platform-helper database dump](#platform-helper-database-dump)
|
|
44
44
|
- [platform-helper database load](#platform-helper-database-load)
|
|
45
|
+
- [platform-helper database copy](#platform-helper-database-copy)
|
|
45
46
|
- [platform-helper version](#platform-helper-version)
|
|
46
47
|
- [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
|
|
47
48
|
|
|
@@ -792,14 +793,36 @@ platform-helper pipeline generate
|
|
|
792
793
|
Given a platform-config.yml file, generate environment and service
|
|
793
794
|
deployment pipelines.
|
|
794
795
|
|
|
796
|
+
This command does the following in relation to the environment pipelines:
|
|
797
|
+
- Reads contents of `platform-config.yml/environment-pipelines` configuration.
|
|
798
|
+
The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
|
|
799
|
+
The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
|
|
800
|
+
|
|
801
|
+
This command does the following in relation to the codebase pipelines:
|
|
802
|
+
- Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
|
|
803
|
+
|
|
804
|
+
(Deprecated) This command does the following for non terraform projects (legacy AWS Copilot):
|
|
805
|
+
- Generates the copilot manifest.yml for copilot/environments/<environment>
|
|
806
|
+
|
|
795
807
|
## Usage
|
|
796
808
|
|
|
797
809
|
```
|
|
798
|
-
platform-helper pipeline generate
|
|
810
|
+
platform-helper pipeline generate [--terraform-platform-modules-version <terraform_platform_modules_version>]
|
|
811
|
+
[--deploy-branch <deploy_branch>]
|
|
799
812
|
```
|
|
800
813
|
|
|
801
814
|
## Options
|
|
802
815
|
|
|
816
|
+
- `--terraform-platform-modules-version <text>`
|
|
817
|
+
- Override the default version of terraform-platform-modules with a specific version or branch.
|
|
818
|
+
Precedence of version used is version supplied via CLI, then the version found in
|
|
819
|
+
platform-config.yml/default_versions/terraform-platform-modules.
|
|
820
|
+
In absence of these inputs, defaults to version '5'.
|
|
821
|
+
- `--deploy-branch <text>`
|
|
822
|
+
- Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
|
|
823
|
+
This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
|
|
824
|
+
(Default <application>-deploy branch is specified in
|
|
825
|
+
<application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).
|
|
803
826
|
- `--help <boolean>` _Defaults to False._
|
|
804
827
|
- Show this message and exit.
|
|
805
828
|
|
|
@@ -962,10 +985,12 @@ platform-helper notify add-comment <slack_channel_id> <slack_token>
|
|
|
962
985
|
|
|
963
986
|
[↩ Parent](#platform-helper)
|
|
964
987
|
|
|
988
|
+
Commands to copy data between databases.
|
|
989
|
+
|
|
965
990
|
## Usage
|
|
966
991
|
|
|
967
992
|
```
|
|
968
|
-
platform-helper database (dump|load)
|
|
993
|
+
platform-helper database (dump|load|copy)
|
|
969
994
|
```
|
|
970
995
|
|
|
971
996
|
## Options
|
|
@@ -975,6 +1000,7 @@ platform-helper database (dump|load)
|
|
|
975
1000
|
|
|
976
1001
|
## Commands
|
|
977
1002
|
|
|
1003
|
+
- [`copy` ↪](#platform-helper-database-copy)
|
|
978
1004
|
- [`dump` ↪](#platform-helper-database-dump)
|
|
979
1005
|
- [`load` ↪](#platform-helper-database-load)
|
|
980
1006
|
|
|
@@ -987,23 +1013,20 @@ platform-helper database (dump|load)
|
|
|
987
1013
|
## Usage
|
|
988
1014
|
|
|
989
1015
|
```
|
|
990
|
-
platform-helper database dump --
|
|
991
|
-
--
|
|
992
|
-
--vpc-name <vpc_name>
|
|
1016
|
+
platform-helper database dump --from <from_env> --database <database>
|
|
1017
|
+
[--app <application>] [--from-vpc <from_vpc>]
|
|
993
1018
|
```
|
|
994
1019
|
|
|
995
1020
|
## Options
|
|
996
1021
|
|
|
997
|
-
- `--account-id <text>`
|
|
998
|
-
|
|
999
1022
|
- `--app <text>`
|
|
1000
|
-
|
|
1001
|
-
- `--
|
|
1002
|
-
|
|
1023
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1024
|
+
- `--from <text>`
|
|
1025
|
+
- The environment you are dumping data from
|
|
1003
1026
|
- `--database <text>`
|
|
1004
|
-
|
|
1005
|
-
- `--vpc
|
|
1006
|
-
|
|
1027
|
+
- The name of the database you are dumping data from
|
|
1028
|
+
- `--from-vpc <text>`
|
|
1029
|
+
- The vpc the specified environment is running in. Required unless you are running the command from your deploy repo
|
|
1007
1030
|
- `--help <boolean>` _Defaults to False._
|
|
1008
1031
|
- Show this message and exit.
|
|
1009
1032
|
|
|
@@ -1016,22 +1039,62 @@ platform-helper database dump --account-id <account_id> --app <application>
|
|
|
1016
1039
|
## Usage
|
|
1017
1040
|
|
|
1018
1041
|
```
|
|
1019
|
-
platform-helper database load --
|
|
1020
|
-
--
|
|
1021
|
-
--
|
|
1042
|
+
platform-helper database load --to <to_env> --database <database>
|
|
1043
|
+
[--app <application>] [--to-vpc <to_vpc>]
|
|
1044
|
+
[--auto-approve]
|
|
1022
1045
|
```
|
|
1023
1046
|
|
|
1024
1047
|
## Options
|
|
1025
1048
|
|
|
1026
|
-
- `--account-id <text>`
|
|
1027
|
-
|
|
1028
1049
|
- `--app <text>`
|
|
1050
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1051
|
+
- `--to <text>`
|
|
1052
|
+
- The environment you are loading data into
|
|
1053
|
+
- `--database <text>`
|
|
1054
|
+
- The name of the database you are loading data into
|
|
1055
|
+
- `--to-vpc <text>`
|
|
1056
|
+
- The vpc the specified environment is running in. Required unless you are running the command from your deploy repo
|
|
1057
|
+
- `--auto-approve <boolean>` _Defaults to False._
|
|
1029
1058
|
|
|
1030
|
-
- `--
|
|
1059
|
+
- `--help <boolean>` _Defaults to False._
|
|
1060
|
+
- Show this message and exit.
|
|
1031
1061
|
|
|
1062
|
+
# platform-helper database copy
|
|
1063
|
+
|
|
1064
|
+
[↩ Parent](#platform-helper-database)
|
|
1065
|
+
|
|
1066
|
+
Copy a database between environments.
|
|
1067
|
+
|
|
1068
|
+
## Usage
|
|
1069
|
+
|
|
1070
|
+
```
|
|
1071
|
+
platform-helper database copy --from <from_env> --to <to_env> --database <database>
|
|
1072
|
+
--svc <service> [--app <application>] [--from-vpc <from_vpc>]
|
|
1073
|
+
[--to-vpc <to_vpc>] [--template (default|migration|dmas-migration)]
|
|
1074
|
+
[--auto-approve] [--no-maintenance-page]
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
## Options
|
|
1078
|
+
|
|
1079
|
+
- `--app <text>`
|
|
1080
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1081
|
+
- `--from <text>`
|
|
1082
|
+
- The environment you are copying data from
|
|
1083
|
+
- `--to <text>`
|
|
1084
|
+
- The environment you are copying data into
|
|
1032
1085
|
- `--database <text>`
|
|
1086
|
+
- The name of the database you are copying
|
|
1087
|
+
- `--from-vpc <text>`
|
|
1088
|
+
- The vpc the environment you are copying from is running in. Required unless you are running the command from your deploy repo
|
|
1089
|
+
- `--to-vpc <text>`
|
|
1090
|
+
- The vpc the environment you are copying into is running in. Required unless you are running the command from your deploy repo
|
|
1091
|
+
- `--auto-approve <boolean>` _Defaults to False._
|
|
1033
1092
|
|
|
1034
|
-
- `--
|
|
1093
|
+
- `--svc <text>` _Defaults to ['web']._
|
|
1094
|
+
|
|
1095
|
+
- `--template <choice>` _Defaults to default._
|
|
1096
|
+
- The maintenance page you wish to put up.
|
|
1097
|
+
- `--no-maintenance-page <boolean>` _Defaults to False._
|
|
1035
1098
|
|
|
1036
1099
|
- `--help <boolean>` _Defaults to False._
|
|
1037
1100
|
- Show this message and exit.
|
|
@@ -1,33 +1,112 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from dbt_platform_helper.commands.
|
|
3
|
+
from dbt_platform_helper.commands.environment import AVAILABLE_TEMPLATES
|
|
4
|
+
from dbt_platform_helper.domain.database_copy import DatabaseCopy
|
|
4
5
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
@click.group(chain=True, cls=ClickDocOptGroup)
|
|
8
9
|
def database():
|
|
9
|
-
|
|
10
|
+
"""Commands to copy data between databases."""
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@database.command(name="dump")
|
|
13
|
-
@click.option(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
@click.option(
|
|
15
|
+
"--app",
|
|
16
|
+
type=str,
|
|
17
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
18
|
+
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--from",
|
|
21
|
+
"from_env",
|
|
22
|
+
type=str,
|
|
23
|
+
required=True,
|
|
24
|
+
help="The environment you are dumping data from",
|
|
25
|
+
)
|
|
26
|
+
@click.option(
|
|
27
|
+
"--database", type=str, required=True, help="The name of the database you are dumping data from"
|
|
28
|
+
)
|
|
29
|
+
@click.option(
|
|
30
|
+
"--from-vpc",
|
|
31
|
+
type=str,
|
|
32
|
+
help="The vpc the specified environment is running in. Required unless you are running the command from your deploy repo",
|
|
33
|
+
)
|
|
34
|
+
def dump(app, from_env, database, from_vpc):
|
|
19
35
|
"""Dump a database into an S3 bucket."""
|
|
20
|
-
data_copy = DatabaseCopy(
|
|
21
|
-
data_copy.dump()
|
|
36
|
+
data_copy = DatabaseCopy(app, database)
|
|
37
|
+
data_copy.dump(from_env, from_vpc)
|
|
22
38
|
|
|
23
39
|
|
|
24
40
|
@database.command(name="load")
|
|
25
|
-
@click.option(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
@click.option(
|
|
42
|
+
"--app",
|
|
43
|
+
type=str,
|
|
44
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
45
|
+
)
|
|
46
|
+
@click.option(
|
|
47
|
+
"--to", "to_env", type=str, required=True, help="The environment you are loading data into"
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--database", type=str, required=True, help="The name of the database you are loading data into"
|
|
51
|
+
)
|
|
52
|
+
@click.option(
|
|
53
|
+
"--to-vpc",
|
|
54
|
+
type=str,
|
|
55
|
+
help="The vpc the specified environment is running in. Required unless you are running the command from your deploy repo",
|
|
56
|
+
)
|
|
57
|
+
@click.option("--auto-approve/--no-auto-approve", default=False)
|
|
58
|
+
def load(app, to_env, database, to_vpc, auto_approve):
|
|
31
59
|
"""Load a database from an S3 bucket."""
|
|
32
|
-
data_copy = DatabaseCopy(
|
|
33
|
-
data_copy.load()
|
|
60
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
61
|
+
data_copy.load(to_env, to_vpc)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@database.command(name="copy")
|
|
65
|
+
@click.option(
|
|
66
|
+
"--app",
|
|
67
|
+
type=str,
|
|
68
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
69
|
+
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--from", "from_env", type=str, required=True, help="The environment you are copying data from"
|
|
72
|
+
)
|
|
73
|
+
@click.option(
|
|
74
|
+
"--to", "to_env", type=str, required=True, help="The environment you are copying data into"
|
|
75
|
+
)
|
|
76
|
+
@click.option(
|
|
77
|
+
"--database", type=str, required=True, help="The name of the database you are copying"
|
|
78
|
+
)
|
|
79
|
+
@click.option(
|
|
80
|
+
"--from-vpc",
|
|
81
|
+
type=str,
|
|
82
|
+
help="The vpc the environment you are copying from is running in. Required unless you are running the command from your deploy repo",
|
|
83
|
+
)
|
|
84
|
+
@click.option(
|
|
85
|
+
"--to-vpc",
|
|
86
|
+
type=str,
|
|
87
|
+
help="The vpc the environment you are copying into is running in. Required unless you are running the command from your deploy repo",
|
|
88
|
+
)
|
|
89
|
+
@click.option("--auto-approve/--no-auto-approve", default=False)
|
|
90
|
+
@click.option("--svc", type=str, required=True, multiple=True, default=["web"])
|
|
91
|
+
@click.option(
|
|
92
|
+
"--template",
|
|
93
|
+
type=click.Choice(AVAILABLE_TEMPLATES),
|
|
94
|
+
default="default",
|
|
95
|
+
help="The maintenance page you wish to put up.",
|
|
96
|
+
)
|
|
97
|
+
@click.option("--no-maintenance-page", flag_value=True)
|
|
98
|
+
def copy(
|
|
99
|
+
app,
|
|
100
|
+
from_env,
|
|
101
|
+
to_env,
|
|
102
|
+
database,
|
|
103
|
+
from_vpc,
|
|
104
|
+
to_vpc,
|
|
105
|
+
auto_approve,
|
|
106
|
+
svc,
|
|
107
|
+
template,
|
|
108
|
+
no_maintenance_page,
|
|
109
|
+
):
|
|
110
|
+
"""Copy a database between environments."""
|
|
111
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
112
|
+
data_copy.copy(from_env, to_env, from_vpc, to_vpc, svc, template, no_maintenance_page)
|