-
-
Save Log1x/a5b9cf9ab6320c3a4f3e66b0bfea3dd4 to your computer and use it in GitHub Desktop.
Trellis + Sentry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* composer require sentry/sentry-sdk | |
*/ | |
Env::init(); | |
// ... | |
if (env('SENTRY_DSN') && env('WP_ENV') !== 'development') { | |
Sentry\init([ | |
'dsn' => env('SENTRY_DSN'), | |
'release' => env('GIT_SHA'), | |
'environment' => env('WP_ENV'), | |
'error_types' => E_ALL & ~E_NOTICE & ~E_DEPRECATED, | |
]); | |
Sentry\configureScope(function (Sentry\State\Scope $scope): void { | |
$scope->setTag('trellis_version', env('RELEASE_VERSION')); | |
}); | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sentry deployment tasks | |
# | |
# I'm calling this from `finalize-after.yml` deploy-hook like: | |
# - import_tasks: "{{ playbook_dir }}/deploy-hooks/plugins/sentry.yml" | |
# | |
# You could also just include directly | |
- name: Create Sentry release | |
uri: | |
url: https://sentry.io/api/0/organizations/{{ sentry_organization }}/releases/ | |
method: POST | |
status_code: 201 | |
headers: | |
Content-Type: "application/json" | |
Accept: "application/json" | |
Authorization: "Bearer {{ vault_sentry_token }}" | |
body_format: json | |
body: | |
projects: ["{{ sentry_project }}"] | |
ref: "{{ git_clone.after }}" | |
version: "{{ deploy_helper.new_release }}" | |
- name: Create Sentry deploy | |
uri: | |
url: https://sentry.io/api/0/organizations/{{ sentry_organization }}/releases/{{ deploy_helper.new_release }}/deploys/ | |
method: POST | |
status_code: 201 | |
headers: | |
Content-Type: "application/json" | |
Accept: "application/json" | |
Authorization: "Bearer {{ vault_sentry_token }}" | |
body_format: json | |
body: | |
environment: "{{ env }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vault_mysql_root_password: ... | |
vault_sentry_token: xxxxxxxxxxxxxxxxx | |
sentry_organization: example | |
sentry_project: example | |
vault_wordpress_sites: | |
example.dev: | |
env: | |
sentry_dsn: https://xxxxx@sentry.io/xxxxx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment