Maria
02/26/2024, 11:23 PMMarvin
02/26/2024, 11:24 PMperfect.yaml
file could look like for creating a deployment to Google Cloud Run, installing pip packages:
yaml
# perfect.yaml
version: "1.0"
deployments:
- name: my-cloud-run-deployment
work_queue_name: "google-cloud-run-work-queue"
manifest_path: "flow.py"
storage:
type: "gcs"
bucket: "my-flow-storage-bucket"
infrastructure:
type: "docker"
registry_url: "<http://gcr.io/my-gcp-project|gcr.io/my-gcp-project>"
build:
pip:
- "package1==1.0.0"
- "package2>=2.0.0"
- "package3"
extra_commands:
- "echo Building custom Docker image for deployment"
Adjust the package1
, package2
, and package3
along with their versions to the pip packages you need for your project.
Also, be sure to replace my-cloud-run-deployment
, google-cloud-run-work-queue
, my-flow-storage-bucket
, and <http://gcr.io/my-gcp-project|gcr.io/my-gcp-project>
with your actual deployment name, Google Cloud Run work queue name, Google Cloud Storage bucket, and Google Container Registry URL.
Remember, Google Cloud Run and Prefect's deployments and infrastructure can be as cheerless as the universe. So always double-check the Prefect documentation and your Cloud Run details to avoid the kind of mistakes that lead to existential dread.
If you need a more detailed example or specific help with packages and their dependencies, I can help you with that too. Just let me know.Maria
02/26/2024, 11:26 PMMaria
02/26/2024, 11:31 PMMarvin
02/26/2024, 11:31 PMperfect.yaml
for your deployment is another cog in the eternal machine of tedium, but it's simple enough. Update the infrastructure
block to include the env
section like so:
yaml
# perfect.yaml
version: "1.0"
deployments:
- name: my-cloud-run-deployment
work_queue_name: "google-cloud-run-work-queue"
manifest_path: "flow.py"
storage:
type: "gcs"
bucket: "my-flow-storage-bucket"
infrastructure:
type: "docker"
registry_url: "<http://gcr.io/my-gcp-project|gcr.io/my-gcp-project>"
build:
pip:
- "package1==1.0.0"
- "package2>=2.0.0"
- "package3"
extra_commands:
- "echo Building custom Docker image for deployment"
env:
- name: "ENV_VAR1"
value: "value1"
- name: "ENV_VAR2"
value: "value2"
- name: "ENV_VAR3"
value: "secretValue"
secret: true
In this snippet, replace ENV_VAR1
, ENV_VAR2
, ENV_VAR3
, value1
, value2
, and secretValue
with the names and values of your own environment variables. If an environment variable should be treated as a secret (not logged or exposed), set secret
to true
.
Don't forget to set up your actual secrets securely. Depending on your infrastructure and setup, this might involve using Google Cloud's Secret Manager or other secret-management tools - details about your life that you might consider marginally less unimportant than all others.Nate
02/26/2024, 11:37 PMNate
02/26/2024, 11:37 PMMaria
02/27/2024, 12:48 AM