Skip to content

Commit 1445e21

Browse files
committed
Doc Updates
1 parent 281cf10 commit 1445e21

File tree

4 files changed

+69
-24
lines changed

4 files changed

+69
-24
lines changed

.controlplane/controlplane.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ aliases:
33
common: &common
44
# Change this to your org name for staging. Production apps will use a different org
55
# for security.
6-
org: shakacode-staging
6+
cpln_org: shakacode-demo
77
# Change `shakacode-staging` to your-org-name-for-staging
88
# Example apps use only location. CPLN offers the ability to use multiple locations.
9-
location: aws-us-east-2
9+
default_location: aws-us-east-2
1010
# Configure the workload name used as a template for one-off scripts, like a Heroku one-off dyno.
1111
one_off_workload: rails
1212
# Like the entries in the Heroku Procfile that get deployed when the application code changes
@@ -19,10 +19,13 @@ aliases:
1919
- postgres
2020

2121
apps:
22-
ror-tutorial:
23-
<<: *common
2422
react-webpack-rails-tutorial:
2523
<<: *common
26-
ror-tutorial-review:
24+
tutorial-app:
25+
<<: *common
26+
# QA Apps are like Heroku review apps, but the use `prefix` so you can run a commmand like
27+
# this to create a QA app for the tutorial app.
28+
# `cpl setup gvc postgres redis rails -a qa-tutorial-app-pr-1234`
29+
qa-tutorial-app:
2730
<<: *common
2831
prefix: true

.controlplane/readme.md

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,78 @@
11
# Deploying tutorial app on Control Plane
22

3+
## Overview
4+
This simple example shows how to deploy a simple app on Control Plane using the `cpl` gem.
5+
6+
To maximize simplicity, this example creates Postgres and Redis as workloads in the same GVC as the app.
7+
In a real app, you would likely use persistent, external resources, such as AWS RDS and AWS ElastiCache.
8+
9+
You can see the definition of Postgres and Redis in the `.controlplane/templates` directory.
10+
311
## Prerequisites
412

