Skip to content

Commit 0f97fe8

Browse files
authored
Update cpln deployment docs (#562)
* Add daily-task to apply-template command in docs * Add docs for using CPLN_ORG env variable * Use APP_NAME env variable to simplify the commands
1 parent 3e25ed6 commit 0f97fe8

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

.controlplane/readme.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,55 +50,60 @@ These YAML files are the same as used by the `cpln apply` command.
5050
## Setup and run
5151

5252
Check if the Control Plane organization and location are correct in `.controlplane/controlplane.yml`.
53+
Alternatively, you can use `CPLN_ORG` environment variable to set the organization name.
5354
You should be able to see this information in the Control Plane UI.
5455

5556
**Note:** The below commands use `cpl` which is the Heroku to Control Plane playbook gem,
5657
and not `cpln` which is the Control Plane CLI.
5758

5859
```sh
60+
# Use environment variable to prevent repetition
61+
export APP_NAME=tutorial-app
62+
5963
# Provision all infrastructure on Control Plane.
6064
# app tutorial-app will be created per definition in .controlplane/controlplane.yml
61-
cpl apply-template gvc postgres redis rails -a tutorial-app
65+
cpl apply-template gvc postgres redis rails daily-task -a $APP_NAME
6266

6367
# Build and push docker image to Control Plane repository
6468
# Note, may take many minutes. Be patient.
6569
# Check for error messages, such as forgetting to run `cpln image docker-login --org <your-org>`
66-
cpl build-image -a tutorial-app
70+
cpl build-image -a $APP_NAME
6771

6872
# Promote image to app after running `cpl build-image command`
6973
# Note, the UX of images may not show the image for up to 5 minutes.
7074
# However, it's ready.
71-
cpl deploy-image -a tutorial-app
75+
cpl deploy-image -a $APP_NAME
7276

7377
# See how app is starting up
74-
cpl logs -a tutorial-app
78+
cpl logs -a $APP_NAME
7579

7680
# Open app in browser (once it has started up)
77-
cpl open -a tutorial-app
81+
cpl open -a $APP_NAME
7882
```
7983

8084
### Promoting code updates
8185

8286
After committing code, you will update your deployment of `tutorial-app` with the following commands:
8387

8488
```sh
89+
# Assuming you have already set APP_NAME env variable to tutorial-app
8590
# Build and push new image with sequential image tagging, e.g. 'tutorial-app:1', then 'tutorial-app:2', etc.
86-
cpl build-image -a tutorial-app
91+
cpl build-image -a $APP_NAME
8792

8893
# Run database migrations (or other release tasks) with latest image,
8994
# while app is still running on previous image.
9095
# This is analogous to the release phase.
91-
cpl runner rails db:migrate -a tutorial-app --image latest
96+
cpl runner rails db:migrate -a $APP_NAME --image latest
9297

9398
# Pomote latest image to app after migrations run
94-
cpl deploy-image -a tutorial-app
99+
cpl deploy-image -a $APP_NAME
95100
```
96101

97102
If you needed to push a new image with a specific commit SHA, you can run the following command:
98103

99104
```sh
100105
# Build and push with sequential image tagging and commit SHA, e.g. 'tutorial-app:123_ABCD'
101-
cpl build-image -a tutorial-app --commit ABCD
106+
cpl build-image -a $APP_NAME --commit ABCD
102107
```
103108

104109
## Other notes

0 commit comments

Comments
 (0)