Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create reusable deployment scripts #264

Open
5 tasks
troyraen opened this issue Mar 11, 2025 · 0 comments
Open
5 tasks

Create reusable deployment scripts #264

troyraen opened this issue Mar 11, 2025 · 0 comments

Comments

@troyraen
Copy link
Collaborator

troyraen commented Mar 11, 2025

This is "Future work" that could follow #256.

Directory structure

Could look something like this:

broker/
├── deploy/
│   ├── configs-template.yaml       # env.yaml becomes this.
│   ├                               #   Modules will use it to define all resources and their
│   ├                               #   they rely on, including all required configurations.
│   ├── deploy.sh                   # Current classify_snn/deploy.sh generalizes to this.
│   ├                               #   Should be able to accept any cloud run module's configs.yaml as input.
│   ├── cloudbuild.cloud-run.yaml   # Every cloud run module will use this.
│   ├── cloudbuild.consumer.yaml    # For example.
│   ├── _create-ancillaries.sh       # Called by deploy.sh.
│   ├                               #   Should be able to iterate over entries found in
│   ├                               #   configs.yaml of a given type (eg, pubsub topic)
│   ├                               #   and create or delete them, agnostic to the details.
│   ├── _construct_name.sh          # Called by deploy.sh and others.
├── cloud_run/lsst/classify_snn/
│   ├── configs.yaml                # Define all needed resources with their configs.
│   └── main.py ... etc.
├── cloud_run/lsst/ps_to_storage/
│   ├── configs.yaml                # Define all needed resources with their configs.
│   └── main.py ... etc.
# ... etc...

Steps

All of these are 'classify_snn/' --> 'deploy/':

  • Move 'construct_name.sh' --> '_construct_name.sh'.
  • Convert 'env.yaml' --> 'configs-template.yaml'.
  • Convert 'deploy.sh' --> 'deploy.sh'.
  • Convert 'cloudbuild.yaml' --> 'cloudbuild.cloud-run.yaml'.
  • Generalize 'create-ancillaries.sh' --> '/_create-ancillaries.sh'.

How this could be used with Terraform

Terraform can take the 'cloudbuild*.yaml' files and execute them. To do that, we'll need to write a Terraform script that will replace 'deploy.sh'. I gave 'deploy.sh' to Google Gemini and asked it to convert it to a Terraform script and it gave me what looked like a reasonable start. See also, #152. (If/when anyone's ready to actually implement Terraform, you can either use that PR directly or else close it and open your own.)

Similar to our current setup, an individual module could then be deployed by "applying" its Terraform script. We could also write a "main.tf" Terraform script that could be used to deploy all modules at once. Terraform could then be used in combination with, e.g., GitHub Actions to create automatic deployments for both test and production purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant