In the past year, I migrated all my servers to Forge and began utilizing Envoyer for all my deployments. Here are some of the lessons I've learned.
Ensure the correct PHP version is called when using Composer.
Since I have multiple PHP versions installed on my Forge servers, deploying a project that doesn't use the default PHP version often results in a composer installation error. To resolve this, make sure to provide the full path to the specific PHP version. For example, if you are using PHP 8.1, the composer path should be: /usr/local/bin/php8.1 /usr/local/bin/composer
Deployment Hooks
I discovered that I can incorporate deployment hooks before or after specific tasks by utilizing the accordion feature, which allows me to easily drag them to the desired location.
I typically create an "Optimize" hook that I run before activating a new release, as well as a PHP-FPM webhook that I execute after purging old releases.
Don't forget to specify the Run as user if you have isolated users on your server.
This is an example of the Optimize for a Statamic website but this applies to a regular Laravel site.