cpflow 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/check_cpln_links.yml +19 -0
- data/.github/workflows/command_docs.yml +24 -0
- data/.github/workflows/rspec-shared.yml +56 -0
- data/.github/workflows/rspec.yml +28 -0
- data/.github/workflows/rubocop.yml +24 -0
- data/.gitignore +18 -0
- data/.overcommit.yml +16 -0
- data/.rubocop.yml +22 -0
- data/.simplecov_spawn.rb +10 -0
- data/CHANGELOG.md +259 -0
- data/CONTRIBUTING.md +73 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +126 -0
- data/LICENSE +21 -0
- data/README.md +546 -0
- data/Rakefile +21 -0
- data/bin/cpflow +6 -0
- data/cpflow +6 -0
- data/cpflow.gemspec +41 -0
- data/docs/assets/grafana-alert.png +0 -0
- data/docs/assets/memcached.png +0 -0
- data/docs/assets/sidekiq-pre-stop-hook.png +0 -0
- data/docs/commands.md +454 -0
- data/docs/dns.md +15 -0
- data/docs/migrating.md +262 -0
- data/docs/postgres.md +436 -0
- data/docs/redis.md +128 -0
- data/docs/secrets-and-env-values.md +42 -0
- data/docs/tips.md +150 -0
- data/docs/troubleshooting.md +6 -0
- data/examples/circleci.yml +104 -0
- data/examples/controlplane.yml +159 -0
- data/lib/command/apply_template.rb +209 -0
- data/lib/command/base.rb +540 -0
- data/lib/command/build_image.rb +49 -0
- data/lib/command/cleanup_images.rb +136 -0
- data/lib/command/cleanup_stale_apps.rb +79 -0
- data/lib/command/config.rb +48 -0
- data/lib/command/copy_image_from_upstream.rb +108 -0
- data/lib/command/delete.rb +149 -0
- data/lib/command/deploy_image.rb +56 -0
- data/lib/command/doctor.rb +47 -0
- data/lib/command/env.rb +22 -0
- data/lib/command/exists.rb +23 -0
- data/lib/command/generate.rb +45 -0
- data/lib/command/info.rb +222 -0
- data/lib/command/latest_image.rb +19 -0
- data/lib/command/logs.rb +49 -0
- data/lib/command/maintenance.rb +42 -0
- data/lib/command/maintenance_off.rb +62 -0
- data/lib/command/maintenance_on.rb +62 -0
- data/lib/command/maintenance_set_page.rb +34 -0
- data/lib/command/no_command.rb +23 -0
- data/lib/command/open.rb +33 -0
- data/lib/command/open_console.rb +26 -0
- data/lib/command/promote_app_from_upstream.rb +38 -0
- data/lib/command/ps.rb +41 -0
- data/lib/command/ps_restart.rb +37 -0
- data/lib/command/ps_start.rb +51 -0
- data/lib/command/ps_stop.rb +82 -0
- data/lib/command/ps_wait.rb +40 -0
- data/lib/command/run.rb +573 -0
- data/lib/command/setup_app.rb +113 -0
- data/lib/command/test.rb +23 -0
- data/lib/command/version.rb +18 -0
- data/lib/constants/exit_code.rb +7 -0
- data/lib/core/config.rb +316 -0
- data/lib/core/controlplane.rb +552 -0
- data/lib/core/controlplane_api.rb +170 -0
- data/lib/core/controlplane_api_direct.rb +112 -0
- data/lib/core/doctor_service.rb +104 -0
- data/lib/core/helpers.rb +26 -0
- data/lib/core/shell.rb +100 -0
- data/lib/core/template_parser.rb +76 -0
- data/lib/cpflow/version.rb +6 -0
- data/lib/cpflow.rb +288 -0
- data/lib/deprecated_commands.json +9 -0
- data/lib/generator_templates/Dockerfile +27 -0
- data/lib/generator_templates/controlplane.yml +62 -0
- data/lib/generator_templates/entrypoint.sh +8 -0
- data/lib/generator_templates/templates/app.yml +21 -0
- data/lib/generator_templates/templates/postgres.yml +176 -0
- data/lib/generator_templates/templates/rails.yml +36 -0
- data/rakelib/create_release.rake +81 -0
- data/script/add_command +37 -0
- data/script/check_command_docs +3 -0
- data/script/check_cpln_links +45 -0
- data/script/rename_command +43 -0
- data/script/update_command_docs +62 -0
- data/templates/app.yml +13 -0
- data/templates/daily-task.yml +32 -0
- data/templates/maintenance.yml +25 -0
- data/templates/memcached.yml +24 -0
- data/templates/postgres.yml +32 -0
- data/templates/rails.yml +27 -0
- data/templates/redis.yml +21 -0
- data/templates/redis2.yml +37 -0
- data/templates/sidekiq.yml +38 -0
- metadata +341 -0
data/docs/commands.md
ADDED
@@ -0,0 +1,454 @@
|
|
1
|
+
<!-- NOTE: This file is automatically generated by running `script/generate_commands_docs`. Do NOT edit it manually. -->
|
2
|
+
|
3
|
+
## Common Options
|
4
|
+
|
5
|
+
```
|
6
|
+
-a XXX, --app XXX app ref on Control Plane (GVC)
|
7
|
+
```
|
8
|
+
|
9
|
+
This `-a` option is used in most of the commands and will pick all other app configurations from the project-specific
|
10
|
+
`.controlplane/controlplane.yml` file.
|
11
|
+
|
12
|
+
## Commands
|
13
|
+
|
14
|
+
### `apply-template`
|
15
|
+
|
16
|
+
- Applies application-specific configs from templates (e.g., for every review-app)
|
17
|
+
- Publishes (creates or updates) those at Control Plane infrastructure
|
18
|
+
- Picks templates from the `.controlplane/templates` directory
|
19
|
+
- Templates are ordinary Control Plane templates but with variable preprocessing
|
20
|
+
|
21
|
+
**Preprocessed template variables:**
|
22
|
+
|
23
|
+
```
|
24
|
+
{{APP_ORG}} - organization name
|
25
|
+
{{APP_NAME}} - GVC/app name
|
26
|
+
{{APP_LOCATION}} - location, per YML file, ENV, or command line arg
|
27
|
+
{{APP_LOCATION_LINK}} - full link for location, ready to be used for the value of `staticPlacement.locationLinks` in the templates
|
28
|
+
{{APP_IMAGE}} - latest app image
|
29
|
+
{{APP_IMAGE_LINK}} - full link for latest app image, ready to be used for the value of `containers[].image` in the templates
|
30
|
+
{{APP_IDENTITY}} - default identity
|
31
|
+
{{APP_IDENTITY_LINK}} - full link for identity, ready to be used for the value of `identityLink` in the templates
|
32
|
+
```
|
33
|
+
|
34
|
+
```sh
|
35
|
+
# Applies single template.
|
36
|
+
cpflow apply-template redis -a $APP_NAME
|
37
|
+
|
38
|
+
# Applies several templates (practically creating full app).
|
39
|
+
cpflow apply-template app postgres redis rails -a $APP_NAME
|
40
|
+
```
|
41
|
+
|
42
|
+
### `build-image`
|
43
|
+
|
44
|
+
- Builds and pushes the image to Control Plane
|
45
|
+
- Automatically assigns image numbers, e.g., `app:1`, `app:2`, etc.
|
46
|
+
- Uses `.controlplane/Dockerfile` or a different Dockerfile specified through `dockerfile` in the `.controlplane/controlplane.yml` file
|
47
|
+
- If a commit is provided through `--commit` or `-c`, it will be set as the runtime env var `GIT_COMMIT`
|
48
|
+
- Accepts extra options that are passed to `docker build`
|
49
|
+
|
50
|
+
```sh
|
51
|
+
cpflow build-image -a $APP_NAME
|
52
|
+
```
|
53
|
+
|
54
|
+
### `cleanup-images`
|
55
|
+
|
56
|
+
- Deletes all images for an app that either exceed the max quantity or are older than the specified amount of days
|
57
|
+
- Specify the max quantity through `image_retention_max_qty` in the `.controlplane/controlplane.yml` file
|
58
|
+
- Specify the amount of days through `image_retention_days` in the `.controlplane/controlplane.yml` file
|
59
|
+
- If `image_retention_max_qty` is specified, any images that exceed it will be deleted, regardless of `image_retention_days`
|
60
|
+
- Will ask for explicit user confirmation
|
61
|
+
- Never deletes the latest image
|
62
|
+
|
63
|
+
```sh
|
64
|
+
cpflow cleanup-images -a $APP_NAME
|
65
|
+
```
|
66
|
+
|
67
|
+
### `cleanup-stale-apps`
|
68
|
+
|
69
|
+
- Deletes the whole app (GVC with all workloads, all volumesets and all images) for all stale apps
|
70
|
+
- Also unbinds the app from the secrets policy, as long as both the identity and the policy exist (and are bound)
|
71
|
+
- Stale apps are identified based on the creation date of the latest image
|
72
|
+
- Specify the amount of days after an app should be considered stale through `stale_app_image_deployed_days` in the `.controlplane/controlplane.yml` file
|
73
|
+
- If `match_if_app_name_starts_with` is `true` in the `.controlplane/controlplane.yml` file, it will delete all stale apps that start with the name
|
74
|
+
- Will ask for explicit user confirmation
|
75
|
+
|
76
|
+
```sh
|
77
|
+
cpflow cleanup-stale-apps -a $APP_NAME
|
78
|
+
```
|
79
|
+
|
80
|
+
### `config`
|
81
|
+
|
82
|
+
- Displays config for each app or a specific app
|
83
|
+
|
84
|
+
```sh
|
85
|
+
# Shows the config for each app.
|
86
|
+
cpflow config
|
87
|
+
|
88
|
+
# Shows the config for a specific app.
|
89
|
+
cpflow config -a $APP_NAME
|
90
|
+
```
|
91
|
+
|
92
|
+
### `copy-image-from-upstream`
|
93
|
+
|
94
|
+
- Copies an image (by default the latest) from a source org to the current org
|
95
|
+
- The source app must be specified either through the `CPLN_UPSTREAM` env var or `upstream` in the `.controlplane/controlplane.yml` file
|
96
|
+
- Additionally, the token for the source org must be provided through `--upstream-token` or `-t`
|
97
|
+
- A `cpln` profile will be temporarily created to pull the image from the source org
|
98
|
+
|
99
|
+
```sh
|
100
|
+
# Copies the latest image from the source org to the current org.
|
101
|
+
cpflow copy-image-from-upstream -a $APP_NAME --upstream-token $UPSTREAM_TOKEN
|
102
|
+
|
103
|
+
# Copies a specific image from the source org to the current org.
|
104
|
+
cpflow copy-image-from-upstream -a $APP_NAME --upstream-token $UPSTREAM_TOKEN --image appimage:123
|
105
|
+
```
|
106
|
+
|
107
|
+
### `delete`
|
108
|
+
|
109
|
+
- Deletes the whole app (GVC with all workloads, all volumesets and all images) or a specific workload
|
110
|
+
- Also unbinds the app from the secrets policy, as long as both the identity and the policy exist (and are bound)
|
111
|
+
- Will ask for explicit user confirmation
|
112
|
+
- Runs a pre-deletion hook before the app is deleted if `hooks.pre_deletion` is specified in the `.controlplane/controlplane.yml` file
|
113
|
+
- If the hook exits with a non-zero code, the command will stop executing and also exit with a non-zero code
|
114
|
+
- Use `--skip-pre-deletion-hook` to skip the hook if specified in `controlplane.yml`
|
115
|
+
|
116
|
+
```sh
|
117
|
+
# Deletes the whole app (GVC with all workloads, all volumesets and all images).
|
118
|
+
cpflow delete -a $APP_NAME
|
119
|
+
|
120
|
+
# Deletes a specific workload.
|
121
|
+
cpflow delete -a $APP_NAME -w $WORKLOAD_NAME
|
122
|
+
```
|
123
|
+
|
124
|
+
### `deploy-image`
|
125
|
+
|
126
|
+
- Deploys the latest image to app workloads
|
127
|
+
- Runs a release script before deploying if `release_script` is specified in the `.controlplane/controlplane.yml` file and `--run-release-phase` is provided
|
128
|
+
- The release script is run in the context of `cpflow run` with the latest image
|
129
|
+
- If the release script exits with a non-zero code, the command will stop executing and also exit with a non-zero code
|
130
|
+
|
131
|
+
```sh
|
132
|
+
cpflow deploy-image -a $APP_NAME
|
133
|
+
```
|
134
|
+
|
135
|
+
### `doctor`
|
136
|
+
|
137
|
+
- Runs validations
|
138
|
+
|
139
|
+
```sh
|
140
|
+
# Runs all validations that don't require additional options by default.
|
141
|
+
cpflow doctor
|
142
|
+
|
143
|
+
# Runs config validation.
|
144
|
+
cpflow doctor --validations config
|
145
|
+
|
146
|
+
# Runs templates validation (requires app).
|
147
|
+
cpflow doctor --validations templates -a $APP_NAME
|
148
|
+
```
|
149
|
+
|
150
|
+
### `env`
|
151
|
+
|
152
|
+
- Displays app-specific environment variables
|
153
|
+
|
154
|
+
```sh
|
155
|
+
cpflow env -a $APP_NAME
|
156
|
+
```
|
157
|
+
|
158
|
+
### `exists`
|
159
|
+
|
160
|
+
- Shell-checks if an application (GVC) exists, useful in scripts, e.g.:
|
161
|
+
|
162
|
+
```sh
|
163
|
+
if [ cpflow exists -a $APP_NAME ]; ...
|
164
|
+
```
|
165
|
+
|
166
|
+
### `generate`
|
167
|
+
|
168
|
+
Creates base Control Plane config and template files
|
169
|
+
|
170
|
+
```sh
|
171
|
+
# Creates .controlplane directory with Control Plane config and other templates
|
172
|
+
cpflow generate
|
173
|
+
```
|
174
|
+
|
175
|
+
### `info`
|
176
|
+
|
177
|
+
- Displays the diff between defined/available apps/workloads (apps equal GVCs)
|
178
|
+
- Apps that are defined but not available are displayed in red
|
179
|
+
- Apps that are available but not defined are displayed in green
|
180
|
+
- Apps that are both defined and available are displayed in white
|
181
|
+
- The diff is based on what's defined in the `.controlplane/controlplane.yml` file
|
182
|
+
|
183
|
+
```sh
|
184
|
+
# Shows diff for all apps in all orgs (based on `.controlplane/controlplane.yml`).
|
185
|
+
cpflow info
|
186
|
+
|
187
|
+
# Shows diff for all apps in a specific org.
|
188
|
+
cpflow info -o $ORG_NAME
|
189
|
+
|
190
|
+
# Shows diff for a specific app.
|
191
|
+
cpflow info -a $APP_NAME
|
192
|
+
```
|
193
|
+
|
194
|
+
### `latest-image`
|
195
|
+
|
196
|
+
- Displays the latest image name
|
197
|
+
|
198
|
+
```sh
|
199
|
+
cpflow latest-image -a $APP_NAME
|
200
|
+
```
|
201
|
+
|
202
|
+
### `logs`
|
203
|
+
|
204
|
+
- Light wrapper to display tailed raw logs for app/workload syntax
|
205
|
+
- Defaults to showing the last 200 entries from the past 1 hour before tailing
|
206
|
+
|
207
|
+
```sh
|
208
|
+
# Displays logs for the default workload (`one_off_workload`).
|
209
|
+
cpflow logs -a $APP_NAME
|
210
|
+
|
211
|
+
# Displays logs for a specific workload.
|
212
|
+
cpflow logs -a $APP_NAME -w $WORKLOAD_NAME
|
213
|
+
|
214
|
+
# Displays logs for a specific replica of a workload.
|
215
|
+
cpflow logs -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
|
216
|
+
|
217
|
+
# Uses a different limit on number of entries.
|
218
|
+
cpflow logs -a $APP_NAME --limit 100
|
219
|
+
|
220
|
+
# Uses a different loopback window.
|
221
|
+
cpflow logs -a $APP_NAME --since 30min
|
222
|
+
```
|
223
|
+
|
224
|
+
### `maintenance`
|
225
|
+
|
226
|
+
- Checks if maintenance mode is on or off for an app
|
227
|
+
- Outputs 'on' or 'off'
|
228
|
+
- Specify the one-off workload through `one_off_workload` in the `.controlplane/controlplane.yml` file
|
229
|
+
- Optionally specify the maintenance workload through `maintenance_workload` in the `.controlplane/controlplane.yml` file (defaults to 'maintenance')
|
230
|
+
- Maintenance mode is only supported for domains that use path based routing mode and have a route configured for the prefix '/' on either port 80 or 443
|
231
|
+
|
232
|
+
```sh
|
233
|
+
cpflow maintenance -a $APP_NAME
|
234
|
+
```
|
235
|
+
|
236
|
+
### `maintenance:off`
|
237
|
+
|
238
|
+
- Disables maintenance mode for an app
|
239
|
+
- Specify the one-off workload through `one_off_workload` in the `.controlplane/controlplane.yml` file
|
240
|
+
- Optionally specify the maintenance workload through `maintenance_workload` in the `.controlplane/controlplane.yml` file (defaults to 'maintenance')
|
241
|
+
- Maintenance mode is only supported for domains that use path based routing mode and have a route configured for the prefix '/' on either port 80 or 443
|
242
|
+
|
243
|
+
```sh
|
244
|
+
cpflow maintenance:off -a $APP_NAME
|
245
|
+
```
|
246
|
+
|
247
|
+
### `maintenance:on`
|
248
|
+
|
249
|
+
- Enables maintenance mode for an app
|
250
|
+
- Specify the one-off workload through `one_off_workload` in the `.controlplane/controlplane.yml` file
|
251
|
+
- Optionally specify the maintenance workload through `maintenance_workload` in the `.controlplane/controlplane.yml` file (defaults to 'maintenance')
|
252
|
+
- Maintenance mode is only supported for domains that use path based routing mode and have a route configured for the prefix '/' on either port 80 or 443
|
253
|
+
|
254
|
+
```sh
|
255
|
+
cpflow maintenance:on -a $APP_NAME
|
256
|
+
```
|
257
|
+
|
258
|
+
### `maintenance:set-page`
|
259
|
+
|
260
|
+
- Sets the page for maintenance mode
|
261
|
+
- Only works if the maintenance workload uses the `shakacode/maintenance-mode` image
|
262
|
+
- Will set the URL as an env var `PAGE_URL` on the maintenance workload
|
263
|
+
- Optionally specify the maintenance workload through `maintenance_workload` in the `.controlplane/controlplane.yml` file (defaults to 'maintenance')
|
264
|
+
|
265
|
+
```sh
|
266
|
+
cpflow maintenance:set-page PAGE_URL -a $APP_NAME
|
267
|
+
```
|
268
|
+
|
269
|
+
### `open`
|
270
|
+
|
271
|
+
- Opens the app endpoint URL in the default browser
|
272
|
+
|
273
|
+
```sh
|
274
|
+
# Opens the endpoint of the default workload (`one_off_workload`).
|
275
|
+
cpflow open -a $APP_NAME
|
276
|
+
|
277
|
+
# Opens the endpoint of a specific workload.
|
278
|
+
cpflow open -a $APP_NAME -w $WORKLOAD_NAME
|
279
|
+
```
|
280
|
+
|
281
|
+
### `open-console`
|
282
|
+
|
283
|
+
- Opens the app console on Control Plane in the default browser
|
284
|
+
- Can also go directly to a workload page if `--workload` is provided
|
285
|
+
|
286
|
+
```sh
|
287
|
+
cpflow open-console -a $APP_NAME
|
288
|
+
```
|
289
|
+
|
290
|
+
### `promote-app-from-upstream`
|
291
|
+
|
292
|
+
- Copies the latest image from upstream, runs a release script (optional), and deploys the image
|
293
|
+
- It performs the following steps:
|
294
|
+
- Runs `cpflow copy-image-from-upstream` to copy the latest image from upstream
|
295
|
+
- Runs `cpflow deploy-image` to deploy the image
|
296
|
+
- If `.controlplane/controlplane.yml` includes the `release_script`, `cpflow deploy-image` will use the `--run-release-phase` option
|
297
|
+
- If the release script exits with a non-zero code, the command will stop executing and also exit with a non-zero code
|
298
|
+
|
299
|
+
```sh
|
300
|
+
cpflow promote-app-from-upstream -a $APP_NAME -t $UPSTREAM_TOKEN
|
301
|
+
```
|
302
|
+
|
303
|
+
### `ps`
|
304
|
+
|
305
|
+
- Shows running replicas in app
|
306
|
+
|
307
|
+
```sh
|
308
|
+
# Shows running replicas in app, for all workloads.
|
309
|
+
cpflow ps -a $APP_NAME
|
310
|
+
|
311
|
+
# Shows running replicas in app, for a specific workload.
|
312
|
+
cpflow ps -a $APP_NAME -w $WORKLOAD_NAME
|
313
|
+
```
|
314
|
+
|
315
|
+
### `ps:restart`
|
316
|
+
|
317
|
+
- Forces redeploy of workloads in app
|
318
|
+
|
319
|
+
```sh
|
320
|
+
# Forces redeploy of all workloads in app.
|
321
|
+
cpflow ps:restart -a $APP_NAME
|
322
|
+
|
323
|
+
# Forces redeploy of a specific workload in app.
|
324
|
+
cpflow ps:restart -a $APP_NAME -w $WORKLOAD_NAME
|
325
|
+
```
|
326
|
+
|
327
|
+
### `ps:start`
|
328
|
+
|
329
|
+
- Starts workloads in app
|
330
|
+
|
331
|
+
```sh
|
332
|
+
# Starts all workloads in app.
|
333
|
+
cpflow ps:start -a $APP_NAME
|
334
|
+
|
335
|
+
# Starts a specific workload in app.
|
336
|
+
cpflow ps:start -a $APP_NAME -w $WORKLOAD_NAME
|
337
|
+
```
|
338
|
+
|
339
|
+
### `ps:stop`
|
340
|
+
|
341
|
+
- Stops workloads in app
|
342
|
+
|
343
|
+
```sh
|
344
|
+
# Stops all workloads in app.
|
345
|
+
cpflow ps:stop -a $APP_NAME
|
346
|
+
|
347
|
+
# Stops a specific workload in app.
|
348
|
+
cpflow ps:stop -a $APP_NAME -w $WORKLOAD_NAME
|
349
|
+
|
350
|
+
# Stops a specific replica of a workload.
|
351
|
+
cpflow ps:stop -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
|
352
|
+
```
|
353
|
+
|
354
|
+
### `ps:wait`
|
355
|
+
|
356
|
+
- Waits for workloads in app to be ready after re-deployment
|
357
|
+
|
358
|
+
```sh
|
359
|
+
# Waits for all workloads in app.
|
360
|
+
cpflow ps:wait -a $APP_NAME
|
361
|
+
|
362
|
+
# Waits for a specific workload in app.
|
363
|
+
cpflow ps:swait -a $APP_NAME -w $WORKLOAD_NAME
|
364
|
+
```
|
365
|
+
|
366
|
+
### `run`
|
367
|
+
|
368
|
+
- Runs one-off interactive or non-interactive replicas (analog of `heroku run`)
|
369
|
+
- Uses `Cron` workload type and either:
|
370
|
+
- - `cpln workload exec` for interactive mode, with CLI streaming
|
371
|
+
- - log async fetching for non-interactive mode
|
372
|
+
- The Dockerfile entrypoint is used as the command by default, which assumes `exec "${@}"` to be present,
|
373
|
+
and the args ["bash", "-c", cmd_to_run] are passed
|
374
|
+
- The entrypoint can be overridden through `--entrypoint`, which must be a single command or a script path that exists in the container,
|
375
|
+
and the args ["bash", "-c", cmd_to_run] are passed,
|
376
|
+
unless the entrypoint is `bash`, in which case the args ["-c", cmd_to_run] are passed
|
377
|
+
- Providing `--entrypoint none` sets the entrypoint to `bash` by default
|
378
|
+
- If `fix_terminal_size` is `true` in the `.controlplane/controlplane.yml` file,
|
379
|
+
the remote terminal size will be fixed to match the local terminal size (may also be overridden through `--terminal-size`)
|
380
|
+
- By default, all jobs use a CPU size of 1 (1 core) and a memory size of 2Gi (2 gibibytes)
|
381
|
+
(can be configured through `runner_job_default_cpu` and `runner_job_default_memory` in `controlplane.yml`,
|
382
|
+
and also overridden per job through `--cpu` and `--memory`)
|
383
|
+
- By default, the job is stopped if it takes longer than 6 hours to finish
|
384
|
+
(can be configured though `runner_job_timeout` in `controlplane.yml`)
|
385
|
+
|
386
|
+
```sh
|
387
|
+
# Opens shell (bash by default).
|
388
|
+
cpflow run -a $APP_NAME
|
389
|
+
|
390
|
+
# Runs interactive command, keeps shell open, and stops job when exiting.
|
391
|
+
cpflow run -a $APP_NAME --interactive -- rails c
|
392
|
+
|
393
|
+
# Some commands are automatically detected as interactive, so no need to pass `--interactive`.
|
394
|
+
cpflow run -a $APP_NAME -- bash
|
395
|
+
cpflow run -a $APP_NAME -- rails console
|
396
|
+
cpflow run -a $APP_NAME -- rails c
|
397
|
+
cpflow run -a $APP_NAME -- rails dbconsole
|
398
|
+
cpflow run -a $APP_NAME -- rails db
|
399
|
+
|
400
|
+
# Runs non-interactive command, outputs logs, exits with the exit code of the command and stops job.
|
401
|
+
cpflow run -a $APP_NAME -- rails db:migrate
|
402
|
+
|
403
|
+
# Runs non-iteractive command, detaches, exits with 0, and prints commands to:
|
404
|
+
# - see logs from the job
|
405
|
+
# - stop the job
|
406
|
+
cpflow run -a $APP_NAME --detached -- rails db:migrate
|
407
|
+
|
408
|
+
# The command needs to be quoted if setting an env variable or passing args.
|
409
|
+
cpflow run -a $APP_NAME -- 'SOME_ENV_VAR=some_value rails db:migrate'
|
410
|
+
|
411
|
+
# Uses a different image (which may not be promoted yet).
|
412
|
+
cpflow run -a $APP_NAME --image appimage:123 -- rails db:migrate # Exact image name
|
413
|
+
cpflow run -a $APP_NAME --image latest -- rails db:migrate # Latest sequential image
|
414
|
+
|
415
|
+
# Uses a different workload than `one_off_workload` from `.controlplane/controlplane.yml`.
|
416
|
+
cpflow run -a $APP_NAME -w other-workload -- bash
|
417
|
+
|
418
|
+
# Overrides remote CPLN_TOKEN env variable with local token.
|
419
|
+
# Useful when superuser rights are needed in remote container.
|
420
|
+
cpflow run -a $APP_NAME --use-local-token -- bash
|
421
|
+
|
422
|
+
# Replaces the existing Dockerfile entrypoint with `bash`.
|
423
|
+
cpflow run -a $APP_NAME --entrypoint none -- rails db:migrate
|
424
|
+
|
425
|
+
# Replaces the existing Dockerfile entrypoint.
|
426
|
+
cpflow run -a $APP_NAME --entrypoint /app/alternative-entrypoint.sh -- rails db:migrate
|
427
|
+
```
|
428
|
+
|
429
|
+
### `setup-app`
|
430
|
+
|
431
|
+
- Creates an app and all its workloads
|
432
|
+
- Specify the templates for the app and workloads through `setup_app_templates` in the `.controlplane/controlplane.yml` file
|
433
|
+
- This should only be used for temporary apps like review apps, never for persistent apps like production or staging (to update workloads for those, use 'cpflow apply-template' instead)
|
434
|
+
- Configures app to have org-level secrets with default name "{APP_PREFIX}-secrets"
|
435
|
+
using org-level policy with default name "{APP_PREFIX}-secrets-policy" (names can be customized, see docs)
|
436
|
+
- Creates identity for secrets if it does not exist
|
437
|
+
- Use `--skip-secrets-setup` to prevent the automatic setup of secrets,
|
438
|
+
or set it through `skip_secrets_setup` in the `.controlplane/controlplane.yml` file
|
439
|
+
- Runs a post-creation hook after the app is created if `hooks.post_creation` is specified in the `.controlplane/controlplane.yml` file
|
440
|
+
- If the hook exits with a non-zero code, the command will stop executing and also exit with a non-zero code
|
441
|
+
- Use `--skip-post-creation-hook` to skip the hook if specified in `controlplane.yml`
|
442
|
+
|
443
|
+
```sh
|
444
|
+
cpflow setup-app -a $APP_NAME
|
445
|
+
```
|
446
|
+
|
447
|
+
### `version`
|
448
|
+
|
449
|
+
- Displays the current version of the CLI
|
450
|
+
- Can also be done with `cpflow --version` or `cpflow -v`
|
451
|
+
|
452
|
+
```sh
|
453
|
+
cpflow version
|
454
|
+
```
|
data/docs/dns.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# DNS Setup Example
|
2
|
+
|
3
|
+
## Docs
|
4
|
+
|
5
|
+
https://shakadocs.controlplane.com/guides/configure-domain#dns-records
|
6
|
+
|
7
|
+
## Example
|
8
|
+
|
9
|
+
About reactrails.com DNS, steps:
|
10
|
+
1. create CNAME or ALIAS record pointing to rails-xxxx.cpln.app
|
11
|
+
1. go to CPLN Domains -> create
|
12
|
+
1. add reactrails.com copy code from there
|
13
|
+
1. add TXT record with code as _cpln.reactrails.com
|
14
|
+
1. hit ok on CPLN, route to rails workload when asked
|
15
|
+
1. wait domain check and certificates created
|