5-
1. Should have [Control Plane](https://controlplane.com) account set up.
13+
1. Ensure your [Control Plane](https://controlplane.com) account is set up.
14+
15+
2. Set up an `organization` for testing in that account and modify `aliases.common.cpln_org` in `.controlplane/controlplane.yml` .
16+
17+
3. Install Control Plane CLI (and configure access) [docs here](https://docs.controlplane.com/quickstart/quick-start-3-cli#getting-started-with-the-cli). You can update the `cpln` command line with the same command as installation, `npm install -g @controlplane/cli`. Then run `cpln login` to ensure access.
18+
19+
4. Install [Heroku to Control Plane](https://github.com/shakacode/heroku-to-control-plane) playbook CLI [`cpl` gem](https://rubygems.org/gems/cpl) on your project's Gemfile or globally.
620

7-
2. Set up `organization` for testing in that account and modify org `.controlplane/controlplane.yml` .
21+
5. This project has a `Dockerfile` for Control Plane in this directory. You can use it as an example for your project. Ensure that you have Docker running.
822

9-
3. Install Control Plane CLI (and configure access) [docs here](https://docs.controlplane.com/quickstart/quick-start-3-cli#getting-started-with-the-cli).
23+
## Tips
24+
Do not confuse the `cpl` CLI with the `cpln` CLI. The `cpl` CLI is the Heroku to Control Plane playbook CLI. The `cpln` CLI is the Control Plane CLI.
1025

11-
4. Install Heroku to Control Plane playbook from https://github.com/shakacode/heroku-to-control-plane.
26+
## Project Configuration
27+
See the filese in the `./controlplane` directory.
1228

13-
5. This project has a `Dockerfile` for Control Plane in this directory. You can use it as an example for your project.
29+
1. `/templates`: defines the objects created with the `cpl setup` command.
30+
2. `/controlplane.yml`: defines the organization, location, and app name.
31+
3. `Dockerfile`: defines the Docker image used to run the app on Control Plane.
32+
4. `entrypoint.sh`: defines the entrypoint script used to run the app on Control Plane.
1433

1534
## Setup and run
1635

17-
Check if the organization and location are correct in `.controlplane/controlplane.yml`.
36+
Check if the Control Plane organization and location are correct in `.controlplane/controlplane.yml`. You should be able to see this information in the Control Plane UI.
1837

1938
```sh
2039
# Note, below commands use `cpl` which is the Heroku to Control Plane playbook script.
2140

22-
# Provision all infrastructure on Control Plane. It will use templates from .controlplane/templates folder.
23-
cpl setup gvc postgres redis rails -a ror-tutorial
41+
# Provision all infrastructure on Control Plane.
42+
# app tutorial-app will be created per definition in .controlplane/controlplane.yml
43+
cpl setup gvc postgres redis rails -a tutorial-app
2444

2545
# Build and push docker image to Control Plane repository
2646
# Note, may take many minutes. Be patient.
27-
cpl build -a ror-tutorial
47+
cpl build-image -a tutorial-app
2848

29-
# Promote image to app after running `cpl build command`
30-
cpl promote -a ror-tutorial
49+
# Promote image to app after running `cpl build-image command`
50+
cpl promote-image -a tutorial-app
3151

3252
# See how app is starting up
33-
cpl logs -a ror-tutorial
53+
cpl logs -a tutorial-app
3454

3555
# Open app in browser (once it has started up)
36-
cpl open -a ror-tutorial
56+
cpl open -a tutorial-app
3757
```
3858

3959
## Promoting code upgrades
4060

4161
```sh
4262
# Build and push new image with sequential image tagging, e.g. 'ror-tutorial_123'
43-
cpl build -a ror-tutorial
63+
cpl build-image -a tutorial-app
4464

4565
# OR
4666
# Build and push with sequential image tagging and commit SHA, e.g. 'ror-tutorial_123_ABCD'
47-
cpl build -a ror-tutorial --commit ABCD
67+
cpl build-image -a tutorial-app --commit ABCD
4868

4969
# Run database migrations (or other release tasks) with latest image,
5070
# while app is still running on previous image.
5171
# This is analogous to the release phase.
52-
cpl runner rails db:migrate -a ror-tutorial --image latest
72+
cpl runner rails db:migrate -a tutorial-app --image latest
5373

5474
# Pomote latest image to app
55-
promote -a ror-tutorial
75+
cpl promote-image -a tutorial-app
5676
```
5777

5878
## Other notes

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ ruby "3.1.2"
88
gem "react_on_rails", "13.2.0"
99
gem "shakapacker", "6.5.5"
1010

11+
gem "cpl"
12+
1113
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
1214
gem "listen"
1315
gem "rails", "~> 7.0"

Gemfile.lock

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ GEM
8989
capybara-screenshot (1.0.26)
9090
capybara (>= 1.0, < 4)
9191
launchy
92+
cgi (0.3.6)
9293
code_analyzer (0.5.5)
9394
sexp_processor
9495
coderay (1.1.3)
@@ -106,6 +107,17 @@ GEM
106107
term-ansicolor (~> 1.6)
107108
thor (>= 0.20.3, < 2.0)
108109
tins (~> 1.16)
110+
cpl (0.1.0)
111+
cgi (~> 0.3.6)
112+
debug (~> 1.7.1)
113+
dotenv (~> 2.8.1)
114+
json (~> 2.6.3)
115+
net-http (~> 0.3.2)
116+
pathname (~> 0.2.1)
117+
psych (~> 5.1.0)
118+
tempfile (~> 0.1.3)
119+
thor (~> 1.2.1)
120+
yaml (~> 0.2.1)
109121
crass (1.0.6)
110122
database_cleaner (2.0.1)
111123
database_cleaner-active_record (~> 2.0.0)
@@ -120,6 +132,7 @@ GEM
120132
debug_inspector (1.1.0)
121133
diff-lcs (1.5.0)
122134
docile (1.4.0)
135+
dotenv (2.8.1)
123136
erubi (1.12.0)
124137
erubis (2.7.0)
125138
execjs (2.8.1)
@@ -164,6 +177,8 @@ GEM
164177
mini_mime (1.1.2)
165178
mini_portile2 (2.8.1)
166179
minitest (5.17.0)
180+
net-http (0.3.2)
181+
uri
167182
net-imap (0.3.4)
168183
date
169184
net-protocol
@@ -180,6 +195,7 @@ GEM
180195
parallel (1.22.1)
181196
parser (3.2.0.0)
182197
ast (~> 2.4.1)
198+
pathname (0.2.1)
183199
pg (1.4.5)
184200
pry (0.14.2)
185201
coderay (~> 1.1)
@@ -198,7 +214,7 @@ GEM
198214
pry-stack_explorer (0.6.1)
199215
binding_of_caller (~> 1.0)
200216
pry (~> 0.13)
201-
psych (5.0.2)
217+
psych (5.1.0)
202218
stringio
203219
public_suffix (5.0.1)
204220
puma (6.0.2)
@@ -318,7 +334,7 @@ GEM
318334
tilt
319335
scss_lint (0.59.0)
320336
sass (~> 3.5, >= 3.5.5)
321-
sdoc (2.6.0)
337+
sdoc (2.6.1)
322338
rdoc (>= 5.0)
323339
selenium-webdriver (4.7.1)
324340
rexml (~> 3.2, >= 3.2.5)
@@ -349,6 +365,7 @@ GEM
349365
sprockets (>= 3.0.0)
350366
stringio (3.0.4)
351367
sync (0.5.0)
368+
tempfile (0.1.3)
352369
term-ansicolor (1.7.1)
353370
tins (~> 1.0)
354371
thor (1.2.1)
@@ -361,6 +378,7 @@ GEM
361378
uglifier (4.2.0)
362379
execjs (>= 0.3.0, < 3)
363380
unicode-display_width (2.4.2)
381+
uri (0.12.0)
364382
web-console (4.2.0)
365383
actionview (>= 6.0.0)
366384
activemodel (>= 6.0.0)
@@ -377,6 +395,7 @@ GEM
377395
websocket-extensions (0.1.5)
378396
xpath (3.2.0)
379397
nokogiri (~> 1.8)
398+
yaml (0.2.1)
380399
yard (0.9.28)
381400
webrick (~> 1.7.0)
382401
zeitwerk (2.6.6)
@@ -391,6 +410,7 @@ DEPENDENCIES
391410
capybara-screenshot
392411
coffee-rails
393412
coveralls_reborn (~> 0.25.0)
413+
cpl
394414
database_cleaner
395415
debug (>= 1.0.0)
396416
factory_bot_rails

0 commit comments

Comments
 (0)