cpl 1.3.0 → 2.0.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/command_docs.yml +1 -1
  3. data/.github/workflows/rspec-shared.yml +56 -0
  4. data/.github/workflows/rspec.yml +19 -31
  5. data/.github/workflows/rubocop.yml +2 -10
  6. data/.gitignore +2 -0
  7. data/.simplecov_spawn.rb +10 -0
  8. data/CHANGELOG.md +28 -1
  9. data/CONTRIBUTING.md +32 -2
  10. data/Gemfile.lock +38 -29
  11. data/README.md +43 -17
  12. data/cpl.gemspec +2 -1
  13. data/docs/commands.md +68 -59
  14. data/docs/dns.md +6 -0
  15. data/docs/migrating.md +10 -10
  16. data/docs/tips.md +15 -3
  17. data/examples/circleci.yml +3 -3
  18. data/examples/controlplane.yml +35 -9
  19. data/lib/command/apply_template.rb +66 -18
  20. data/lib/command/base.rb +168 -27
  21. data/lib/command/build_image.rb +4 -9
  22. data/lib/command/cleanup_stale_apps.rb +1 -3
  23. data/lib/command/copy_image_from_upstream.rb +0 -7
  24. data/lib/command/delete.rb +39 -7
  25. data/lib/command/deploy_image.rb +35 -2
  26. data/lib/command/exists.rb +1 -1
  27. data/lib/command/generate.rb +1 -1
  28. data/lib/command/info.rb +7 -3
  29. data/lib/command/logs.rb +22 -2
  30. data/lib/command/maintenance_off.rb +1 -1
  31. data/lib/command/maintenance_on.rb +1 -1
  32. data/lib/command/open.rb +2 -2
  33. data/lib/command/open_console.rb +2 -2
  34. data/lib/command/promote_app_from_upstream.rb +5 -25
  35. data/lib/command/ps.rb +1 -1
  36. data/lib/command/ps_start.rb +2 -1
  37. data/lib/command/ps_stop.rb +40 -8
  38. data/lib/command/ps_wait.rb +3 -2
  39. data/lib/command/run.rb +430 -68
  40. data/lib/command/setup_app.rb +22 -2
  41. data/lib/constants/exit_code.rb +7 -0
  42. data/lib/core/config.rb +11 -3
  43. data/lib/core/controlplane.rb +126 -47
  44. data/lib/core/controlplane_api.rb +15 -1
  45. data/lib/core/controlplane_api_cli.rb +3 -3
  46. data/lib/core/controlplane_api_direct.rb +33 -5
  47. data/lib/core/shell.rb +15 -9
  48. data/lib/cpl/version.rb +1 -1
  49. data/lib/cpl.rb +50 -9
  50. data/lib/deprecated_commands.json +2 -1
  51. data/lib/generator_templates/controlplane.yml +5 -0
  52. data/lib/generator_templates/templates/{gvc.yml → app.yml} +4 -4
  53. data/lib/generator_templates/templates/postgres.yml +1 -1
  54. data/lib/generator_templates/templates/rails.yml +1 -1
  55. data/script/check_cpln_links +3 -3
  56. data/templates/app.yml +18 -0
  57. data/templates/daily-task.yml +3 -2
  58. data/templates/rails.yml +3 -2
  59. data/templates/secrets.yml +11 -0
  60. data/templates/sidekiq.yml +3 -2
  61. metadata +38 -25
  62. data/.rspec +0 -1
  63. data/lib/command/run_cleanup.rb +0 -116
  64. data/lib/command/run_detached.rb +0 -175
  65. data/lib/core/scripts.rb +0 -34
  66. data/templates/gvc.yml +0 -13
  67. data/templates/identity.yml +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d76f46cb9427fc137ece07123d0ddd0d1add98e1ffa046a95e1394916784676e
4
- data.tar.gz: 266681f356c78d8a4636ae27cb90485a49eda80c27a6199bd3505ddd72cd3451
3
+ metadata.gz: 84efbe4c7082edcef9193b7a4116af57177b54f52373e4e4bca7e6b277f1b846
4
+ data.tar.gz: 9e047c8b354e6e0a01b28b84e4b3c74c0f5dd675c8d1f5113119803f1f5bcabb
5
5
  SHA512:
