Skip to content

Commit

Permalink
static ip on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Nov 1, 2021
1 parent 6bf2915 commit ebb8f64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion x-pack/test/fleet_cypress/fleet_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { ChildProcess, spawn } from 'child_process';
import { ToolingLog } from '@kbn/dev-utils';
import axios from 'axios';
import process from 'process';
import { Manager } from './resource_manager';
import { getLatestVersion } from './artifact_manager';

Expand Down Expand Up @@ -38,14 +39,18 @@ export class FleetManager extends Manager {
const artifact = `docker.elastic.co/beats/elastic-agent:${await getLatestVersion()}`;
this.log.info(artifact);

// https://stackoverflow.com/a/48547074
const isLinux = process.platform === 'linux';
const host = isLinux ? '172.17.0.1' : 'host.docker.internal';

const args = [
'run',
'--add-host',
'host.docker.internal:host-gateway',
'--env',
'FLEET_SERVER_ENABLE=true',
'--env',
`FLEET_SERVER_ELASTICSEARCH_HOST=http://gateway.docker.internal:${this.esConfig.port}`,
`FLEET_SERVER_ELASTICSEARCH_HOST=http://${host}:${this.esConfig.port}`,
'--env',
`FLEET_SERVER_SERVICE_TOKEN=${serviceToken}`,
'--rm',
Expand Down

0 comments on commit ebb8f64

Please sign in to comment.