Press Apps

Usage Examples

App Specs

Creating an App Spec

An app spec can be created by using existing block specs.

# app_spec.yaml

body:
  version: 1
  kind: app
  metadata:
    name: example-app
    title: Example App
    summary: Example App
    description: Creating a new app from CLI
    descriptionContentType: text/markdown
    imageUrl: https://my-block-pics.com/image-0.jpg
    tags:
      - name: CLI
  release:
    version: 1.0.0
    notes: This is the original release
  config:
    - id: existing_block_spec_id_1
      release:
        version: 1.0.0
    - id: existing_block_spec_id_2
      release:
        version: 1.0.0
featured: true
scope: shared
tenants:
  - tenant1
  - tenant2

To create the app spec, use the following command. Similar to blocks, if we have variable expression in our yaml file, we can utilize the defined parameters by including the path to app_params.yaml file.

peak apps specs create path/to/create_app_spec.yaml -v path/to/app_params.yaml

Updating App Spec Metadata

We can update the metadata and discoverability of an existing app spec by providing its id and the payload containg new metadata.

# app_spec_metadata.yaml

body:
  metadata:
    name: updated-app
    title: Updated App
    summary: Updated APP
    description: Updating app spec metadata
    descriptionContentType: text/markdown
    imageUrl: https://my-block-pics.com/image-0.jpg
    status: available
    tags:
      - name: CLI
  featured: false
  scope: private

We can use the following command to update the spec metadata:

peak apps specs update-metadata <spec_id> path/to/update_app_spec_metadata.yaml

Creating a new App Spec Release

We can create a new release for an existing app spec by providing spec id and payload containing new configuration details and release info.

# app_spec_release.yaml

body:
  release:
    version: 2.0.0
    notes: This is a new release
  config:
    - id: existing_block_spec_id_1
      release:
        version: 2.0.0
    - id: existing_block_spec_id_2
      release:
        version: 2.0.0

We can use the following command to create a new app spec release:

peak apps specs create-release <spec_id> path/to/create_app_spec_release.yaml

App Deployments

Creating a new App Deployment

We can create a app deployment by providing payload containing metadata, parameters, revision and spec info.

# app_deployment.yaml

body:
  metadata:
    name: app-deployment
    title: App Deployment
    summary: App Deployment
    description: Creating a new app deployment
    descriptionContentType: text/markdown
    imageUrl: https://my-block-pics.com/image-0.jpg
    tags:
      - name: CLI
  parameters:
    block-1:
      build:
        watcher_user: "abc@123.com"
        use_cache: true
        runtime_exceeded: 10
      run:
        agg_type: "SUM"
        num_iterations: 50
        email_notifications: true
        file_names:
          - input.csv
          - output.csv
    block-2:
      build:
        watcher_user: "xyz@456.com"
        use_cache: false
        runtime_exceeded: 50
      run:
        agg_type: "MAX"
        num_iterations: 10
        email_notifications: false
        file_names:
          - input.csv
          - output.csv
  revision:
    notes: This is the initial revision
  spec:
    id: 0bddb4c6-40c5-45c3-b477-fceb2c051609
    release:
      version: 1.0.0

We can use the following command to create a new app deployment:

peak apps deployments create path/to/create_app_deployment.yaml

Creating a new App Deployment Revision

We can create a app deployment revision by providing payload containing parameters, revision and release info.

# app_deployment_revision.yaml

body:
  parameters:
    block-1:
      build:
        watcher_user: "abc@123.com"
        use_cache: true
        runtime_exceeded: 10
      run:
        agg_type: "SUM"
        num_iterations: 50
        email_notifications: true
        file_names:
          - input.csv
          - output.csv
    block-2:
      build:
        watcher_user: "xyz@456.com"
        use_cache: false
        runtime_exceeded: 50
      run:
        agg_type: "MAX"
        num_iterations: 10
        email_notifications: false
        file_names:
          - input.csv
          - output.csv
  revision:
    notes: This is the initial revision
  release:
    version: 2.0.0

We can use the following command to create a new app deployment revision:

peak apps deployments create path/to/create_app_deployment_revision.yaml

Updating App Deployment Metadata

We can update the app deployment metadata by providing deployment id and payload containing updated metadata.

# app_deployment_metadata.yaml

body:
  name: update-block-deployment
  title: Update Block Deployment
  summary: Update Block Deployment
  description: Updating block deployment metadata
  descriptionContentType: text/markdown
  imageUrl: https://my-block-pics.com/image-0.jpg
  tags:
    - name: CLI

We can use the following command to update app deployment metadata:

peak apps deployments update-metadata <deployment_id> path/to/update_app_deployment_metadata.yaml