6
- metadata.gz: 33f9ec2f7af612611d3a55114097f21a2a2cc9605b3bd2813345b9a06f8308a28d204bd71f49f96e2d1a77798e920621651e457801d795b40f3bf51abe91e985
7
- data.tar.gz: d2c82fb6b24cf54e306e83f21b0c8a1b519147e1f8ec66b81442b2ae05f2c752eb18c60cb94c66c2cd11ea921db228116b2bc3ead49c77f1317ce0aa4e290ff1
6
+ metadata.gz: 6efc92fbcb3ea76e6ec44561178e719afc80af717790771b9c2c8358f564eb94b9c76b8aef8367c401e6e98f2faf9c0a8e628371a3193e038843339d12f7058e
7
+ data.tar.gz: e43668ec1adc98bd399396a35cb092d8d940df1d6bfea3ecb09b99e1be48f8ff7f0c625d8c4936eb61d01ceec4e3c8fb6a2eb7018f6ee91c1b0751dc7847f93f
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "3.0"
19
+ ruby-version: "2.7"
20
20
  bundler-cache: true
21
21
  - name: Install dependencies
22
22
  run: bundle install
@@ -0,0 +1,56 @@
1
+ name: RSpec Shared
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ os-version:
7
+ required: true
8
+ type: string
9
+ ruby-version:
10
+ required: true
11
+ type: string
12
+ test-tag:
13
+ required: true
14
+ type: string
15
+
16
+ jobs:
17
+ rspec:
18
+ runs-on: ${{ inputs.os-version }}
19
+ env:
20
+ RAILS_ENV: test
21
+ # We have to add "_CI" to the end, otherwise it messes with tests where we switch profiles,
22
+ # as Control Plane will try to use this token's profile instead.
23
+ CPLN_TOKEN_CI: ${{ secrets.CPLN_TOKEN }}
24
+ CPLN_ORG: ${{ vars.CPLN_ORG }}
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@v3
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ inputs.ruby-version }}
32
+ bundler-cache: true
33
+ - name: Install dependencies
34
+ run: bundle install
35
+ - name: Install Control Plane tools
36
+ run: |
37
+ sudo npm install -g @controlplane/cli
38
+ cpln --version
39
+ - name: Setup Control Plane tools
40
+ run: |
41
+ cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
42
+ cpln image docker-login
43
+ - name: Run tests
44
+ run: bundle exec rspec --format documentation --tag ${{ inputs.test-tag }}
45
+ - name: Upload spec log
46
+ uses: actions/upload-artifact@master
47
+ if: always()
48
+ with:
49
+ name: spec-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}.log
50
+ path: spec.log
51
+ - name: Upload coverage results
52
+ uses: actions/upload-artifact@master
53
+ if: always()
54
+ with:
55
+ name: coverage-report-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}
56
+ path: coverage
@@ -5,36 +5,24 @@ on:
5
5
  branches:
6
6
  - main
7
7
  pull_request:
8
+ workflow_dispatch:
8
9
 
9
10
  jobs:
10
- rspec:
11
- strategy:
12
- matrix:
13
- os:
14
- - ubuntu-latest
15
- - macos-latest
16
- ruby:
17
- - "2.7"
18
- - "3.0"
19
- runs-on: ${{ matrix.os }}
20
- name: RSpec
21
- env:
22
- RAILS_ENV: test
23
- steps:
24
- - name: Checkout code
25
- uses: actions/checkout@v3
26
- - name: Set up Ruby
27
- uses: ruby/setup-ruby@v1
28
- with:
29
- ruby-version: ${{ matrix.ruby }}
30
- bundler-cache: true
31
- - name: Install dependencies
32
- run: bundle install
33
- - name: Run tests
34
- run: bundle exec rspec
35
- - name: Upload coverage results
36
- uses: actions/upload-artifact@master
37
- if: always()
38
- with:
39
- name: coverage-report-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.ruby }}
40
- path: coverage
11
+ rspec-fast:
12
+ name: RSpec (Fast)
13
+ uses: ./.github/workflows/rspec-shared.yml
14
+ with:
15
+ os-version: ubuntu-latest
16
+ ruby-version: "2.7"
17
+ test-tag: ~slow
18
+ secrets: inherit
19
+
20
+ rspec-slow:
21
+ name: RSpec (Slow)
22
+ uses: ./.github/workflows/rspec-shared.yml
23
+ if: github.event_name == 'workflow_dispatch'
24
+ with:
25
+ os-version: ubuntu-latest
26
+ ruby-version: "2.7"
27
+ test-tag: slow
28
+ secrets: inherit
@@ -8,15 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  rubocop:
11
- strategy:
12
- matrix:
13
- os:
14
- - ubuntu-latest
15
- - macos-latest
16
- ruby:
17
- - "2.7"
18
- - "3.0"
19
- runs-on: ${{ matrix.os }}
11
+ runs-on: ubuntu-latest
20
12
  name: Rubocop
21
13
  steps:
22
14
  - name: Checkout code
@@ -24,7 +16,7 @@ jobs:
24
16
  - name: Set up Ruby
25
17
  uses: ruby/setup-ruby@v1
26
18
  with:
27
- ruby-version: ${{ matrix.ruby }}
19
+ ruby-version: "2.7"
28
20
  bundler-cache: true
29
21
  - name: Install dependencies
30
22
  run: bundle install
data/.gitignore CHANGED
@@ -13,3 +13,5 @@
13
13
 
14
14
  # rspec failure tracking
15
15
  .rspec_status
16
+
17
+ spec.log
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+
5
+ SimpleCov.start do
6
+ command_name "spawn"
7
+ enable_coverage :branch
8
+
9
+ at_fork.call(Process.pid)
10
+ end
data/CHANGELOG.md CHANGED
@@ -14,6 +14,31 @@ Changes since the last non-beta release.
14
14
 
15
15
  _Please add entries here for your pull requests that are not yet released._
16
16
 
