Add docker-compose config for host-based Fleet Server and new /ping route
- Introduce `docker-compose.fleet-host.yml` allowing Elastic Agent to connect to a host-installed Fleet Server. - Add `pingRoute` to provide a simple `/ping` endpoint returning "pong" with a timestamp.
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
services:
|
||||||
|
# Do not start the in-container Fleet Server when using a host-installed Fleet Server
|
||||||
|
fleet-server:
|
||||||
|
profiles: [disabled]
|
||||||
|
|
||||||
|
# Point the Elastic Agent container to the host Fleet Server
|
||||||
|
elastic-agent:
|
||||||
|
environment:
|
||||||
|
- FLEET_URL=http://host.docker.internal:8220
|
||||||
|
# No change to 8200: APM intake stays exposed from this container
|
||||||
|
|
||||||
|
## Usage (Windows + WSL host Fleet Server):
|
||||||
|
## 1) Stop containerized Fleet services to free port 8220:
|
||||||
|
## docker compose stop fleet-server elastic-agent
|
||||||
|
## 2) Install Fleet Server on WSL (see commands I provided), verify http://localhost:8220/api/status
|
||||||
|
## 3) Start Elastic Agent pointing to host Fleet:
|
||||||
|
## docker compose -f docker-compose.yml -f docker-compose.fleet-host.yml up -d elastic-agent
|
||||||
|
## 4) Verify in Kibana → Fleet → Agents: Fleet Server (host) healthy; Elastic Agent (container) healthy.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace routes;
|
||||||
|
|
||||||
|
use traits\route_t;
|
||||||
|
|
||||||
|
class pingRoute
|
||||||
|
{
|
||||||
|
use route_t;
|
||||||
|
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$this->get('/ping', function () {
|
||||||
|
global $response;
|
||||||
|
$response->success([
|
||||||
|
'message' => 'pong',
|
||||||
|
'time' => date('c'),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user