Notify and get Stats on your Deployments with Laravel Forge and MetricsWave

June 29, 2023

Laravel Forge and MetricsWave

Laravel Forge is a server provisioning and management tool specifically designed for deploying and managing web applications built with the Laravel PHP framework.

It provides a streamlined interface for setting up server infrastructure, automating server deployment, and managing essential server resources such as databases, queues, and scheduled tasks.

Laravel Forge simplifies the process of deploying and maintaining Laravel applications by handling server configuration, SSL certificate management, and deployment workflows, allowing developers to focus on building their applications rather than managing server infrastructure.

It's a great app, it can even send notifications to Telegram after each deploy, but it lacks of some deployment stats, and team notifications.

We can solve this with MetricsWave and a simple line of code.

Integrate MetricsWave in Laravel Forge

The first thing we need it's to create an Event in our MetricsWave account. This event should have four parameters: version, author and message.

Then we just need to copy the event UUID and add the next three lines at the end of our deploy script in Laravel Forge.

BODY='{"version":"'$(git log --pretty=format:'%h' -n 1)'", "message":"'$(git log --pretty=format:'%s' -n 1)'","author":"'$(git log --pretty=format:'%an' -n 1)'"}'
curl -X POST "$EVENT_UUID" \
  -H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "$BODY"

Then we are going to have stats about our deploys in MetricsWave and you can see, for example, if a new feature is affecting your traffic or it's breaking something.

Deployment Stats with MetricsWave and LaravelForge

← Go back to the blog

Choose the plan
that fits your needs

Start for free, and upgrade your account at any moment.

All plans include:

  • 100% data ownership
  • Forever data retention
  • No cookie banner required
  • GDPR law compliance
  • Unlimited support
  • Cancel at any time
  • All features available