Git status

In addition to being able to react to issues by actively monitoring, sometimes you want to get notifications when your project status has changed. You can get notifications on your project health and also activity notifications whenever an event happens in your project.

Get health notifications 

Health notifications tell you when something in your project needs attention. At present, the only notification is a low-disk warning when your project is running out of disk space.

This notification is automatically sent to all project admins. See this notification by running this command:

platform integration:list

You see a table similar to the following example:

+---------------+--------------+-------------+
| ID            | Type         | Summary     |
+---------------+--------------+-------------+
| abcdefg123456 | health.email | To: #admins |
+---------------+--------------+-------------+

Assuming you want to keep admins notified, you can add another recipient with a command like the following:

platform integration:update <INTEGRATION_ID> --recipients '#admins' --recipients <ADDITIONAL_EMAIL_ADDRESS>

So to add jane@example.com to the above integration, you’d run the following:

platform integration:update abcdefg123456 --recipients '#admins' --recipients jane@example.com

And get the following in response:

Integration abcdefg123456 (health.email) updated

+--------------+--------------------+
| Property     | Value              |
+--------------+--------------------+
| id           | abcdefg123456      |
| type         | health.email       |
| role         |                    |
| from_address |                    |
| recipients   | - '#admins'        |
|              | - jane@example.com |
+--------------+--------------------+

Now you can be sure you and Jane are notified whenever your app is running low on disk space. You can also set this up to be notified in Slack, PagerDuty, or anywhere that accepts a webhook.

For now, focus on getting notified about activities.

Get activity notifications 

Webhooks enable you to monitor events as they happen. Platform.sh sends information about activities in your project to the URL you specify.

Say you want to get a notification any time your main environment gets new code or is redeployed. To see such a notification in action, follow these steps:

  1. Open https://webhook.site/ in a browser.

  2. Copy the URL from the body of the page. Note this is not the one from the address bar with # in it.

  3. In a terminal, run the following command:

    platform integration:add --type=webhook --url <WEBHOOK_URL> --events 'environment.push,environment.redeploy' --environments 'main' --excluded-environments '' --states complete --shared-key=null

    The last three flags are all the default options. You could also leave them out and just accept the defaults when the CLI prompts you.

  4. Redeploy your main environment by running this command:

    platform environment:redeploy --environment main
  5. After the activity has finished, see the JSON payload at the webhook.site page. You can use its values to trigger anything you wish, including human-readable notifications elsewhere.

You can also run the redeploy command for the dev environment and verify that it doesn’t send anything.

What’s next 

Your Platform.sh project is now up and running and you can keep track of it! That’s a great start to working with Platform.sh.

Now that you’ve mastered the basics, you can choose more advanced tasks to complete: