Skip to content

Module Hooks

Vasko Bozhurski edited this page Aug 13, 2019 · 2 revisions

You can use hooks to change the typical deployment process, in this case to enable tasks to be executed during a specific moment of the application deployment. For example, you can set hooks can be executed before or after the actual deployment steps for a module, depending on the applications' need.

Hook Modeling

  • name - This string defines the name of the hook much like it defines other MTA elements.

  • type - The type of the hook. Currently the only supported type is task.

  • phase - The phase of the module's lifecycle at which the hook will be executed. Currently the following phases are supported:

    • application.before-stop.live
    • application.before-stop.idle
    • application.after-stop.live
    • application.after-stop.idle
  • parameters - The supported hook parameters which are used to define the hook's functionality.

Hook Parameters

Parameter Description Default Value Example Value
name Defines the name of the task The name of the hook custom-name
command The command that will be executed "bin/rails db:migrate"
memory The memory limit for the task's execution CF application's default memory 256MB
disk-quota The disk quota for the task's execution CF application's default disk quota 512M

Example Hook

_schema-version: "3.3"
ID: foo
version: 3.0.0
modules:
  - name: foo
    type: javascript.nodejs
    hooks:
      - name: hook
        type: task
        phases:
          - application.before-stop.live
          - application.before-stop.idle
        parameters:
          name: foo-task
          command: 'sleep 5m'
Clone this wiki locally