README.md in cpl-0.6.0 vs README.md in cpl-0.7.0
- old
+ new
@@ -26,15 +26,16 @@
4. [Example CLI flow for application build/deployment](#example-cli-flow-for-application-builddeployment)
5. [Example project modifications for Control Plane](#example-project-modifications-for-control-plane)
6. [Environment](#environment)
7. [Database](#database)
8. [In-memory databases](#in-memory-databases)
-9. [CLI commands reference](#cli-commands-reference)
-10. [Mapping of Heroku Commands to `cpl` and `cpln`](#mapping-of-heroku-commands-to-cpl-and-cpln)
-11. [Examples](#examples)
-12. [Migrating Postgres database from Heroku infrastructure](/docs/postgres.md)
-13. [Migrating Redis database from Heroku infrastructure](/docs/redis.md)
+9. [Scheduled jobs](#scheduled-jobs)
+10. [CLI commands reference](#cli-commands-reference)
+11. [Mapping of Heroku Commands to `cpl` and `cpln`](#mapping-of-heroku-commands-to-cpl-and-cpln)
+12. [Examples](#examples)
+13. [Migrating Postgres database from Heroku infrastructure](/docs/postgres.md)
+14. [Migrating Redis database from Heroku infrastructure](/docs/redis.md)
## Key features
- A `cpl` command to complement the default Control Plane `cpln` command with "Heroku style scripting." The Ruby source can serve as inspiration for your own scripts.
- Easy to understand Heroku to Control Plane conventions in setup and naming.
@@ -103,18 +104,32 @@
## Example CLI flow for application build/deployment
**Notes:**
1. `myapp` is an app name defined in the `.controlplane/controlplane.yml` file, such as `ror-tutorial` in [this `controlplane.yml` file](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/controlplane.yml).
-2. Other files in the `.controlplane/templates` directory are used by the `cpl setup` command.
+2. Other files in the `.controlplane/templates` directory are used by the `cpl setup-app` and `cpl apply-template` commands.
### Initial Setup and Deployment
+Before the initial setup, add the templates for the app to `.controlplane/controlplane.yml`, using the `setup` key:
+
+```yaml
+myapp:
+ setup:
+ - gvc
+ - postgres
+ - redis
+ - memcached
+ - rails
+ - sidekiq
+```
+
+Note how the templates correspond to files in the `.controlplane/templates` directory.
+
```sh
# Provision infrastructure (one-time-only for new apps) using templates.
-# Note how the arguments correspond to files in the `.controlplane/templates` directory.
-cpl setup gvc postgres redis memcached rails sidekiq -a myapp
+cpl setup-app -a myapp
# Build and push image with auto-tagging "myapp:1_456".
cpl build-image -a myapp --commit 456
# Prepare database.
@@ -212,11 +227,11 @@
match_if_app_name_starts_with: true
my-app-production:
<<: *common
# Use a different organization for production.
cpln_org: my-org-production
- # Allows running the command `cpl pipeline-promote my-app-staging` to promote the staging app to production.
+ # Allows running the command `cpl promote-app-from-upstream -a my-app-production` to promote the staging app to production.
upstream: my-app-staging
my-app-other:
<<: *common
# You can specify a different `Dockerfile` relative to the `.controlplane` directory (default is just "Dockerfile").
dockerfile: ../some_other/Dockerfile
@@ -311,10 +326,42 @@
For production purposes or where restarts are not an option, you should use external cloud services.
We provide default `redis` and `memcached` templates in this repo optimized for Control Plane and suitable
for development purposes.
+## Scheduled jobs
+
+Control Plane supports scheduled jobs via [cron workloads](https://docs.controlplane.com/reference/workload#cron).
+
+Here's a partial example of a template for a cron workload, using the app image:
+
+```yaml
+kind: workload
+name: daily-task
+spec:
+ type: cron
+ job:
+ # Run daily job at 2am
+ schedule: 0 2 * * *
+ # Never or OnFailure
+ restartPolicy: Never
+ containers:
+ - name: daily-task
+ args:
+ - bundle
+ - exec
+ - rails
+ - db:prepare
+ image: "/org/APP_ORG/image/APP_IMAGE"
+```
+
+A complete example can be found at [templates/daily-task.yml](templates/daily-task.yml), optimized for Control Plane and suitable for development purposes.
+
+You can create the cron workload by adding the template for it to the `.controlplane/templates` folder and running `cpl apply-template my-template -a my-app`, where `my-template` is the name of the template file (`my-template.yml`).
+
+Then to view the logs of the cron workload, you can run `cpl logs -a my-app -w my-template`.
+
## CLI commands reference:
Click [here](/docs/commands.md) to see the commands.
You can also run:
@@ -325,20 +372,20 @@
## Mapping of Heroku Commands to `cpl` and `cpln`
**`[WIP]`**
-| Heroku Command | `cpl` or `cpln` |
-| -------------------------------------------------------------------------------------------------------------- | --------------- |
-| [heroku ps](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-ps-type-type) | `cpl ps` |
-| [heroku config](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-config) | ? |
-| [heroku maintenance](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-maintenance) | ? |
-| [heroku logs](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-logs) | `cpl logs` |
-| [heroku pg](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pg-database) | ? |
-| [heroku pipelines:promote](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pipelines-promote) | `cpl promote` |
-| [heroku psql](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-psql-database) | ? |
-| [heroku redis](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-redis-database) | ? |
-| [heroku releases](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-releases) | ? |
+| Heroku Command | `cpl` or `cpln` |
+| -------------------------------------------------------------------------------------------------------------- | ------------------------------- |
+| [heroku ps](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-ps-type-type) | `cpl ps` |
+| [heroku config](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-config) | ? |
+| [heroku maintenance](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-maintenance) | `cpl maintenance` |
+| [heroku logs](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-logs) | `cpl logs` |
+| [heroku pg](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pg-database) | ? |
+| [heroku pipelines:promote](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pipelines-promote) | `cpl promote-app-from-upstream` |
+| [heroku psql](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-psql-database) | ? |
+| [heroku redis](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-redis-database) | ? |
+| [heroku releases](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-releases) | ? |
## Examples
1. See `examples/` and `templates/` folders of this repo.
2. See `.controlplane` directory of this live example: [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/tree/master/.controlplane)