make#

Script to deploy three CDK apps needed to form the backend.

The 3 stacks have very particular inputs and outputs that must be orchestrated.




Functions#

deploy_cdk_app

Run cdk deploy on a CDK app.

diff_cdk_app

Run cdk diff on a CDK app.

log_subprocess_output

Log the output of a subprocess real-time as it executes.

main

Deploy each of the three apps needed for the rootski database.

run_cdk_command

Run cdk diff|deploy|destroy.

run_shell_cmd

Execute a bash command as a subprocess.

deploy_cdk_app()#

rootski_backend_cdk.database.make.deploy_cdk_app(app_py_fpath: pathlib.Path, stack_names: List[str], context_vars: Optional[Dict[str, str]] = None, region: str = 'us-west-2')[source]#

Run cdk deploy on a CDK app.

Parameters
  • app_py_fpath – location of app.py for the CDK app to act on

  • context_vars – key-value pairs that are used with note.try_get_context(key) calls

  • stack_names – list of stack names registered in app.py::app to deploy

  • region – AWS region to deploy the stacks to

Raises

Exception – if the exit status is non-zero

diff_cdk_app()#

rootski_backend_cdk.database.make.diff_cdk_app(app_py_fpath: pathlib.Path, stack_names: List[str], context_vars: Optional[Dict[str, str]] = None, region: str = 'us-west-2')[source]#

Run cdk diff on a CDK app.

Parameters
  • app_py_fpath – location of app.py for the CDK app to act on

  • context_vars – key-value pairs that are used with note.try_get_context(key) calls

  • stack_names – list of stack names registered in app.py::app to deploy

  • region – AWS region to deploy the stacks to

log_subprocess_output()#

rootski_backend_cdk.database.make.log_subprocess_output(pipe)[source]#

Log the output of a subprocess real-time as it executes.

Parameters

pipe – a subprocess output pipe.

main()#

rootski_backend_cdk.database.make.main()[source]#

Deploy each of the three apps needed for the rootski database.

run_cdk_command()#

rootski_backend_cdk.database.make.run_cdk_command(cdk_cmd: Literal['diff', 'deploy', 'destroy'], app_py_fpath: pathlib.Path, context_vars: Dict[str, str], stack_names: Optional[List[str]] = None, region: str = 'us-west-2') int[source]#

Run cdk diff|deploy|destroy.

Parameters
  • cdk_cmd – subcommand of the AWS cdk command to run

  • app_py_fpath – location of app.py for the CDK app to act on

  • context_vars – key-value pairs that are used with note.try_get_context(key) calls

  • stack_names – list of stack names registered in app.py::app to deploy

  • region – AWS region to deploy the stacks to

Returns

exit status code of the cdk <subcommand>

run_shell_cmd()#

rootski_backend_cdk.database.make.run_shell_cmd(cmd: List[str]) int[source]#

Execute a bash command as a subprocess.

Parameters

cmd – Command as a list of arguments

Returns

exit status code of the command




Classes#

Config

Constant values used during the deployment process.

DbBucketStackOutputs

Output keys for the database-backups-bucket stack.

IamUserStackOutputs

Utility class to fetch outputs from an IamUserStack.

LightsailInstanceStackOutputs

Utility class to fetch outputs from a LightsailInstanceStack.

class Config#

class rootski_backend_cdk.database.make.Config[source]#

Bases: object

Constant values used during the deployment process.

class DbBucketStackOutputs#

class rootski_backend_cdk.database.make.DbBucketStackOutputs(rootski_db_backups_s3_bucket_name: str, rootski_db_backups_s3_bucket_arn: str)[source]#

Bases: object

Output keys for the database-backups-bucket stack.

classmethod from_cloudformation(region: str)[source]#

Fetch outputs from the database backups stack in the region.

Parameters

region – see the one-line description.

class IamUserStackOutputs#

class rootski_backend_cdk.database.make.IamUserStackOutputs(rootski_iam_user_secret_key_id: str, rootski_iam_user_secret_key: str)[source]#

Bases: object

Utility class to fetch outputs from an IamUserStack.

classmethod from_cloudformation(region: str = 'us-west-2')[source]#

Retrieve outputs for the deployed IamUserStack in the given region.

Parameters

region – See one-line summary.

class LightsailInstanceStackOutputs#

class rootski_backend_cdk.database.make.LightsailInstanceStackOutputs(static_ip: str, ssh_key_pair_name: str, lightsail_admin_username: str)[source]#

Bases: object

Utility class to fetch outputs from a LightsailInstanceStack.

classmethod from_cloudformation(region: str = 'us-west-2')[source]#

Fetch stack values from the stack deployed in the given region.

Parameters

region – See one-line summary