Skip to content

Commit 8f148cd

Browse files
committed
WIP
1 parent 0d87741 commit 8f148cd

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

.controlplane/controlplane.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
# Configuration for "Heroku to CPLN playbook" custom scripts
1+
# Configuration for `cpl` commands.
2+
3+
# Keys beginning with "cpln_" correspond to your settings in Control Plane.
4+
5+
# Global settings that apply to `cpl` usage.
6+
# You can opt out of allowing the use of CPLN_ORG and CPLN_APP env vars
7+
# to avoid any accidents with the wrong org / app.
8+
allow_org_override_by_env: true
9+
allow_app_override_by_env: true
10+
211
aliases:
312
common: &common
4-
# Org for staging and QA apps is typically set as an alias
13+
# Org for staging and QA apps is typically set as an alias, shared by all apps, except for production apps.
514
# Production apps will use a different org than staging for security.
615
# Change this value to your org name
7-
# or set ENV value to CPLN_ORG as that will override whatever is used here for all cpl commands
16+
# or set ENV CPLN_ORG to your org name as that will override whatever is used here for all cpl commands
817
# cpln_org: shakacode-open-source-examples
918

1019
# Example apps use only location. CPLN offers the ability to use multiple locations.
@@ -25,11 +34,15 @@ aliases:
2534
apps:
2635
react-webpack-rails-tutorial:
2736
<<: *common
28-
tutorial-app:
37+
# Don't allow overriding the org and app by ENV vars b/c production is sensitive!
38+
allow_org_override_by_env: false
39+
allow_app_override_by_env: false
40+
react-webpack-rails-tutorial-staging:
2941
<<: *common
3042
# QA Apps are like Heroku review apps, but the use `prefix` so you can run a commmand like
3143
# this to create a QA app for the tutorial app.
32-
# `cpl setup gvc postgres redis rails -a qa-tutorial-app-pr-1234`
33-
qa-tutorial-app:
44+
# `cpl setup gvc postgres redis rails -a qa-react-webpack-rails-tutorial-pr-1234`
45+
qa-react-webpack-rails-tutorial:
3446
<<: *common
47+
# Prefix is used to identify these "qa" apps.
3548
prefix: true

.controlplane/readme.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ You can see the definition of Postgres and Redis in the `.controlplane/templates
1212

1313
1. Ensure your [Control Plane](https://controlplane.com) account is set up.
1414
You should have an `organization` `<your-org>` for testing in that account.
15-
You will modify value for `aliases.common.cpln_org` in `.controlplane/controlplane.yml`.
15+
Set ENV variable `CPLN_ORG` to `<your-org>`. Alternatively, you may modify the
16+
value for `aliases.common.cpln_org` in `.controlplane/controlplane.yml`.
1617
If you need an organization, please [contact Shakacode](mailto:[email protected]).
1718

1819
2. Install Control Plane CLI (and configure access) using `npm install -g @controlplane/cli`.
@@ -58,10 +59,10 @@ and not `cpln` which is the Control Plane CLI.
5859

5960
```sh
6061
# Use environment variable to prevent repetition
61-
export APP_NAME=tutorial-app
62+
export APP_NAME=react-webpack-rails-tutorial
6263

6364
# Provision all infrastructure on Control Plane.
64-
# app tutorial-app will be created per definition in .controlplane/controlplane.yml
65+
# app react-webpack-rails-tutorial will be created per definition in .controlplane/controlplane.yml
6566
cpl apply-template gvc postgres redis rails daily-task -a $APP_NAME
6667

6768
# Build and push docker image to Control Plane repository
@@ -83,11 +84,11 @@ cpl open -a $APP_NAME
8384

8485
### Promoting code updates
8586

86-
After committing code, you will update your deployment of `tutorial-app` with the following commands:
87+
After committing code, you will update your deployment of `react-webpack-rails-tutorial` with the following commands:
8788

8889
```sh
89-
# Assuming you have already set APP_NAME env variable to tutorial-app
90-
# Build and push new image with sequential image tagging, e.g. 'tutorial-app:1', then 'tutorial-app:2', etc.
90+
# Assuming you have already set APP_NAME env variable to react-webpack-rails-tutorial
91+
# Build and push new image with sequential image tagging, e.g. 'react-webpack-rails-tutorial:1', then 'react-webpack-rails-tutorial:2', etc.
9192
cpl build-image -a $APP_NAME
9293

9394
# Run database migrations (or other release tasks) with latest image,
@@ -102,7 +103,7 @@ cpl deploy-image -a $APP_NAME
102103
If you needed to push a new image with a specific commit SHA, you can run the following command:
103104

104105
```sh
105-
# Build and push with sequential image tagging and commit SHA, e.g. 'tutorial-app:123_ABCD'
106+
# Build and push with sequential image tagging and commit SHA, e.g. 'react-webpack-rails-tutorial:123_ABCD'
106107
cpl build-image -a $APP_NAME --commit ABCD
107108
```
108109

.github/workflows/deploy-to-control-plane.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
CPLN_TOKEN: ${{secrets.CPLN_TOKEN}}
1818

1919
jobs:
20-
deploy-to-control-plane:
20+
deploy-to-control-plane-staging:
2121
runs-on: ubuntu-latest
2222

2323
steps:
@@ -55,8 +55,8 @@ jobs:
5555
- name: cpl build-image
5656
run: |
5757
cpln image docker-login
58-
cpl build-image -a ${{ secrets.APP_NAME_STAGING }} --commit ${{steps.vars.outputs.sha_short}}
58+
cpl build-image -a ${{ secrets.APP_NAME_STAGING }} --commit ${{steps.vars.outputs.sha_short}} --org ${{secrets.CPLN_ORG_STAGING}}
5959
6060
- name: Deploy to Control Plane
6161
run: |
62-
cpl deploy-image -a ${{ secrets.APP_NAME_STAGING }}
62+
cpl deploy-image -a ${{ secrets.APP_NAME_STAGING }} --org ${{secrets.CPLN_ORG_STAGING}}

0 commit comments

Comments
 (0)