-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from MacPaw/story/Release1
Release v2.0.0
- Loading branch information
Showing
29 changed files
with
591 additions
and
191 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
Upgrade Symfony Health Check Bundle V1.0.0 | ||
================================= | ||
|
||
Step 1: Update the Symfony Health Check Bundle via Composer | ||
---------------------------------- | ||
```console | ||
$ "macpaw/symfony-health-check-bundle": "^v1.0.0" | ||
``` | ||
|
||
### Next, use Composer to download new versions of the libraries: | ||
```console | ||
$ composer update "macpaw/symfony-health-check-bundle" | ||
``` | ||
|
||
###Dependency Errors | ||
|
||
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: | ||
```console | ||
$ composer update "macpaw/symfony-health-check-bundle" -with-all-dependencies | ||
``` | ||
|
||
Step 2: Update the Symfony Health Check Bundle via Composer | ||
---------------------------------- | ||
|
||
## Automatical | ||
|
||
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. | ||
|
||
Symfony Flex provides several commands to help upgrade your recipes. Be sure to commit any unrelated changes you're working on before starting: | ||
|
||
```console | ||
$ composer recipes | ||
|
||
|
||
$ composer recipes symfony/framework-bundle | ||
|
||
|
||
$ composer recipes:install symfony/framework-bundle --force -v | ||
``` | ||
|
||
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. | ||
|
||
## Manual: | ||
|
||
### Old Config: | ||
`config/packages/symfony_health_check.yaml` | ||
```yaml | ||
symfony_health_check: | ||
health_checks: | ||
- id: symfony_health_check.doctrine_check | ||
``` | ||
### New Config: | ||
```yaml | ||
symfony_health_check: | ||
health_checks: | ||
- id: symfony_health_check.doctrine_check | ||
ping_checks: | ||
- id: symfony_health_check.status_up_check | ||
``` | ||
Security Optional: | ||
---------------------------------- | ||
`config/packages/security.yaml` | ||
|
||
### Old Config: | ||
```yaml | ||
firewalls: | ||
healthcheck: | ||
pattern: ^/health | ||
security: false | ||
``` | ||
|
||
### New Config: | ||
```yaml | ||
firewalls: | ||
healthcheck: | ||
pattern: ^/health | ||
security: false | ||
ping: | ||
pattern: ^/ping | ||
security: false | ||
``` | ||
|
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use SymfonyHealthCheckBundle\Check\CheckInterface; | ||
|
||
final class PingController extends AbstractController | ||
{ | ||
/** | ||
* @var array<CheckInterface> | ||
*/ | ||
private array $checks = []; | ||
|
||
public function addHealthCheck(CheckInterface $check): void | ||
{ | ||
$this->checks[] = $check; | ||
} | ||
|
||
/** | ||
* @Route( | ||
* path="/ping", | ||
* name="ping", | ||
* methods={"GET"} | ||
* ) | ||
*/ | ||
public function pingAction(): JsonResponse | ||
{ | ||
$pingCheck = []; | ||
foreach ($this->checks as $healthCheck) { | ||
$pingCheck[] = $healthCheck->check()->toArray(); | ||
} | ||
|
||
return new JsonResponse($pingCheck, Response::HTTP_OK); | ||
} | ||
} |
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
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
Oops, something went wrong.