A full access to Blackfire is bundled with your PHP and Python Upsun projects.
Blackfire has built-in support for Upsun projects. The integration is made simpler as Blackfire agent and probe are installed and enabled by default on all Upsun projects.
Blackfire server credentials are automatically configured on all PHP and Python Upsun projects. The Blackfire integration appears in the project settings in Upsun console.
Blackfire monitoring is enabled by default on your production environment.
To enable Blackfire monitoring on your development or staging environments, go to your organization menu and click Organization Monitoring Usage
HTTP requests can be profiled without any extra configuration, but the client credentials are required to trigger profiles with the CLI from your Upsun environments.
Set the client credentials as environment variables (run this command from the root directory of your project):
Recommended: To explicitly define which
environment the profile must be sent
to, use the --env=<ENV_UUID>
parameter.
Blackfire Agent uses the BLACKFIRE_SERVER_ID
environment variable to
determine where to send the profile.
When no target environment is specified or implicitly discovered, the profile
is sent to the personal sandbox environment of the user whose
personal credentials (BLACKFIRE_CLIENT_ID
and BLACKFIRE_CLIENT_TOKEN
) were used. Only that user can then access
the profile from /my/profiles.
To explicitly specify your personal sandbox environment, use
--env="My Environment"
To enable Blackfire builds on all of your Upsun environments each time a branch is deployed (after a push, merge, or redeploy event), you need to set up a specific webhook.
To do so, follow these steps:
The command asks several questions. Hit enter to accept the default for all of them. If you get a permission error, ask a project admin to upgrade your account or ask someone who is an admin to run this command.
Now, whenever you push to an Upsun environment, Blackfire will automatically trigger a build for this specific environment. Blackfire scenarios will be run for all your pull requests.
If you are using GitHub and if you have setup the synchronization between GitHub and Upsun, don't forget to configure the Blackfire GitHub notification channel. That way, Blackfire will post a status on your GitHub pull requests.
Here is a full video tutorial to get you started with the integration of the three services: