-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add cli spinner * Add healthcheck to mysql/mariadb container * Pass project directory instead of changing the working dir * Add docker HealthChecker class * Bind cli spinner in container * Add ability to skip global containers when using local start * Wait for db container to be ready before creating wp databases, fix FE building and add a spinner * Update global start test * Update local bootstrap test to pass * Update ProjectBootstrapperTest.php * Test area missing from code coverage * Add HealthCheckerTest.php * Fix docblock * Add global compose migration * Fix --only-new error when running command that doesn't exist * Run update listener check on open command * Remove test * Update autocomplete * Bump to version 5.1.0 * Add multisite bootstrapping support * Update autocompletion * Increase HC timeout, add interval, increase retries, clean up file
- Loading branch information
Showing
22 changed files
with
575 additions
and
100 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
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,44 @@ | ||
<?php declare( strict_types=1 ); | ||
|
||
namespace App\Services\Docker; | ||
|
||
use App\Contracts\Runner; | ||
use TitasGailius\Terminal\Response; | ||
|
||
/** | ||
* Check the health for docker containers. | ||
* | ||
* @package App\Services\Docker | ||
*/ | ||
class HealthChecker { | ||
|
||
public const HEALTHY = 'healthy'; | ||
|
||
/** | ||
* The command runner. | ||
* | ||
* @var \App\Contracts\Runner | ||
*/ | ||
protected $runner; | ||
|
||
public function __construct( Runner $runner ) { | ||
$this->runner = $runner; | ||
} | ||
|
||
/** | ||
* Check if a container running docker's health check has become healthy. | ||
* | ||
* @param string $containerName The container name to check, as shown in "docker ps". | ||
*/ | ||
public function healthy( string $containerName ): bool { | ||
$command = 'docker ps --filter {{ $container }} --filter "health=healthy" --format "{{ .Status }}"'; | ||
|
||
/** @var Response $response */ | ||
$response = $this->runner->with( [ | ||
'container' => "name=$containerName", | ||
] )->command( $command )->run(); | ||
|
||
return str_contains( (string) $response, self::HEALTHY ); | ||
} | ||
|
||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.