-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Elasticsearch containers to Search module #723
Draft
rmccue
wants to merge
2
commits into
composable-containers
Choose a base branch
from
remove-elasticsearch
base: composable-containers
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -73,7 +73,7 @@ | |
|
||
/** | ||
* Extra configuration from packages. | ||
*/ | ||
Check failure on line 76 in inc/composer/class-docker-compose-generator.php HM Linter / hmlinterinc/composer/class-docker-compose-generator.php#L76
Raw output
|
||
protected $extra; | ||
|
||
/** | ||
|
@@ -165,7 +165,6 @@ | |
"proxy:{$this->hostname}", | ||
"proxy:pinpoint-{$this->hostname}", | ||
"proxy:cognito-{$this->hostname}", | ||
"proxy:elasticsearch-{$this->hostname}", | ||
"proxy:s3-{$this->hostname}", | ||
"proxy:s3-{$this->project_name}.localhost", | ||
], | ||
|
@@ -189,8 +188,6 @@ | |
'PAGER' => 'more', | ||
'HM_ENV_ARCHITECTURE' => 'local-server', | ||
'HM_DEPLOYMENT_REVISION' => 'dev', | ||
'ELASTICSEARCH_HOST' => 'elasticsearch', | ||
'ELASTICSEARCH_PORT' => 9200, | ||
'AWS_XRAY_DAEMON_HOST' => 'xray', | ||
'S3_UPLOADS_ENDPOINT' => Command::set_url_scheme( "https://s3-{$this->hostname}/{$this->bucket_name}/" ), | ||
'S3_UPLOADS_BUCKET' => "{$this->bucket_name}", | ||
|
@@ -215,12 +212,6 @@ | |
], | ||
]; | ||
|
||
if ( $this->get_config()['elasticsearch'] ) { | ||
$services['depends_on']['elasticsearch'] = [ | ||
'condition' => 'service_healthy', | ||
]; | ||
} | ||
|
||
// Forward CI env var - set by Travis, Circle CI, GH Actions and more... | ||
if ( getenv( 'CI' ) ) { | ||
$services['environment']['CI'] = getenv( 'CI' ); | ||
|
@@ -476,130 +467,6 @@ | |
]; | ||
} | ||
|
||
/** | ||
* Get the Elasticsearch service. | ||
* | ||
* @return array | ||
*/ | ||
protected function get_service_elasticsearch() : array { | ||
$mem_limit = getenv( 'ES_MEM_LIMIT' ) ?: '1g'; | ||
|
||
$version_map = [ | ||
'7.10' => 'humanmade/altis-local-server-elasticsearch:4.1.0', | ||
'7' => 'humanmade/altis-local-server-elasticsearch:4.1.0', | ||
'6.8' => 'humanmade/altis-local-server-elasticsearch:3.1.0', | ||
'6' => 'humanmade/altis-local-server-elasticsearch:3.1.0', | ||
'6.3' => 'humanmade/altis-local-server-elasticsearch:3.0.0', | ||
]; | ||
|
||
$this->check_elasticsearch_version( array_keys( $version_map ) ); | ||
|
||
$image = $version_map[ $this->get_elasticsearch_version() ]; | ||
|
||
return [ | ||
'elasticsearch' => [ | ||
'image' => $image, | ||
'restart' => 'unless-stopped', | ||
'container_name' => "{$this->project_name}-es", | ||
'ulimits' => [ | ||
'memlock' => [ | ||
'soft' => -1, | ||
'hard' => -1, | ||
], | ||
], | ||
'mem_limit' => $mem_limit, | ||
'volumes' => [ | ||
'es-data:/usr/share/elasticsearch/data', | ||
"{$this->root_dir}/content/uploads/es-packages:/usr/share/elasticsearch/config/packages", | ||
], | ||
'ports' => [ | ||
'9200', | ||
], | ||
'networks' => [ | ||
'proxy', | ||
'default', | ||
], | ||
'healthcheck' => [ | ||
'test' => [ | ||
'CMD-SHELL', | ||
'curl --silent --fail localhost:9200/_cluster/health || exit 1', | ||
], | ||
'interval' => '5s', | ||
'timeout' => '5s', | ||
'retries' => 25, | ||
], | ||
'labels' => [ | ||
'traefik.port=9200', | ||
'traefik.protocol=http', | ||
'traefik.docker.network=proxy', | ||
"traefik.frontend.rule=HostRegexp:elasticsearch-{$this->hostname}", | ||
"traefik.domain=elasticsearch-{$this->hostname}", | ||
], | ||
'environment' => [ | ||
'http.max_content_length=10mb', | ||
// Force ES into single-node mode (otherwise defaults to zen discovery as | ||
// network.host is set in the default config). | ||
'discovery.type=single-node', | ||
// Use max container memory limit as the max JVM heap allocation value. | ||
"ES_JAVA_OPTS=-Xms512m -Xmx{$mem_limit}", | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Get the Kibana service. | ||
* | ||
* @return array | ||
*/ | ||
protected function get_service_kibana() : array { | ||
|
||
$version_map = [ | ||
'7.10' => 'humanmade/altis-local-server-kibana:1.1.1', | ||
'7' => 'humanmade/altis-local-server-kibana:1.1.1', | ||
'6.8' => 'blacktop/kibana:6.8', | ||
'6' => 'blacktop/kibana:6.8', | ||
'6.3' => 'blacktop/kibana:6.3', | ||
]; | ||
|
||
$this->check_elasticsearch_version( array_keys( $version_map ) ); | ||
|
||
$image = $version_map[ $this->get_elasticsearch_version() ]; | ||
|
||
$yml_file = 'kibana.yml'; | ||
if ( version_compare( $this->get_elasticsearch_version(), '7', '>=' ) ) { | ||
$yml_file = 'kibana-7.yml'; | ||
} | ||
|
||
return [ | ||
'kibana' => [ | ||
'image' => $image, | ||
'container_name' => "{$this->project_name}-kibana", | ||
'networks' => [ | ||
'proxy', | ||
'default', | ||
], | ||
'ports' => [ | ||
'5601', | ||
], | ||
'labels' => [ | ||
'traefik.port=5601', | ||
'traefik.protocol=http', | ||
'traefik.docker.network=proxy', | ||
"traefik.frontend.rule=Host:{$this->hostname};PathPrefix:/kibana", | ||
], | ||
'depends_on' => [ | ||
'elasticsearch' => [ | ||
'condition' => 'service_healthy', | ||
], | ||
], | ||
'volumes' => [ | ||
"{$this->config_dir}/{$yml_file}:/usr/share/kibana/config/kibana.yml", | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Get the S3 service. | ||
* | ||
|
@@ -836,10 +703,6 @@ | |
$services = array_merge( $services, $this->get_service_cavalcade() ); | ||
} | ||
|
||
if ( $this->get_config()['elasticsearch'] ) { | ||
$services = array_merge( $services, $this->get_service_elasticsearch() ); | ||
} | ||
|
||
$services = array_merge( | ||
$services, | ||
$this->get_service_mailhog() | ||
|
@@ -857,10 +720,6 @@ | |
$services = array_merge( $services, $this->get_service_analytics() ); | ||
} | ||
|
||
if ( $this->get_config()['kibana'] && $this->get_config()['elasticsearch'] ) { | ||
$services = array_merge( $services, $this->get_service_kibana() ); | ||
} | ||
|
||
if ( strpos( $this->args['xdebug'] ?? false, 'profile' ) !== false ) { | ||
$services = array_merge( $services, $this->get_service_webgrind() ); | ||
} | ||
|
@@ -882,7 +741,6 @@ | |
], | ||
'volumes' => [ | ||
'db-data' => null, | ||
'es-data' => null, | ||
'tmp' => null, | ||
's3' => null, | ||
'socket' => null, | ||
|
@@ -933,7 +791,7 @@ | |
// Initialize plugins and run them. | ||
if ( ! empty( $this->extra ) ) { | ||
foreach ( $this->extra as $package_spec ) { | ||
/** @var Compose_Extension */ | ||
Check failure on line 794 in inc/composer/class-docker-compose-generator.php HM Linter / hmlinterinc/composer/class-docker-compose-generator.php#L794
Raw output
|
||
$handler = new $package_spec['compose-extension'](); | ||
$handler->set_config( $this, $this->args ); | ||
$config = $handler->filter_compose( $config ); | ||
|
@@ -973,7 +831,6 @@ | |
'tachyon' => $modules['media']['tachyon'] ?? true, | ||
'analytics' => $analytics_enabled, | ||
'cavalcade' => $modules['cloud']['cavalcade'] ?? true, | ||
'elasticsearch' => ( $analytics_enabled || $search_enabled ) ? '7' : false, | ||
'kibana' => ( $analytics_enabled || $search_enabled ), | ||
'afterburner' => false, | ||
'xray' => $modules['cloud']['xray'] ?? true, | ||
|
@@ -986,42 +843,6 @@ | |
return array_merge( $defaults, $modules['local-server'] ?? [] ); | ||
} | ||
|
||
/** | ||
* Get the configured Elasticsearch version. | ||
* | ||
* @return int | ||
*/ | ||
protected function get_elasticsearch_version() : string { | ||
if ( ! empty( $this->get_config()['elasticsearch'] ) ) { | ||
return (string) $this->get_config()['elasticsearch']; | ||
} | ||
|
||
return '7'; | ||
} | ||
|
||
/** | ||
* Check the configured Elasticsearch version in config. | ||
* | ||
* @param array $versions List of available version numbers. | ||
* @return void | ||
*/ | ||
protected function check_elasticsearch_version( array $versions ) { | ||
$versions = array_map( 'strval', $versions ); | ||
rsort( $versions ); | ||
if ( in_array( $this->get_elasticsearch_version(), $versions, true ) ) { | ||
return; | ||
} | ||
|
||
echo sprintf( | ||
"The configured elasticsearch version \"%s\" is not supported.\nTry one of the following:\n - %s\n", | ||
// phpcs:ignore HM.Security.EscapeOutput.OutputNotEscaped | ||
$this->get_elasticsearch_version(), | ||
// phpcs:ignore HM.Security.EscapeOutput.OutputNotEscaped | ||
implode( "\n - ", $versions ) | ||
); | ||
exit( 1 ); | ||
} | ||
|
||
/** | ||
* Get the main application volume adjusted for sharing config options. | ||
* | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "powering the analytics data query layer." part still true?