cpl 1.4.0 → 2.0.0.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/command_docs.yml +1 -1
- data/.github/workflows/rspec-shared.yml +56 -0
- data/.github/workflows/rspec.yml +19 -31
- data/.github/workflows/rubocop.yml +2 -10
- data/.gitignore +2 -0
- data/.simplecov_spawn.rb +10 -0
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +32 -2
- data/Gemfile.lock +34 -29
- data/README.md +34 -25
- data/cpl.gemspec +1 -1
- data/docs/commands.md +54 -54
- data/docs/dns.md +6 -0
- data/docs/migrating.md +10 -10
- data/docs/tips.md +12 -10
- data/examples/circleci.yml +3 -3
- data/examples/controlplane.yml +25 -16
- data/lib/command/apply_template.rb +9 -9
- data/lib/command/base.rb +132 -37
- data/lib/command/build_image.rb +4 -9
- data/lib/command/cleanup_stale_apps.rb +1 -1
- data/lib/command/copy_image_from_upstream.rb +0 -7
- data/lib/command/delete.rb +39 -7
- data/lib/command/deploy_image.rb +18 -3
- data/lib/command/exists.rb +1 -1
- data/lib/command/generate.rb +1 -1
- data/lib/command/info.rb +7 -3
- data/lib/command/logs.rb +22 -2
- data/lib/command/maintenance_off.rb +1 -1
- data/lib/command/maintenance_on.rb +1 -1
- data/lib/command/open.rb +2 -2
- data/lib/command/open_console.rb +2 -2
- data/lib/command/ps.rb +1 -1
- data/lib/command/ps_start.rb +2 -1
- data/lib/command/ps_stop.rb +40 -8
- data/lib/command/ps_wait.rb +3 -2
- data/lib/command/run.rb +430 -69
- data/lib/command/setup_app.rb +4 -1
- data/lib/constants/exit_code.rb +7 -0
- data/lib/core/config.rb +1 -1
- data/lib/core/controlplane.rb +109 -48
- data/lib/core/controlplane_api.rb +7 -1
- data/lib/core/controlplane_api_cli.rb +3 -3
- data/lib/core/controlplane_api_direct.rb +1 -1
- data/lib/core/shell.rb +15 -9
- data/lib/cpl/version.rb +1 -1
- data/lib/cpl.rb +48 -9
- data/lib/deprecated_commands.json +2 -1
- data/lib/generator_templates/controlplane.yml +2 -2
- data/script/check_cpln_links +3 -3
- data/templates/{gvc.yml → app.yml} +5 -0
- data/templates/secrets.yml +8 -0
- metadata +23 -26
- data/.rspec +0 -1
- data/lib/command/run_cleanup.rb +0 -116
- data/lib/command/run_detached.rb +0 -176
- data/lib/core/scripts.rb +0 -34
- data/templates/identity.yml +0 -3
- data/templates/secrets-policy.yml +0 -4
- /data/lib/generator_templates/templates/{gvc.yml → app.yml} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84efbe4c7082edcef9193b7a4116af57177b54f52373e4e4bca7e6b277f1b846
|
4
|
+
data.tar.gz: 9e047c8b354e6e0a01b28b84e4b3c74c0f5dd675c8d1f5113119803f1f5bcabb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6efc92fbcb3ea76e6ec44561178e719afc80af717790771b9c2c8358f564eb94b9c76b8aef8367c401e6e98f2faf9c0a8e628371a3193e038843339d12f7058e
|
7
|
+
data.tar.gz: e43668ec1adc98bd399396a35cb092d8d940df1d6bfea3ecb09b99e1be48f8ff7f0c625d8c4936eb61d01ceec4e3c8fb6a2eb7018f6ee91c1b0751dc7847f93f
|
@@ -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
|
data/.github/workflows/rspec.yml
CHANGED
@@ -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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
name: RSpec
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
|
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
|
-
|
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:
|
19
|
+
ruby-version: "2.7"
|
28
20
|
bundler-cache: true
|
29
21
|
- name: Install dependencies
|
30
22
|
run: bundle install
|
data/.gitignore
CHANGED
data/.simplecov_spawn.rb
ADDED
data/CHANGELOG.md
CHANGED
@@ -14,6 +14,14 @@ 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
|
+
|
17
25
|
## [1.4.0] - 2024-03-20
|
18
26
|
|
19
27
|
### Added
|
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
|
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,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cpl (
|
4
|
+
cpl (2.0.0.rc.0)
|
5
5
|
debug (~> 1.7.1)
|
6
6
|
dotenv (~> 2.8.1)
|
7
7
|
jwt (~> 2.8.1)
|
@@ -11,60 +11,66 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
addressable (2.8.
|
14
|
+
addressable (2.8.6)
|
15
15
|
public_suffix (>= 2.0.2, < 6.0)
|
16
16
|
ast (2.4.2)
|
17
17
|
base64 (0.2.0)
|
18
|
+
bigdecimal (3.1.7)
|
18
19
|
childprocess (4.1.0)
|
19
|
-
crack (0.
|
20
|
+
crack (1.0.0)
|
21
|
+
bigdecimal
|
20
22
|
rexml
|
21
23
|
debug (1.7.2)
|
22
24
|
irb (>= 1.5.0)
|
23
25
|
reline (>= 0.3.1)
|
24
|
-
diff-lcs (1.5.
|
26
|
+
diff-lcs (1.5.1)
|
25
27
|
docile (1.4.0)
|
26
28
|
dotenv (2.8.1)
|
27
|
-
hashdiff (1.0
|
29
|
+
hashdiff (1.1.0)
|
28
30
|
iniparse (1.5.0)
|
29
31
|
io-console (0.7.2)
|
30
|
-
irb (1.
|
31
|
-
rdoc
|
32
|
+
irb (1.13.1)
|
33
|
+
rdoc (>= 4.0.0)
|
32
34
|
reline (>= 0.4.2)
|
33
|
-
json (2.
|
35
|
+
json (2.7.2)
|
34
36
|
jwt (2.8.1)
|
35
37
|
base64
|
36
38
|
overcommit (0.60.0)
|
37
39
|
childprocess (>= 0.6.3, < 5)
|
38
40
|
iniparse (~> 1.4)
|
39
41
|
rexml (~> 3.2)
|
40
|
-
parallel (1.
|
41
|
-
parser (3.
|
42
|
+
parallel (1.24.0)
|
43
|
+
parser (3.3.0.5)
|
42
44
|
ast (~> 2.4.1)
|
45
|
+
racc
|
43
46
|
psych (5.1.2)
|
44
47
|
stringio
|
45
|
-
public_suffix (5.0.
|
48
|
+
public_suffix (5.0.5)
|
49
|
+
racc (1.7.3)
|
46
50
|
rainbow (3.1.1)
|
47
|
-
rake (13.
|
48
|
-
rdoc (6.6.
|
51
|
+
rake (13.2.1)
|
52
|
+
rdoc (6.6.3.1)
|
49
53
|
psych (>= 4.0.0)
|
50
|
-
regexp_parser (2.
|
51
|
-
reline (0.
|
54
|
+
regexp_parser (2.9.0)
|
55
|
+
reline (0.5.6)
|
52
56
|
io-console (~> 0.5)
|
53
|
-
rexml (3.2.
|
57
|
+
rexml (3.2.6)
|
54
58
|
rspec (3.12.0)
|
55
59
|
rspec-core (~> 3.12.0)
|
56
60
|
rspec-expectations (~> 3.12.0)
|
57
61
|
rspec-mocks (~> 3.12.0)
|
58
|
-
rspec-core (3.12.
|
62
|
+
rspec-core (3.12.3)
|
59
63
|
rspec-support (~> 3.12.0)
|
60
|
-
rspec-expectations (3.12.
|
64
|
+
rspec-expectations (3.12.4)
|
61
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
62
66
|
rspec-support (~> 3.12.0)
|
63
|
-
rspec-mocks (3.12.
|
67
|
+
rspec-mocks (3.12.7)
|
64
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
69
|
rspec-support (~> 3.12.0)
|
66
|
-
rspec-
|
67
|
-
|
70
|
+
rspec-retry (0.6.2)
|
71
|
+
rspec-core (> 3.3)
|
72
|
+
rspec-support (3.12.2)
|
73
|
+
rubocop (1.45.1)
|
68
74
|
json (~> 2.3)
|
69
75
|
parallel (~> 1.10)
|
70
76
|
parser (>= 3.2.0.0)
|
@@ -74,16 +80,16 @@ GEM
|
|
74
80
|
rubocop-ast (>= 1.24.1, < 2.0)
|
75
81
|
ruby-progressbar (~> 1.7)
|
76
82
|
unicode-display_width (>= 2.4.0, < 3.0)
|
77
|
-
rubocop-ast (1.
|
78
|
-
parser (>= 3.
|
79
|
-
rubocop-capybara (2.
|
83
|
+
rubocop-ast (1.31.2)
|
84
|
+
parser (>= 3.3.0.4)
|
85
|
+
rubocop-capybara (2.20.0)
|
80
86
|
rubocop (~> 1.41)
|
81
87
|
rubocop-rake (0.6.0)
|
82
88
|
rubocop (~> 1.0)
|
83
89
|
rubocop-rspec (2.18.1)
|
84
90
|
rubocop (~> 1.33)
|
85
91
|
rubocop-capybara (~> 2.17)
|
86
|
-
ruby-progressbar (1.
|
92
|
+
ruby-progressbar (1.13.0)
|
87
93
|
simplecov (0.22.0)
|
88
94
|
docile (~> 1.1)
|
89
95
|
simplecov-html (~> 0.11)
|
@@ -92,9 +98,8 @@ GEM
|
|
92
98
|
simplecov_json_formatter (0.1.4)
|
93
99
|
stringio (3.1.0)
|
94
100
|
thor (1.2.2)
|
95
|
-
timecop (0.9.
|
96
|
-
unicode-display_width (2.
|
97
|
-
vcr (6.1.0)
|
101
|
+
timecop (0.9.8)
|
102
|
+
unicode-display_width (2.5.0)
|
98
103
|
webmock (3.18.1)
|
99
104
|
addressable (>= 2.8.0)
|
100
105
|
crack (>= 0.3.2)
|
@@ -109,12 +114,12 @@ DEPENDENCIES
|
|
109
114
|
overcommit (~> 0.60.0)
|
110
115
|
rake (~> 13.0)
|
111
116
|
rspec (~> 3.12.0)
|
117
|
+
rspec-retry (~> 0.6.2)
|
112
118
|
rubocop (~> 1.45.0)
|
113
119
|
rubocop-rake (~> 0.6.0)
|
114
120
|
rubocop-rspec (~> 2.18.1)
|
115
121
|
simplecov (~> 0.22.0)
|
116
122
|
timecop (~> 0.9.6)
|
117
|
-
vcr (~> 6.1.0)
|
118
123
|
webmock (~> 3.18.1)
|
119
124
|
|
120
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://
|
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
|
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
|
-
│ ├─
|
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/
|
158
|
-
5. `templates/rails.yml` defines your Rails workload. It may inherit ENV values from the parent GVC, which is populated from the `templates/
|
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,39 +183,52 @@ 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`, `
|
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
|
192
|
+
# instead of `cpl apply-template app redis postgres memcached rails sidekiq`.
|
193
193
|
#
|
194
194
|
# Note:
|
195
195
|
# 1. These names correspond to files in the `./controlplane/templates` directory.
|
196
196
|
# 2. Each file can contain many objects, such as in the case of templates that create a resource, like `postgres`.
|
197
197
|
# 3. While the naming often corresponds to a workload or other object name, the naming is arbitrary.
|
198
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`
|
199
202
|
setup_app_templates:
|
200
|
-
-
|
201
|
-
|
202
|
-
# These templates are only required if using secrets.
|
203
|
-
- identity
|
204
|
-
- secrets
|
205
|
-
- secrets-policy
|
206
|
-
|
203
|
+
- app
|
207
204
|
- redis
|
208
205
|
- postgres
|
209
206
|
- memcached
|
210
207
|
- rails
|
211
208
|
- sidekiq
|
212
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
|
+
|
213
226
|
# Configure the workload name used as a template for one-off scripts, like a Heroku one-off dyno.
|
214
227
|
one_off_workload: rails
|
215
228
|
|
216
229
|
# Workloads that are for the application itself and are using application Docker images.
|
217
230
|
# These are updated with the new image when running the `deploy-image` command,
|
218
|
-
# and are also used by the `info
|
231
|
+
# and are also used by the `info` and `ps:` commands in order to get all of the defined workloads.
|
219
232
|
# On the other hand, if you have a workload for Redis, that would NOT use the application Docker image
|
220
233
|
# and not be listed here.
|
221
234
|
app_workloads:
|
@@ -223,7 +236,7 @@ aliases:
|
|
223
236
|
- sidekiq
|
224
237
|
|
225
238
|
# Additional "service type" workloads, using non-application Docker images.
|
226
|
-
# These are only used by the `info
|
239
|
+
# These are only used by the `info` and `ps:` commands in order to get all of the defined workloads.
|
227
240
|
additional_workloads:
|
228
241
|
- redis
|
229
242
|
- postgres
|
@@ -233,7 +246,7 @@ aliases:
|
|
233
246
|
maintenance_workload: maintenance
|
234
247
|
|
235
248
|
# Fixes the remote terminal size to match the local terminal size
|
236
|
-
# when running
|
249
|
+
# when running `cpl run`.
|
237
250
|
fix_terminal_size: true
|
238
251
|
|
239
252
|
# Apps with a deployed image created before this amount of days will be listed for deletion
|
@@ -248,10 +261,6 @@ aliases:
|
|
248
261
|
# when running the command `cpl cleanup-images` (`image_retention_max_qty` takes precedence).
|
249
262
|
image_retention_days: 5
|
250
263
|
|
251
|
-
# Run workloads created before this amount of days will be listed for deletion
|
252
|
-
# when running the command `cpl run:cleanup`.
|
253
|
-
stale_run_workload_created_days: 2
|
254
|
-
|
255
264
|
apps:
|
256
265
|
my-app-staging:
|
257
266
|
# Use the values from the common section above.
|
@@ -307,7 +316,7 @@ Suppose your app is called `tutorial-app`. You can run the following commands.
|
|
307
316
|
```sh
|
308
317
|
# Provision all infrastructure on Control Plane.
|
309
318
|
# `tutorial-app` will be created per definition in .controlplane/controlplane.yml.
|
310
|
-
cpl apply-template
|
319
|
+
cpl apply-template app postgres redis rails daily-task -a tutorial-app
|
311
320
|
|
312
321
|
# Build and push the Docker image to the Control Plane repository.
|
313
322
|
# Note, it may take many minutes. Be patient.
|
@@ -336,7 +345,7 @@ cpl build-image -a tutorial-app
|
|
336
345
|
# Run database migrations (or other release tasks) with the latest image,
|
337
346
|
# while the app is still running on the previous image.
|
338
347
|
# This is analogous to the release phase.
|
339
|
-
cpl run
|
348
|
+
cpl run -a tutorial-app --image latest -- rails db:migrate
|
340
349
|
|
341
350
|
# Pomote the latest image to the app.
|
342
351
|
cpl deploy-image -a tutorial-app
|
@@ -374,7 +383,7 @@ It is also possible to set up a Secret store (of type `Dictionary`), which we ca
|
|
374
383
|
`cpln://secret/MY_SECRET_STORE_NAME/MY_SECRET_VAR_NAME`. In such a case, we must set up an app Identity and proper
|
375
384
|
Policy to access the secret.
|
376
385
|
|
377
|
-
In `templates/
|
386
|
+
In `templates/app.yml`:
|
378
387
|
|
379
388
|
```yaml
|
380
389
|
spec:
|
@@ -446,7 +455,7 @@ development purposes.
|
|
446
455
|
|
447
456
|
## Scheduled Jobs
|
448
457
|
|
449
|
-
Control Plane supports scheduled jobs via [cron workloads](https://
|
458
|
+
Control Plane supports scheduled jobs via [cron workloads](https://shakadocs.controlplane.com/reference/workload#cron).
|
450
459
|
|
451
460
|
Here's a partial example of a template for a cron workload, using the app image:
|
452
461
|
|
data/cpl.gemspec
CHANGED
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_development_dependency "overcommit", "~> 0.60.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.12.0"
|
26
|
+
spec.add_development_dependency "rspec-retry", "~> 0.6.2"
|
26
27
|
spec.add_development_dependency "rubocop", "~> 1.45.0"
|
27
28
|
spec.add_development_dependency "rubocop-rake", "~> 0.6.0"
|
28
29
|
spec.add_development_dependency "rubocop-rspec", "~> 2.18.1"
|
29
30
|
spec.add_development_dependency "simplecov", "~> 0.22.0"
|
30
31
|
spec.add_development_dependency "timecop", "~> 0.9.6"
|
31
|
-
spec.add_development_dependency "vcr", "~> 6.1.0"
|
32
32
|
spec.add_development_dependency "webmock", "~> 3.18.1"
|
33
33
|
|
34
34
|
spec.files = `git ls-files -z`.split("\x0").reject do |file|
|