17
+ ### Added
18
+
19
+ - Added option to set custom names for secrets and secrets policy, using `secrets_name` and `secrets_policy_name` in `controlplane.yml`. [PR 159](https://github.com/shakacode/heroku-to-control-plane/pull/159) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
20
+
21
+ ### Changed
22
+
23
+ - `deploy-image` command now raises an error if image does not exist. [PR 153](https://github.com/shakacode/heroku-to-control-plane/pull/153) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
24
+
25
+ ## [1.4.0] - 2024-03-20
26
+
27
+ ### Added
28
+
29
+ - Added new template substitution variables (used by `apply-template` and `setup-app` commands): `{{APP_LOCATION_LINK}}`, `{{APP_IMAGE_LINK}}`, `{{APP_IDENTITY}}`, `{{APP_IDENTITY_LINK}}`, `{{APP_SECRETS}}` and `{{APP_SECRETS_POLICY}}`. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
30
+ - Added `--run-release-phase` option to `deploy-image` command to run release script before deploying (same step as in `promote-app-from-upstream` command). [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
31
+
32
+ ### Changed
33
+
34
+ - Template substitution (used by `apply-template` and `setup-app` commands) now uses double braces (e.g., `APP_ORG` -> `{{APP_ORG}}`). This change is backwards compatible. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
35
+ - Renamed template substitution variable `APP_GVC` to `{{APP_NAME}}` (used by `apply-template` and `setup-app` commands). This change is backwards compatible. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
36
+ - `setup-app` command now automatically binds the app to the secrets policy, as long as both the identity and the policy exist. Added `--skip-secret-access-binding` option to prevent this behavior. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
37
+ - Local API token is now refreshed when it is about to expire. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
38
+ - `apply-template` command now exits with non-zero code if failed to apply any templates. [PR 146](https://github.com/shakacode/heroku-to-control-plane/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
39
+
40
+ ## [1.3.0] - 2024-03-19
41
+
17
42
  ### Fixed
18
43
 
19
44
  - Fixed issue where cpln profile was not switched back to `default` if an error happened while running `copy-image-from-upstream` command. [PR 135](https://github.com/shakacode/heroku-to-control-plane/pull/135) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
@@ -139,7 +164,9 @@ _Please add entries here for your pull requests that are not yet released._
139
164
 
140
165
  - Initial release
141
166
 
142
- [Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.2.0...HEAD
167
+ [Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.4.0...HEAD
168
+ [1.4.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.3.0...v1.4.0
169
+ [1.3.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.2.0...v1.3.0
143
170
  [1.2.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.1.2...v1.2.0
144
171
  [1.1.2]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.1.1...v1.1.2
145
172
  [1.1.1]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.1.0...v1.1.1
data/CONTRIBUTING.md CHANGED
@@ -12,13 +12,12 @@ git clone https://github.com/shakacode/heroku-to-control-plane
12
12
  alias cpl="~/projects/heroku-to-control-plane/bin/cpl"
13
13
  ```
14
14
 
15
- ## Linting/Testing
15
+ ## Linting
16
16
 
17
17
  Before committing or pushing code, be sure to:
18
18
 
19
19
  - Run `bundle exec rake update_command_docs` to sync any doc changes made in the source code to the docs
20
20
  - Run `bundle exec rubocop -a` to fix any linting errors
21
- - Run `bundle exec rspec` to run the test suite
22
21
 
23
22
  You can also install [overcommit](https://github.com/sds/overcommit) and let it automatically check for you:
24
23
 
@@ -28,6 +27,37 @@ gem install overcommit
28
27
  overcommit --install
29
28
  ```
30
29
 
30
+ ## Testing
31
+
32
+ We use real apps for the tests. You'll need to have full access to a Control Plane org, and then set it as the env var `CPLN_ORG` when running the tests (or in the `.env` file):
33
+
34
+ ```sh
35
+ CPLN_ORG=your-org-for-tests bundle exec rspec
36
+ ```
37
+
38
+ Alternatively, you might have a `.envrc` file with:
39
+
40
+ ```sh
41
+ export CPLN_ORG=shakacode-heroku-to-control-plane-ci
42
+ export RSPEC_RETRY_RETRY_COUNT=1
43
+ ```
44
+
45
+ Tests are separated between fast and slow. Slow tests can take a long time and usually involve building / deploying images and waiting for workloads to be ready / not ready, so they should only be run once in a while.
46
+
47
+ If you add a slow test, tag it with `slow`. Tests without a `slow` tag are considered fast by default.
48
+
49
+ To run fast tests:
50
+
51
+ ```sh
52
+ CPLN_ORG=your-org-for-tests bundle exec rspec --tag ~slow
53
+ ```
54
+
55
+ To run slow tests:
56
+
57
+ ```sh
58
+ CPLN_ORG=your-org-for-tests bundle exec rspec --tag slow
59
+ ```
60
+
31
61
  ## Debugging
32
62
 
33
63
  1. Use the `--verbose` option to see more detailed logs.
data/Gemfile.lock CHANGED
@@ -1,66 +1,76 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cpl (1.3.0)
4
+ cpl (2.0.0.rc.0)
5
5
  debug (~> 1.7.1)
6
6
  dotenv (~> 2.8.1)
7
+ jwt (~> 2.8.1)
7
8
  psych (~> 5.1.0)
8
9
  thor (~> 1.2.1)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- addressable (2.8.4)
14
+ addressable (2.8.6)
14
15
  public_suffix (>= 2.0.2, < 6.0)
15
16
  ast (2.4.2)
17
+ base64 (0.2.0)
18
+ bigdecimal (3.1.7)
16
19
  childprocess (4.1.0)
17
- crack (0.4.5)
20
+ crack (1.0.0)
21
+ bigdecimal
18
22
  rexml
19
23
  debug (1.7.2)
20
24
  irb (>= 1.5.0)
21
25
  reline (>= 0.3.1)
22
- diff-lcs (1.5.0)
26
+ diff-lcs (1.5.1)
23
27
  docile (1.4.0)
24
28
  dotenv (2.8.1)
25
- hashdiff (1.0.1)
29
+ hashdiff (1.1.0)
26
30
  iniparse (1.5.0)
27
31
  io-console (0.7.2)
28
- irb (1.12.0)
29
- rdoc
32
+ irb (1.13.1)
33
+ rdoc (>= 4.0.0)
30
34
  reline (>= 0.4.2)
31
- json (2.6.3)
35
+ json (2.7.2)
36
+ jwt (2.8.1)
37
+ base64
32
38
  overcommit (0.60.0)
33
39
  childprocess (>= 0.6.3, < 5)
34
40
  iniparse (~> 1.4)
35
41
  rexml (~> 3.2)
36
- parallel (1.22.1)
37
- parser (3.2.0.0)
42
+ parallel (1.24.0)
43
+ parser (3.3.0.5)
38
44
  ast (~> 2.4.1)
45
+ racc
39
46
  psych (5.1.2)
40
47
  stringio
41
- public_suffix (5.0.1)
48
+ public_suffix (5.0.5)
49
+ racc (1.7.3)
42
50
  rainbow (3.1.1)
43
- rake (13.0.6)
44
- rdoc (6.6.2)
51
+ rake (13.2.1)
52
+ rdoc (6.6.3.1)
45
53
  psych (>= 4.0.0)
46
- regexp_parser (2.6.2)
47
- reline (0.4.3)
54
+ regexp_parser (2.9.0)
55
+ reline (0.5.6)
48
56
  io-console (~> 0.5)
49
- rexml (3.2.5)
57
+ rexml (3.2.6)
50
58
  rspec (3.12.0)
51
59
  rspec-core (~> 3.12.0)
52
60
  rspec-expectations (~> 3.12.0)
53
61
  rspec-mocks (~> 3.12.0)
54
- rspec-core (3.12.1)
62
+ rspec-core (3.12.3)
55
63
  rspec-support (~> 3.12.0)
56
- rspec-expectations (3.12.2)
64
+ rspec-expectations (3.12.4)
57
65
  diff-lcs (>= 1.2.0, < 2.0)
58
66
  rspec-support (~> 3.12.0)
59
- rspec-mocks (3.12.3)
67
+ rspec-mocks (3.12.7)
60
68
  diff-lcs (>= 1.2.0, < 2.0)
61
69
  rspec-support (~> 3.12.0)
62
- rspec-support (3.12.0)
63
- rubocop (1.45.0)
70
+ rspec-retry (0.6.2)
71
+ rspec-core (> 3.3)
72
+ rspec-support (3.12.2)
73
+ rubocop (1.45.1)
64
74
  json (~> 2.3)
65
75
  parallel (~> 1.10)
66
76
  parser (>= 3.2.0.0)
@@ -70,16 +80,16 @@ GEM
70
80
  rubocop-ast (>= 1.24.1, < 2.0)
71
81
  ruby-progressbar (~> 1.7)
72
82
  unicode-display_width (>= 2.4.0, < 3.0)
73
- rubocop-ast (1.24.1)
74
- parser (>= 3.1.1.0)
75
- rubocop-capybara (2.17.0)
83
+ rubocop-ast (1.31.2)
84
+ parser (>= 3.3.0.4)
85
+ rubocop-capybara (2.20.0)
76
86
  rubocop (~> 1.41)
77
87
  rubocop-rake (0.6.0)
78
88
  rubocop (~> 1.0)
79
89
  rubocop-rspec (2.18.1)
80
90
  rubocop (~> 1.33)
81
91
  rubocop-capybara (~> 2.17)
82
- ruby-progressbar (1.11.0)
92
+ ruby-progressbar (1.13.0)
83
93
  simplecov (0.22.0)
84
94
  docile (~> 1.1)
85
95
  simplecov-html (~> 0.11)
@@ -88,9 +98,8 @@ GEM
88
98
  simplecov_json_formatter (0.1.4)
89
99
  stringio (3.1.0)
90
100
  thor (1.2.2)
91
- timecop (0.9.6)
92
- unicode-display_width (2.4.2)
93
- vcr (6.1.0)
101
+ timecop (0.9.8)
102
+ unicode-display_width (2.5.0)
94
103
  webmock (3.18.1)
95
104
  addressable (>= 2.8.0)
96
105
  crack (>= 0.3.2)
@@ -105,12 +114,12 @@ DEPENDENCIES
105
114
  overcommit (~> 0.60.0)
106
115
  rake (~> 13.0)
107
116
  rspec (~> 3.12.0)
117
+ rspec-retry (~> 0.6.2)
108
118
  rubocop (~> 1.45.0)
109
119
  rubocop-rake (~> 0.6.0)
110
120
  rubocop-rspec (~> 2.18.1)
111
121
  simplecov (~> 0.22.0)
112
122
  timecop (~> 0.9.6)
113
- vcr (~> 6.1.0)
114
123
  webmock (~> 3.18.1)
115
124
 
116
125
  BUNDLED WITH
data/README.md CHANGED
@@ -110,7 +110,7 @@ For the typical Rails app, this means:
110
110
 
111
111
  3. Install [Ruby](https://www.ruby-lang.org/en/) (required for these helpers).
112
112
 
113
- 4. Install Control Plane CLI, and configure access ([docs here](https://docs.controlplane.com/quickstart/quick-start-3-cli#getting-started-with-the-cli)).
113
+ 4. Install Control Plane CLI, and configure access ([docs here](https://shakadocs.controlplane.com/quickstart/quick-start-3-cli#getting-started-with-the-cli)).
114
114
 
115
115
  ```sh
116
116
  # Install CLI
@@ -125,7 +125,7 @@ npm update -g @controlplane/cli
125
125
 
126
126
  5. Run `cpln image docker-login --org <your-org>` to ensure that you have access to the Control Plane Docker registry.
127
127
 
128
- 6. Install Heroku to Control Plane `cpl` CLI as a [Ruby gem](https://rubygems.org/gems/cpl): `gem install cpl`. If you want to hack on the source code, see [CONTRIBUTING.md](CONTRIBUTING.md).
128
+ 6. Install Heroku to Control Plane `cpl` CLI as a [Ruby gem](https://rubygems.org/gems/cpl): `gem install cpl`. If you want to use `cpl` from Rake tasks in a Rails project, use `Bundler.with_unbundled_env { `cpl help` } or else you'll get an error that `cpl` cannot be found. While you can add `cpl` to your Gemfile, it's not recommended because it might trigger conflicts with other gems.
129
129
 
130
130
  7. You can use [this Dockerfile](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/Dockerfile) as an example for your project. Ensure that you have Docker running.
131
131
 
@@ -143,7 +143,7 @@ The `cpl` gem is based on several configuration files within a `/.controlplane`
143
143
  ```
144
144
  .controlplane/
145
145
  ├─ templates/
146
- │ ├─ gvc.yml
146
+ │ ├─ app.yml
147
147
  │ ├─ postgres.yml
148
148
  │ ├─ rails.yml
149
149
  ├─ controlplane.yml
@@ -154,8 +154,8 @@ The `cpl` gem is based on several configuration files within a `/.controlplane`
154
154
  1. `controlplane.yml` describes the overall application. Be sure to have `<your-org>` as the value for `aliases.common.cpln_org`, or set it with the `CPLN_ORG` environment variable.
155
155
  2. `Dockerfile` builds the production application. `entrypoint.sh` is an _example_ entrypoint script for the production application, referenced in your Dockerfile.
156
156
  3. `templates` directory contains the templates for the various workloads, such as `rails.yml` and `postgres.yml`.
157
- 4. `templates/gvc.yml` defines your project's GVC (like a Heroku app). More importantly, it contains ENV values for the app.
158
- 5. `templates/rails.yml` defines your Rails workload. It may inherit ENV values from the parent GVC, which is populated from the `templates/gvc.yml`. This file also configures scaling, sizing, firewalls, and other workload-specific values.
157
+ 4. `templates/app.yml` defines your project's GVC (like a Heroku app). More importantly, it contains ENV values for the app.
158
+ 5. `templates/rails.yml` defines your Rails workload. It may inherit ENV values from the parent GVC, which is populated from the `templates/app.yml`. This file also configures scaling, sizing, firewalls, and other workload-specific values.
159
159
  6. For other workloads (like lines in a Heroku `Procfile`), you create additional template files. For example, you can base a `templates/sidekiq.yml` on the `templates/rails.yml` file.
160
160
  7. You can have other files in the `templates` directory, such as `redis.yml` and `postgres.yml`, which could setup Redis and Postgres for a testing application.
161
161
 
@@ -183,30 +183,60 @@ aliases:
183
183
 
184
184
  # Control Plane offers the ability to use multiple locations.
185
185
  # default_location is used for commands that require a location
186
- # including `ps`, `run`, `run:detached`, `apply-template`.
186
+ # including `ps`, `run`, `apply-template`.
187
187
  # This can be overridden with option --location=<location> and
188
188
  # CPLN_LOCATION environment variable.
189
189
  default_location: aws-us-east-2
190
190
 
191
191
  # Allows running the command `cpl setup-app`
192
- # instead of `cpl apply-template gvc redis postgres memcached rails sidekiq`.
192
+ # instead of `cpl apply-template app redis postgres memcached rails sidekiq`.
193
+ #
194
+ # Note:
195
+ # 1. These names correspond to files in the `./controlplane/templates` directory.
196
+ # 2. Each file can contain many objects, such as in the case of templates that create a resource, like `postgres`.
197
+ # 3. While the naming often corresponds to a workload or other object name, the naming is arbitrary.
198
+ # Naming does not need to match anything other than the file name without the `.yml` extension.
199
+ #
200
+ # If you're going to use secrets, you need to apply the `secrets.yml` template separately (one-time setup):
201
+ # `cpl apply-template secrets -a my-app`
193
202
  setup_app_templates:
194
- - gvc
203
+ - app
195
204
  - redis
196
205
  - postgres
197
206
  - memcached
198
207
  - rails
199
208
  - sidekiq
200
209
 
210
+ # Only needed if using a custom secrets name.
211
+ # The default is '{APP_PREFIX}-secrets'. For example:
212
+ # - for an app 'my-app-staging' with `match_if_app_name_starts_with` set to `false`,
213
+ # it would be 'my-app-staging-secrets'
214
+ # - for an app 'my-app-review-1234' with `match_if_app_name_starts_with` set to `true`,
215
+ # it would be 'my-app-review-secrets'
216
+ secrets_name: my-secrets
217
+
218
+ # Only needed if using a custom secrets policy name.
219
+ # The default is '{APP_SECRETS}-policy'. For example:
220
+ # - for an app 'my-app-staging' with `match_if_app_name_starts_with` set to `false`,
221
+ # it would be 'my-app-staging-secrets-policy'
222
+ # - for an app 'my-app-review-1234' with `match_if_app_name_starts_with` set to `true`,
223
+ # it would be 'my-app-review-secrets-policy'
224
+ secrets_policy_name: my-secrets-policy
225
+
201
226
  # Configure the workload name used as a template for one-off scripts, like a Heroku one-off dyno.
202
227
  one_off_workload: rails
203
228
 
204
229
  # Workloads that are for the application itself and are using application Docker images.
230
+ # These are updated with the new image when running the `deploy-image` command,
231
+ # and are also used by the `info` and `ps:` commands in order to get all of the defined workloads.
232
+ # On the other hand, if you have a workload for Redis, that would NOT use the application Docker image
233
+ # and not be listed here.
205
234
  app_workloads:
206
235
  - rails
207
236
  - sidekiq
208
237
 
209
238
  # Additional "service type" workloads, using non-application Docker images.
239
+ # These are only used by the `info` and `ps:` commands in order to get all of the defined workloads.
210
240
  additional_workloads:
211
241
  - redis
212
242
  - postgres
@@ -216,7 +246,7 @@ aliases:
216
246
  maintenance_workload: maintenance
217
247
 
218
248
  # Fixes the remote terminal size to match the local terminal size
219
- # when running the commands `cpl run` or `cpl run:detached`.
249
+ # when running `cpl run`.
220
250
  fix_terminal_size: true
221
251
 
222
252
  # Apps with a deployed image created before this amount of days will be listed for deletion
@@ -231,10 +261,6 @@ aliases:
231
261
  # when running the command `cpl cleanup-images` (`image_retention_max_qty` takes precedence).
232
262
  image_retention_days: 5
233
263
 
234
- # Run workloads created before this amount of days will be listed for deletion
235
- # when running the command `cpl run:cleanup`.
236
- stale_run_workload_created_days: 2
237
-
238
264
  apps:
239
265
  my-app-staging:
240
266
  # Use the values from the common section above.
@@ -290,7 +316,7 @@ Suppose your app is called `tutorial-app`. You can run the following commands.
290
316
  ```sh
291
317
  # Provision all infrastructure on Control Plane.
292
318
  # `tutorial-app` will be created per definition in .controlplane/controlplane.yml.
293
- cpl apply-template gvc postgres redis rails daily-task -a tutorial-app
319
+ cpl apply-template app postgres redis rails daily-task -a tutorial-app
294
320
 
295
321
  # Build and push the Docker image to the Control Plane repository.
296
322
  # Note, it may take many minutes. Be patient.
@@ -319,7 +345,7 @@ cpl build-image -a tutorial-app
319
345
  # Run database migrations (or other release tasks) with the latest image,
320
346
  # while the app is still running on the previous image.
321
347
  # This is analogous to the release phase.
322
- cpl run:detached rails db:migrate -a tutorial-app --image latest
348
+ cpl run -a tutorial-app --image latest -- rails db:migrate
323
349
 
324
350
  # Pomote the latest image to the app.
325
351
  cpl deploy-image -a tutorial-app
@@ -357,7 +383,7 @@ It is also possible to set up a Secret store (of type `Dictionary`), which we ca
357
383
  `cpln://secret/MY_SECRET_STORE_NAME/MY_SECRET_VAR_NAME`. In such a case, we must set up an app Identity and proper
358
384
  Policy to access the secret.
359
385
 
360
- In `templates/gvc.yml`:
386
+ In `templates/app.yml`:
361
387
 
362
388
  ```yaml
363
389
  spec:
@@ -429,7 +455,7 @@ development purposes.
429
455
 
430
456
  ## Scheduled Jobs
431
457
 
432
- Control Plane supports scheduled jobs via [cron workloads](https://docs.controlplane.com/reference/workload#cron).
458
+ Control Plane supports scheduled jobs via [cron workloads](https://shakadocs.controlplane.com/reference/workload#cron).
433
459
 
434
460
  Here's a partial example of a template for a cron workload, using the app image:
435
461
 
data/cpl.gemspec CHANGED
@@ -17,17 +17,18 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.add_dependency "debug", "~> 1.7.1"
19
19
  spec.add_dependency "dotenv", "~> 2.8.1"
20
+ spec.add_dependency "jwt", "~> 2.8.1"
20
21
  spec.add_dependency "psych", "~> 5.1.0"
21
22
  spec.add_dependency "thor", "~> 1.2.1"
22
23
 
23
24
  spec.add_development_dependency "overcommit", "~> 0.60.0"
24
25
  spec.add_development_dependency "rspec", "~> 3.12.0"
26
+ spec.add_development_dependency "rspec-retry", "~> 0.6.2"
25
27
  spec.add_development_dependency "rubocop", "~> 1.45.0"
26
28
  spec.add_development_dependency "rubocop-rake", "~> 0.6.0"
27
29
  spec.add_development_dependency "rubocop-rspec", "~> 2.18.1"
28
30
  spec.add_development_dependency "simplecov", "~> 0.22.0"
29
31
  spec.add_development_dependency "timecop", "~> 0.9.6"
30
- spec.add_development_dependency "vcr", "~> 6.1.0"
31
32
  spec.add_development_dependency "webmock", "~> 3.18.1"
32
33
 
33
34
  spec.files = `git ls-files -z`.split("\x0").reject do |file|