Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Backport from branch opendistro-1.12.0.0 to 7.9.1 #245

Merged
merged 37 commits into from
Dec 18, 2020

Conversation

zhongnansu
Copy link
Member

@zhongnansu zhongnansu commented Dec 11, 2020

Issue #, if available:

Description of changes:

TODO

  • come up a solution to close the code gap between AES and OD. Need to use plugin-config for at least port and basePath. This will also remove the limitation of current reporting on OD, where reporting only works if user use default server.basePath and server.port in Kibana.yml. The code change should be pushed to dev branch and backport to 7.9.1 branch if needed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

zhongnansu and others added 30 commits December 6, 2020 23:39
When user=null or tenant=null, tenant is considered ""
The APIs match for tenant info from user context
…tro-for-elasticsearch#222)

* Use custom chrome binary

* Update chromium path

* Test workflow for al2

* Disable tests temporarily

* Fix workflow

Fix workflow

* Rename opendistroKibanaReports to opendistroReportsKibana

* Update workflows

Fix workflow

Update workflows

Update workflows

* Enable tests in workflows

* Add windows chromium to workflows

* Fix tests

* Use path.posix.normalize to accomondate windows

* Use @types/puppeteer-core
…arch#228)

* Add arm chrome to workflows

* Update release workflow

* Fix workflow

* Add puppeteer-core as it's not included in kibana-oss

* Address comments
…csearch#231)

* Fix report scheduler release workflow

* Fix uploading artifacts
* Fix chromium path

* Add more possible paths

* Add error message

* Use plugin id constant
…asticsearch#233)

* Fix path

* Fix path for kibana reports

* Change s3 bucket paths and artifact name

* Fix path

* Use kibana-oss in release workflow
fix conflicts and use 9200 for AES
harold-wang and others added 2 commits December 10, 2020 16:56
…icsearch#229)

* Headless chrome creation script and readme file

* Rename README_chrome_headless.md to README.md

* Add README.md

* add comments on how to run chrome to get pdf and png report

* Change test web from google.com to https://opendistro.github.io/for-elasticsearch
@zhongnansu zhongnansu changed the title Backport to 7.9.1 Backport from dev to 7.9.1 Dec 11, 2020
@zhongnansu zhongnansu changed the title Backport from dev to 7.9.1 Backport from branch opendistro-1.12.0.0 to 7.9.1 Dec 17, 2020
@zhongnansu zhongnansu marked this pull request as ready for review December 17, 2020 23:50
Copy link
Contributor

@davidcui1225 davidcui1225 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhongnansu zhongnansu merged commit fe47d49 into opendistro-for-elasticsearch:7.9.1 Dec 18, 2020
@joshuali925
Copy link
Contributor

@zhongnansu looks like basepath can be retrieved from core.http.basePath.get(request) or core.http.basePath.serverBasePath
https://github.com/elastic/kibana/blob/v7.9.1/src%2Fcore%2Fserver%2Fhttp%2Fbase_path_service.ts#L31-L36

and port is core.http.getServerInfo().port
https://github.com/elastic/kibana/blob/v7.9.1/src%2Fcore%2Fserver%2Fhttp%2Ftypes.ts#L272-L275

if they don't work maybe read from frontend url or ping a few possible localhost:<port>/<path>/api/status to see which one responds?

@zhongnansu
Copy link
Member Author

core.http.basePath.serverBasePath

Good point! I wasn't able to find how to access port before. Your solution sounds promising, the only thing left is to rebuild the input validation for the relative url. Do you know if there is a way to expose basePath to UI, or access basePath from UI code? Basically, we need to clean the url from UI before passing to server, so that the old input validation will work and robust with minor modification

@joshuali925
Copy link
Contributor

That will be part of the basename here. I think it would be something like /basepath/app/opendistro-reports, you can get Kibana server.basepath if you remove the plugin path.

@ylasri
Copy link

ylasri commented Feb 3, 2021

Hi @zhongnansu

Only some parameters from Kibana.yml are exposed via CoreSetup

  • server.port
  • server.host
  • server.name
  • server.basePath

Theses parameters can be accessed as follow from any server method that has CoreSetup as a parameter

  const { protocol, port, hostname, name } = core.http.getServerInfo();
  const basePath = core.http.basePath.serverBasePath;
core.http.getServerInfo() is type of HttpServerInfo 

/** @public */
export interface HttpServerInfo {
  /** The name of the Kibana server */
  name: string;
  /** The hostname of the server */
  hostname: string;
  /** The port the server is listening on */
  port: number;
  /** The protocol used by the server */
  protocol: 'http' | 'https' | 'socket';
}

The CoreSetup can instance is the one used at the server level plugin initilization

public setup(core: CoreSetup) {
  ....
  //Register server side APIs
  registerRoutes(router, core);
  ....
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants