|
| 1 | +Upgrade Symfony Health Check Bundle V1.0.0 |
| 2 | +================================= |
| 3 | + |
| 4 | +Step 1: Update the Symfony Health Check Bundle via Composer |
| 5 | +---------------------------------- |
| 6 | +```console |
| 7 | +$ "macpaw/symfony-health-check-bundle": "^v1.0.0" |
| 8 | +``` |
| 9 | + |
| 10 | +### Next, use Composer to download new versions of the libraries: |
| 11 | +```console |
| 12 | +$ composer update "macpaw/symfony-health-check-bundle" |
| 13 | +``` |
| 14 | + |
| 15 | +###Dependency Errors |
| 16 | + |
| 17 | +If you get a dependency error, it may mean that you also need to upgrade other libraries that are dependencies of the libraries. To allow that, pass the --with-all-dependencies flag: |
| 18 | +```console |
| 19 | +$ composer update "macpaw/symfony-health-check-bundle" -with-all-dependencies |
| 20 | +``` |
| 21 | + |
| 22 | +Step 2: Update the Symfony Health Check Bundle via Composer |
| 23 | +---------------------------------- |
| 24 | + |
| 25 | +## Automatical |
| 26 | + |
| 27 | +Over time - and especially when you upgrade to a new version of a library - an updated version of the recipe may be available. These updates are usually minor - e.g. new comments in a configuration file - but it's a good idea to keep your files in sync with the recipes. |
| 28 | + |
| 29 | +Symfony Flex provides several commands to help upgrade your recipes. Be sure to commit any unrelated changes you're working on before starting: |
| 30 | + |
| 31 | +```console |
| 32 | +$ composer recipes |
| 33 | + |
| 34 | + |
| 35 | +$ composer recipes symfony/framework-bundle |
| 36 | + |
| 37 | + |
| 38 | +$ composer recipes:install symfony/framework-bundle --force -v |
| 39 | +``` |
| 40 | + |
| 41 | +The tricky part of this process is that the recipe "update" does not perform any intelligent "upgrading" of your code. Instead, the updates process re-installs the latest version of the recipe which means that your custom code will be overridden completely. After updating a recipe, you need to carefully choose which changes you want, and undo the rest. |
| 42 | + |
| 43 | +## Manual: |
| 44 | + |
| 45 | +### Old Config: |
| 46 | +`config/packages/symfony_health_check.yaml` |
| 47 | +```yaml |
| 48 | +symfony_health_check: |
| 49 | + health_checks: |
| 50 | + - id: symfony_health_check.doctrine_check |
| 51 | +``` |
| 52 | +
|
| 53 | +### New Config: |
| 54 | +```yaml |
| 55 | +symfony_health_check: |
| 56 | + health_checks: |
| 57 | + - id: symfony_health_check.doctrine_check |
| 58 | + ping_checks: |
| 59 | + - id: symfony_health_check.status_up_check |
| 60 | +``` |
| 61 | +
|
| 62 | +Security Optional: |
| 63 | +---------------------------------- |
| 64 | +`config/packages/security.yaml` |
| 65 | + |
| 66 | +### Old Config: |
| 67 | +```yaml |
| 68 | + firewalls: |
| 69 | + healthcheck: |
| 70 | + pattern: ^/health |
| 71 | + security: false |
| 72 | +``` |
| 73 | + |
| 74 | +### New Config: |
| 75 | +```yaml |
| 76 | + firewalls: |
| 77 | + healthcheck: |
| 78 | + pattern: ^/health |
| 79 | + security: false |
| 80 | + ping: |
| 81 | + pattern: ^/ping |
| 82 | + security: false |
| 83 | +``` |
| 84 | + |
| 85 | +Step 3: Update Custom Health Check |
| 86 | +---------------------------------- |
| 87 | +We need change return type array -> Response class |
| 88 | + |
| 89 | + |
| 90 | +### Old: |
| 91 | +``` |
| 92 | +use SymfonyHealthCheckBundle\Dto\Response; |
| 93 | + |
| 94 | +class StatusUpCheck implements CheckInterface |
| 95 | +{ |
| 96 | + public function check(): array |
| 97 | + { |
| 98 | + return ['status' => 'up']; |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | +
|
| 103 | +### New: |
| 104 | +``` |
| 105 | +use SymfonyHealthCheckBundle\Dto\Response; |
| 106 | + |
| 107 | +class StatusUpCheck implements CheckInterface |
| 108 | +{ |
| 109 | + public function check(): Response |
| 110 | + { |
| 111 | + return new Response('status', true, 'up'); |
| 112 | + } |
| 113 | +} |
| 114 | +``` |
| 115 | +
|
| 116 | +
|
0 commit comments