Skip to content

Commit 678592c

Browse files
authored
Document cpflow app bootstrap (#748)
1 parent 77eae2b commit 678592c

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

.controlplane/readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ The matching Control Plane resources are:
5757
| Staging app | `react-webpack-rails-tutorial-staging` |
5858
| Staging app secret dictionary | `react-webpack-rails-tutorial-staging-secrets` |
5959

60+
Bootstrap the persistent staging app once before the first merge-to-master
61+
deploy:
62+
63+
```sh
64+
cpflow setup-app -a react-webpack-rails-tutorial-staging --org shakacode-open-source-examples-staging --skip-post-creation-hook
65+
```
66+
67+
`setup-app` reads `setup_app_templates` from `.controlplane/controlplane.yml`
68+
and creates the app identity, app secret dictionary, app secret policy, policy
69+
binding, and template resources. Use `--skip-post-creation-hook` so first-time
70+
bootstrap does not try to run database setup before a Docker image exists. For
71+
later template updates on an existing persistent app, use
72+
`cpflow apply-template` and make sure the app identity still has `reveal`
73+
permission on the app secret policy.
74+
6075
### Production Promotion
6176

6277
Production promotion is part of the default demo flow, but the production token
@@ -81,6 +96,9 @@ The matching Control Plane resources are:
8196
| Production app | `react-webpack-rails-tutorial-production` |
8297
| Production app secret dictionary | `react-webpack-rails-tutorial-production-secrets` |
8398

99+
Bootstrap production the same way before the first promotion, using the
100+
production org and production-only secret values.
101+
84102
All review, staging, and production secret dictionaries need these app runtime
85103
secrets:
86104

.controlplane/shakacode-team.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ Generated caller workflows pass only the named secrets each upstream workflow
6363
needs. They do not use `secrets: inherit`; `CPLN_TOKEN_PRODUCTION` is supplied
6464
only by the protected `production` Environment after approval.
6565

66+
Persistent staging and production apps must be bootstrapped once before the
67+
first deploy or promotion:
68+
69+
```sh
70+
cpflow setup-app -a react-webpack-rails-tutorial-staging --org shakacode-open-source-examples-staging --skip-post-creation-hook
71+
cpflow setup-app -a react-webpack-rails-tutorial-production --org shakacode-open-source-examples-production --skip-post-creation-hook
72+
```
73+
74+
Use `setup-app` for first-time bootstrap because it creates the app secret
75+
policy and identity binding. Use `cpflow apply-template` for later template
76+
updates to existing persistent apps.
77+
6678
Advanced optional settings are documented upstream in the
6779
[`control-plane-flow` CI automation guide](https://github.com/shakacode/control-plane-flow/blob/main/docs/ci-automation.md).
6880

.github/cpflow-help.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ Optional overrides exist for forks, clones, and unusual apps:
3939
## Staging And Production
4040

4141
Staging deploys use the same `CPLN_TOKEN_STAGING` secret plus `STAGING_APP_NAME`.
42+
Before the first staging deploy, bootstrap the persistent staging app once:
43+
44+
```sh
45+
cpflow setup-app -a "$STAGING_APP_NAME" --org "$CPLN_ORG_STAGING" --skip-post-creation-hook
46+
```
47+
48+
`setup-app` creates the app identity, app secret dictionary, app secret policy,
49+
policy binding, and template resources. For later template updates on an
50+
existing persistent app, use `cpflow apply-template` and make sure the app
51+
identity has `reveal` permission on the app secret policy.
4252

4353
Production promotion is part of the generated flow, but keep it protected:
4454

@@ -53,6 +63,9 @@ prevent self-review. The generated promotion wrapper passes only the staging
5363
token from repository secrets; GitHub injects `CPLN_TOKEN_PRODUCTION` only after
5464
the environment approval gate passes.
5565

66+
Before the first promotion, bootstrap the production app the same way in the
67+
production org, using production-only secrets and values.
68+
5669
## Version Locking
5770

5871
Generated wrappers pin Control Plane Flow once with the reusable workflow

0 commit comments

Comments
 (0)