Skip to content

Commit bb76816

Browse files
authored
Doc Updates for Control Plane (#521)
1 parent a7a0aa1 commit bb76816

File tree

5 files changed

+77
-67
lines changed

5 files changed

+77
-67
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 deploy-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 deploy-image -a tutorial-app
5676
```
5777

5878
## Other notes

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ruby "3.1.2"
77

88
gem "react_on_rails", "13.2.0"
99
gem "shakapacker", "6.5.5"
10+
gem "cpl", "~> 0.3.3"
1011

1112
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
1213
gem "listen"

Gemfile.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ GEM
106106
term-ansicolor (~> 1.6)
107107
thor (>= 0.20.3, < 2.0)
108108
tins (~> 1.16)
109+
cpl (0.3.3)
110+
debug (~> 1.7.1)
111+
dotenv (~> 2.8.1)
112+
psych (~> 5.1.0)
113+
thor (~> 1.2.1)
109114
crass (1.0.6)
110115
database_cleaner (2.0.1)
111116
database_cleaner-active_record (~> 2.0.0)
@@ -120,6 +125,7 @@ GEM
120125
debug_inspector (1.1.0)
121126
diff-lcs (1.5.0)
122127
docile (1.4.0)
128+
dotenv (2.8.1)
123129
erubi (1.12.0)
124130
erubis (2.7.0)
125131
execjs (2.8.1)
@@ -198,7 +204,7 @@ GEM
198204
pry-stack_explorer (0.6.1)
199205
binding_of_caller (~> 1.0)
200206
pry (~> 0.13)
201-
psych (5.0.2)
207+
psych (5.1.0)
202208
stringio
203209
public_suffix (5.0.1)
204210
puma (6.0.2)
@@ -318,7 +324,7 @@ GEM
318324
tilt
319325
scss_lint (0.59.0)
320326
sass (~> 3.5, >= 3.5.5)
321-
sdoc (2.6.0)
327+
sdoc (2.6.1)
322328
rdoc (>= 5.0)
323329
selenium-webdriver (4.7.1)
324330
rexml (~> 3.2, >= 3.2.5)
@@ -391,6 +397,7 @@ DEPENDENCIES
391397
capybara-screenshot
392398
coffee-rails
393399
coveralls_reborn (~> 0.25.0)
400+
cpl (~> 0.3.3)
394401
database_cleaner
395402
debug (>= 1.0.0)
396403
factory_bot_rails
@@ -436,4 +443,4 @@ RUBY VERSION
436443
ruby 3.1.2p20
437444

438445
BUNDLED WITH
439-
2.3.26
446+
2.4.7

0 commit comments

Comments
 (0)