@@ -50,55 +50,60 @@ These YAML files are the same as used by the `cpln apply` command.
50
50
## Setup and run
51
51
52
52
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.
53
54
You should be able to see this information in the Control Plane UI.
54
55
55
56
** Note:** The below commands use ` cpl ` which is the Heroku to Control Plane playbook gem,
56
57
and not ` cpln ` which is the Control Plane CLI.
57
58
58
59
``` sh
60
+ # Use environment variable to prevent repetition
61
+ export APP_NAME=tutorial-app
62
+
59
63
# Provision all infrastructure on Control Plane.
60
64
# 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
62
66
63
67
# Build and push docker image to Control Plane repository
64
68
# Note, may take many minutes. Be patient.
65
69
# 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
67
71
68
72
# Promote image to app after running `cpl build-image command`
69
73
# Note, the UX of images may not show the image for up to 5 minutes.
70
74
# However, it's ready.
71
- cpl deploy-image -a tutorial-app
75
+ cpl deploy-image -a $APP_NAME
72
76
73
77
# See how app is starting up
74
- cpl logs -a tutorial-app
78
+ cpl logs -a $APP_NAME
75
79
76
80
# Open app in browser (once it has started up)
77
- cpl open -a tutorial-app
81
+ cpl open -a $APP_NAME
78
82
```
79
83
80
84
### Promoting code updates
81
85
82
86
After committing code, you will update your deployment of ` tutorial-app ` with the following commands:
83
87
84
88
``` sh
89
+ # Assuming you have already set APP_NAME env variable to tutorial-app
85
90
# 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
87
92
88
93
# Run database migrations (or other release tasks) with latest image,
89
94
# while app is still running on previous image.
90
95
# 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
92
97
93
98
# Pomote latest image to app after migrations run
94
- cpl deploy-image -a tutorial-app
99
+ cpl deploy-image -a $APP_NAME
95
100
```
96
101
97
102
If you needed to push a new image with a specific commit SHA, you can run the following command:
98
103
99
104
``` sh
100
105
# 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
102
107
```
103
108
104
109
## Other notes
0 commit comments