This commit is contained in:
TiclemFR
2024-01-25 09:06:03 +01:00
parent 031f7071e6
commit 468c2cd0e6
35 changed files with 27542 additions and 57 deletions

View File

@@ -1686,17 +1686,17 @@
},
{
"name": "laravel/sail",
"version": "v1.27.1",
"version_normalized": "1.27.1.0",
"version": "v1.27.2",
"version_normalized": "1.27.2.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/sail.git",
"reference": "9dc648978e4276f2bfd37a076a52e3bd9394777f"
"reference": "2276a8d9d6cfdcaad98bf67a34331d100149d5b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/9dc648978e4276f2bfd37a076a52e3bd9394777f",
"reference": "9dc648978e4276f2bfd37a076a52e3bd9394777f",
"url": "https://api.github.com/repos/laravel/sail/zipball/2276a8d9d6cfdcaad98bf67a34331d100149d5b6",
"reference": "2276a8d9d6cfdcaad98bf67a34331d100149d5b6",
"shasum": ""
},
"require": {
@@ -1710,7 +1710,7 @@
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpstan/phpstan": "^1.10"
},
"time": "2024-01-13T18:46:48+00:00",
"time": "2024-01-21T17:13:42+00:00",
"bin": [
"bin/sail"
],

View File

@@ -3,7 +3,7 @@
'name' => 'laravel/laravel',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'a068f5495757670b10fae352ef70c64b48109251',
'reference' => '031f7071e6d723126171aaae79112d82773417fe',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -391,7 +391,7 @@
'laravel/laravel' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'a068f5495757670b10fae352ef70c64b48109251',
'reference' => '031f7071e6d723126171aaae79112d82773417fe',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -416,9 +416,9 @@
'dev_requirement' => false,
),
'laravel/sail' => array(
'pretty_version' => 'v1.27.1',
'version' => '1.27.1.0',
'reference' => '9dc648978e4276f2bfd37a076a52e3bd9394777f',
'pretty_version' => 'v1.27.2',
'version' => '1.27.2.0',
'reference' => '2276a8d9d6cfdcaad98bf67a34331d100149d5b6',
'type' => 'library',
'install_path' => __DIR__ . '/../laravel/sail',
'aliases' => array(),

View File

@@ -128,8 +128,9 @@ else
fi
# Source the ".env" file so Laravel's environment variables are available...
if [ ! -z "$APP_ENV" ] && [ -f ./.env.$APP_ENV ]; then
source ./.env.$APP_ENV;
# shellcheck source=/dev/null
if [ -n "$APP_ENV" ] && [ -f ./.env."$APP_ENV" ]; then
source ./.env."$APP_ENV";
elif [ -f ./.env ]; then
source ./.env;
fi
@@ -159,8 +160,7 @@ function sail_is_not_running {
}
# Define Docker Compose command prefix...
docker compose &> /dev/null
if [ $? == 0 ]; then
if docker compose &> /dev/null; then
DOCKER_COMPOSE=(docker compose)
else
DOCKER_COMPOSE=(docker-compose)
@@ -560,7 +560,7 @@ elif [ "$1" == "open" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
open $APP_URL
open "$APP_URL"
exit
else

View File

@@ -19,6 +19,7 @@ trait InteractsWithDockerComposeServices
'redis',
'memcached',
'meilisearch',
'typesense',
'minio',
'mailpit',
'selenium',
@@ -86,7 +87,7 @@ trait InteractsWithDockerComposeServices
// Merge volumes...
collect($services)
->filter(function ($service) {
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'minio']);
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'typesense', 'minio']);
})->filter(function ($service) use ($compose) {
return ! array_key_exists($service, $compose['volumes'] ?? []);
})->each(function ($service) use (&$compose) {
@@ -116,14 +117,31 @@ trait InteractsWithDockerComposeServices
{
$environment = file_get_contents($this->laravel->basePath('.env'));
if (in_array('pgsql', $services)) {
$environment = str_replace('DB_CONNECTION=mysql', "DB_CONNECTION=pgsql", $environment);
if (in_array('mysql', $services) ||
in_array('mariadb', $services) ||
in_array('pgsql', $services)) {
$defaults = [
'# DB_HOST=127.0.0.1',
'# DB_PORT=3306',
'# DB_DATABASE=laravel',
'# DB_USERNAME=root',
'# DB_PASSWORD=',
];
foreach ($defaults as $default) {
$environment = str_replace($default, substr($default, 2), $environment);
}
}
if (in_array('mysql', $services)) {
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=mysql', $environment);
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment);
}elseif (in_array('pgsql', $services)) {
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=pgsql', $environment);
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=pgsql", $environment);
$environment = str_replace('DB_PORT=3306', "DB_PORT=5432", $environment);
} elseif (in_array('mariadb', $services)) {
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mariadb", $environment);
} else {
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mysql", $environment);
}
$environment = str_replace('DB_USERNAME=root', "DB_USERNAME=sail", $environment);
@@ -143,6 +161,14 @@ trait InteractsWithDockerComposeServices
$environment .= "\nMEILISEARCH_NO_ANALYTICS=false\n";
}
if (in_array('typesense', $services)) {
$environment .= "\nSCOUT_DRIVER=typesense";
$environment .= "\nTYPESENSE_HOST=typesense";
$environment .= "\nTYPESENSE_PORT=8108";
$environment .= "\nTYPESENSE_PROTOCOL=http";
$environment .= "\nTYPESENSE_API_KEY=xyz\n";
}
if (in_array('soketi', $services)) {
$environment = preg_replace("/^BROADCAST_DRIVER=(.*)/m", "BROADCAST_DRIVER=pusher", $environment);
$environment = preg_replace("/^PUSHER_APP_ID=(.*)/m", "PUSHER_APP_ID=app-id", $environment);

View File

@@ -0,0 +1,16 @@
typesense:
image: 'typesense/typesense:0.25.2'
ports:
- '${FORWARD_TYPESENSE_PORT:-8108}:8108'
environment:
TYPESENSE_DATA_DIR: '${TYPESENSE_DATA_DIR:-/typesense-data}'
TYPESENSE_API_KEY: '${TYPESENSE_API_KEY:-xyz}'
TYPESENSE_ENABLE_CORS: '${TYPESENSE_ENABLE_CORS:-true}'
volumes:
- 'sail-typesense:/typesense-data'
networks:
- sail
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:8108/health"]
retries: 5
timeout: 7s