3. Add Actions
Step 1 — Log in to Garden Cloud
garden loginStep 2 — Add actions for deploying the database
kind: Deploy
name: db
type: helm
description: Deploy a Postgres Helm chart
spec:
chart: # <--- Tell Garden what chart to use
name: postgresql
repo: https://charts.bitnami.com/bitnami
version: "12.4.2"
values: # <--- Overwrite some of the chart values
fullnameOverride: postgres
auth:
postgresPassword: postgres
primary:
readinessProbe:
successThreshold: 3
---
kind: Run
name: db-seed
type: kubernetes-exec
dependencies: [deploy.db]
description: Execute a command to initialize the database inside the running deployment
spec:
resource: # <--- The K8s resource in which the action should be executed
kind: "StatefulSet"
name: "postgres"
command: # <--- A simple command that creates a table that our app needs
[
"bin/sh",
"-c",
"PGPASSWORD=postgres psql -w -U postgres --host=postgres --port=5432 -d postgres -c 'CREATE TABLE IF NOT EXISTS votes (id VARCHAR(255) NOT NULL UNIQUE, vote VARCHAR(255) NOT NULL, created_at timestamp default NULL)'",
]Step 3 — Add a Build action for the API
Step 4 — Add a Deploy action for the API
Step 5 — Add actions for the web service
Last updated
Was this helpful?

