Skip to content
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

Migrate Jetty Proxy to Airlift #382

Merged
merged 9 commits into from
Jun 30, 2024
Merged

Conversation

oneonestar
Copy link
Member

@oneonestar oneonestar commented Jun 6, 2024

Description

Second part of Airlift migration #41. Depends on #317.
This PR migrate Jetty Proxy (ie. ProxyHandler and ProxyServletImpl) to Airlift.

Motivation

  • Fix Can't access application after configure SSL #242. Merge requestRouter, applicationConnectors and adminConnectors ports into one single port managed by Airlift. The TLS issues caused by routing between these ports will be gone.
  • Better control of the proxy request and response logic. The old implementation used Jetty ProxyServlet and overwrote different methods, making it difficult to add new features. By handling the request and response manually, we have full control of the request/response flow. This makes implementing query retries or query result caching much easier.
  • All configurations related to networking and TLS are done by Airlift config, which aligns with Trino. For example, the following config enable TLS for gateway:
httpConfig:
    http-server.http.enabled: false
    http-server.https.enabled: true
    http-server.https.port: 9080
    http-server.https.keystore.path: cert.jks
    http-server.https.keystore.key: changeme
    node.environment: test

TODO

  • Update docs on how to config & run
  • Document the incompatible changes and provide a migration guide.

Release notes

( ) Release notes are required, with the following suggested text:

* Replace Jetty Proxy with Airlift
* (TODO) Document the incompatible changes

@cla-bot cla-bot bot added the cla-signed label Jun 6, 2024
@oneonestar oneonestar mentioned this pull request Jun 7, 2024
3 tasks
@oneonestar oneonestar force-pushed the star/merge_ports branch 7 times, most recently from ac47167 to 9ef8f23 Compare June 7, 2024 06:08
@oneonestar oneonestar changed the title (WIP) Migrate Jetty Proxy to Airlift Migrate Jetty Proxy to Airlift Jun 7, 2024
@oneonestar oneonestar marked this pull request as ready for review June 7, 2024 06:08
@oneonestar oneonestar force-pushed the star/merge_ports branch 7 times, most recently from fa7dcaf to 4a3df12 Compare June 13, 2024 01:48
@mosabua
Copy link
Member

mosabua commented Jun 15, 2024

I merged #317 now. Once you rebase here you might be able to address my comment about the config here. I think we should end up with the same config as in Trino ideally. So

jvm.config
config.properties
node.properties (maybe not even necessary)
log.properties

If we leave the http config in this PR in the YAML file for now I am good with that but maybe we can already have all of them under one config node or so

@oneonestar
Copy link
Member Author

  • jvm.config
    • This is read by launcher.py. We can't set JVM config the config file unless we write our own version of launcher.py which supports YAML.
  • node.properties (maybe not even necessary)
    • Similar to above, launcher.py read this file and prepare the directories and symlinks. We can set log.output-file in httpConfig without using node.properties.
  • log.properties
    • Airlift expects this as a file LoggingConfiguration.java. We can allow setting log level in YAML, read the YAML, write them to a properties file and sent the file path to Airlift. I'm not sure if we want to do this.
  • config.properties
    • Everything that can be set in config.properties for Airlift can be set in httpConfig.

@mosabua
Copy link
Member

mosabua commented Jun 17, 2024

  • jvm.config

    • This is read by launcher.py. We can't set JVM config the config file unless we write our own version of launcher.py which supports YAML.

Yeah.. we can do that later .. ideally NOT with a python requirement.

  • node.properties (maybe not even necessary)

    • Similar to above, launcher.py read this file and prepare the directories and symlinks. We can set log.output-file in httpConfig without using node.properties.
  • log.properties

Agreed

  • Airlift expects this as a file LoggingConfiguration.java. We can allow setting log level in YAML, read the YAML, write them to a properties file and sent the file path to Airlift. I'm not sure if we want to do this.

Probably not in this PR. We will work with the airlift team to figure out how to proceed in terms of supporting yaml or toml or whatever to do next.

  • config.properties

    • Everything that can be set in config.properties for Airlift can be set in httpConfig.

Given the scope is way larger than just configuring HTTP I would hope we can come up with a better name.. just config or globalConfig or I dont know..

@oneonestar
Copy link
Member Author

How about serverConfig?

@mosabua
Copy link
Member

mosabua commented Jun 18, 2024

How about serverConfig?

Thats good with me. @vishalya @willmostly @Chaho12 ?

@Chaho12
Copy link
Member

Chaho12 commented Jun 18, 2024

How about serverConfig?

sounds good as it replaces requestRouter & server configs in yaml.

Btw why is historySize and requestBufferSize removed? does gateway now read all data from history?

@oneonestar
Copy link
Member Author

For historySize, AFAIK we never use this value. No code is using this value since the initial git commit.

The equivalent for requestBufferSize is http-client.request-buffer-size in Airlift. Let me update the doc for that.

@oneonestar oneonestar force-pushed the star/merge_ports branch 3 times, most recently from b80bc13 to 712e349 Compare June 26, 2024 06:25
@wendigo
Copy link
Contributor

wendigo commented Jun 26, 2024

@mosabua Let's merge it and improve in follow ups

@mosabua
Copy link
Member

mosabua commented Jun 26, 2024

We decided in team sync today that we will merge early next week to give @vishalya and others a chance to look.

@wendigo
Copy link
Contributor

wendigo commented Jun 26, 2024

@mosabua sure, I'd prefer to merge it now and improve it right away but I'm fine with delaying that

@mosabua
Copy link
Member

mosabua commented Jun 26, 2024

@mosabua sure, I'd prefer to merge it now and improve it right away but I'm fine with delaying that

Monday ;-)

@wendigo
Copy link
Contributor

wendigo commented Jun 26, 2024

@mosabua ages :P

@vishalya
Copy link
Member

The changes look good. I was able to run it locally with the instructions provided on the PR.
So I am with merging this PR.

@vishalya vishalya assigned vishalya and unassigned vishalya Jun 30, 2024
Copy link
Member

@mosabua mosabua left a comment

Choose a reason for hiding this comment

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

Alright .. lets ship this. Anybody .. please send any follow up fixes as new PRs.

@mosabua
Copy link
Member

mosabua commented Jun 30, 2024

Also .. @vishalya .. please also approve the PR.

@mosabua mosabua merged commit 7394d26 into trinodb:main Jun 30, 2024
2 checks passed
@github-actions github-actions bot added this to the 10 milestone Jun 30, 2024
@mosabua
Copy link
Member

mosabua commented Jun 30, 2024

Here you go @wendigo and @oneonestar .. it hit earlier than Monday after all ;-)

@oneonestar oneonestar deleted the star/merge_ports branch June 30, 2024 04:59
@v2kk
Copy link
Contributor

v2kk commented Jul 17, 2024

Hi guys, the current version of

does not handle proxy for DELETE method, so that client can not cancel query on Trino backend, it causes queries submitted from airflow will be failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Can't access application after configure SSL
7 participants