diff --git a/docker/Dockerfile b/docker/Dockerfile index 19acf1951..a6f9679f8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -40,14 +40,16 @@ RUN \ microdnf install -y tar less shadow-utils && \ groupadd trino --gid 1000 && \ useradd trino --uid 1000 --gid 1000 --create-home && \ - mkdir -p /usr/lib/trino-gateway /etc/trino-gateway && \ - chown -R "trino:trino" /usr/lib/trino-gateway /etc/trino-gateway + mkdir -p /usr/lib/trino-gateway /data/trino-gateway && \ + chown -R "trino:trino" /usr/lib/trino-gateway /data/trino-gateway -COPY --chown=trino:trino gateway-ha /usr/lib/trino-gateway +ARG TRINO_GATEWAY_VERSION +COPY --chown=trino:trino trino-gateway-server-${TRINO_GATEWAY_VERSION} /usr/lib/trino-gateway +COPY --chown=trino:trino default/etc /etc/trino-gateway EXPOSE 8080 USER trino:trino -CMD java -jar /usr/lib/trino-gateway/gateway-ha-jar-with-dependencies.jar "/etc/trino-gateway/config.yaml" +CMD ["/usr/lib/trino-gateway/bin/run-trino-gateway"] HEALTHCHECK --interval=10s --timeout=5s --start-period=10s \ CMD /usr/lib/trino-gateway/bin/health-check diff --git a/docker/bin/run-trino-gateway b/docker/bin/run-trino-gateway new file mode 100755 index 000000000..5c03d8d81 --- /dev/null +++ b/docker/bin/run-trino-gateway @@ -0,0 +1,10 @@ +#!/bin/bash + +set -xeuo pipefail + +launcher_opts=(--etc-dir /etc/trino-gateway --config /etc/trino-gateway/config.yaml) +if ! grep -s -q 'node.id' /etc/trino-gateway/node.properties; then + launcher_opts+=("-Dnode.id=${HOSTNAME}") +fi + +exec /usr/lib/trino-gateway/bin/launcher run "${launcher_opts[@]}" "$@" diff --git a/docker/build.sh b/docker/build.sh index 027c2dd03..a1bb8d382 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -95,24 +95,24 @@ function temurin_jdk_link() { check_environment if [ -n "$TRINO_GATEWAY_VERSION" ]; then - echo "๐ŸŽฃ Downloading Trino Gateway server artifact for release version ${TRINO_GATEWAY_VERSION}" - "${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:gateway-ha:${TRINO_GATEWAY_VERSION}:jar:jar-with-dependencies" + echo "๐ŸŽฃ Downloading Gateway server artifact for release version ${TRINO_GATEWAY_VERSION}" + "${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:trino-gateway-server:${TRINO_GATEWAY_VERSION}:tar.gz" local_repo=$("${SOURCE_DIR}/mvnw" -B help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) - trino_gateway_ha="$local_repo/io/trino/gateway/gateway-ha/${TRINO_GATEWAY_VERSION}/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar" + trino_gateway_ha="$local_repo/io/trino/gateway/trino-gateway-server/${TRINO_GATEWAY_VERSION}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz" chmod +x "$trino_gateway_ha" else TRINO_GATEWAY_VERSION=$("${SOURCE_DIR}/mvnw" -f "${SOURCE_DIR}/pom.xml" --quiet help:evaluate -Dexpression=project.version -DforceStdout) - echo "๐ŸŽฏ Using currently built artifacts from the gateway-ha module with version ${TRINO_GATEWAY_VERSION}" - trino_gateway_ha="${SOURCE_DIR}/gateway-ha/target/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar" + echo "๐ŸŽฏ Using currently built artifacts with version ${TRINO_GATEWAY_VERSION}" + trino_gateway_ha="${SOURCE_DIR}/trino-gateway-server/target/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz" fi echo "๐Ÿงฑ Preparing the image build context directory" WORK_DIR="$(mktemp -d)" -GATEWAY_WORK_DIR="${WORK_DIR}/gateway-ha" -mkdir "${GATEWAY_WORK_DIR}" -cp "$trino_gateway_ha" "${GATEWAY_WORK_DIR}/gateway-ha-jar-with-dependencies.jar" -cp -R bin "${GATEWAY_WORK_DIR}" -cp "${SCRIPT_DIR}/Dockerfile" "${WORK_DIR}" +cp "$trino_gateway_ha" "${WORK_DIR}/" +tar -C "${WORK_DIR}" -xzf "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz" +rm "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz" +cp -R bin "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}" +cp -R default "${WORK_DIR}/" TAG_PREFIX="trino-gateway:${TRINO_GATEWAY_VERSION}" #version file is used by the Helm chart test @@ -131,7 +131,8 @@ for arch in "${ARCHITECTURES[@]}"; do --build-arg TRINO_GATEWAY_BASE_IMAGE="${TRINO_GATEWAY_BASE_IMAGE}" \ --platform "linux/$arch" \ -f Dockerfile \ - -t "${TAG_PREFIX}-$arch" + -t "${TAG_PREFIX}-$arch" \ + --build-arg "TRINO_GATEWAY_VERSION=${TRINO_GATEWAY_VERSION}" done echo "๐Ÿงน Cleaning up the build context directory" diff --git a/docker/config.yaml b/docker/default/etc/config.yaml similarity index 100% rename from docker/config.yaml rename to docker/default/etc/config.yaml diff --git a/docker/default/etc/jvm.config b/docker/default/etc/jvm.config new file mode 100644 index 000000000..65e104521 --- /dev/null +++ b/docker/default/etc/jvm.config @@ -0,0 +1,18 @@ +-server +-XX:InitialRAMPercentage=80 +-XX:MaxRAMPercentage=80 +-XX:G1HeapRegionSize=32M +-XX:+ExplicitGCInvokesConcurrent +-XX:+HeapDumpOnOutOfMemoryError +-XX:+ExitOnOutOfMemoryError +-XX:-OmitStackTraceInFastThrow +-XX:ReservedCodeCacheSize=256M +-XX:PerMethodRecompilationCutoff=10000 +-XX:PerBytecodeRecompilationCutoff=10000 +-Djdk.attach.allowAttachSelf=true +-Djdk.nio.maxCachedBufferSize=2000000 +# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647) +-XX:+UnlockDiagnosticVMOptions +-XX:GCLockerRetryAllocationCount=32 +# Allow loading dynamic agent used by JOL +-XX:+EnableDynamicAgentLoading diff --git a/docker/default/etc/log.properties b/docker/default/etc/log.properties new file mode 100644 index 000000000..abee45ebc --- /dev/null +++ b/docker/default/etc/log.properties @@ -0,0 +1,2 @@ +# Enable verbose logging from Trino +#io.trino=DEBUG diff --git a/docker/default/etc/node.properties b/docker/default/etc/node.properties new file mode 100644 index 000000000..b9dd51c54 --- /dev/null +++ b/docker/default/etc/node.properties @@ -0,0 +1,2 @@ +node.environment=docker +node.data-dir=/data/trino-gateway diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 0a635055a..0c22adf86 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -12,10 +12,6 @@ services: start_period: 20s ports: - "8080:8080" - volumes: - - target: /etc/trino-gateway/config.yaml - source: ./config.yaml - type: bind postgres: image: ${TRINO_GATEWAY_POSTGRES_IMAGE:-postgres} diff --git a/docs/development.md b/docs/development.md index d493218d4..26a8bf156 100644 --- a/docs/development.md +++ b/docs/development.md @@ -35,8 +35,8 @@ To enable them, set the environment variable `TG_RUN_ORACLE_TESTS=true`. These t will always be run in GitHub CI. ```shell -cd gateway-ha/target/ -java -jar gateway-ha-{{VERSION}}-jar-with-dependencies.jar ../config.yaml +cd trino-gateway-server/target/trino-gateway-server-{{VERSION}} +bin/launcher start --config path/to/config.yaml ``` #### In Docker diff --git a/docs/docker.md b/docs/docker.md index 875ca4a77..a2073639e 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -151,8 +151,7 @@ details found in the `docker-compose.yml` file. ## Configuration -The image uses the configuration file `docker/config.yaml` from the project -checkout, and mounts it at `/etc/trino-gateway/config.yaml`. +The image uses the configuration file `docker/default/etc/config.yaml` from the project checkout. ## Health check diff --git a/docs/installation.md b/docs/installation.md index 533e569f1..3ddb3599a 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -120,15 +120,24 @@ Find more information in [the related Trino documentation](https://trino.io/docs ## Configuration -After downloading or building the JAR, rename it to `gateway-ha.jar`, -and place it in a directory with read and write access such as `/opt/trinogateway`. +After downloading or building the TAR, extract it to `trino-gateway-server`. Copy the example config file `config.yaml` from the `gateway-ha/` -directory into the same directory, and update the configuration as needed. +directory into etc directory inside trino-gateway-server, and update the configuration as needed. Each component of the Trino Gateway has a corresponding node in the configuration YAML file. +### JVM config + +Create the JVM configuration file `jvm.config` in the `etc` directory. Example config: + +````properties +-server +-XX:InitialRAMPercentage=80 +-XX:MaxRAMPercentage=80 +```` + ### Secrets in configuration file Environment variables can be used as values in the configuration file. @@ -224,12 +233,10 @@ proxyResponseConfiguration: ## Running Trino Gateway -Start Trino Gateway with the following java command in the directory of the -JAR and YAML files: +Start Trino Gateway with the following command by cd to the Trino Gateway server directory : ```shell -java -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80 \ - -jar gateway-ha.jar config.yaml +bin/launcher start --config=etc/config.yaml ``` ### Helm @@ -296,10 +303,10 @@ However, a [Secret](https://kubernetes.io/docs/concepts/configuration/secret/) is recommended to protect the database credentials required for this configuration. -By default, the Trino Gateway process is started with the following command: +By default, the Trino Gateway process is started with the following command from the trino-gateway-server directory after extracting the TAR: ```shell -java -XX:MinRAMPercentage=80.0 -XX:MaxRAMPercentage=80.0 -jar /usr/lib/trino-gateway/gateway-ha-jar-with-dependencies.jar /etc/trino-gateway/config.yaml +bin/launcher start --config=etc/config.yaml ``` You can customize details with the `command` node. It accepts a list, that must diff --git a/docs/migration-to-airlift.md b/docs/migration-to-airlift.md index d930fce7f..bd681248a 100644 --- a/docs/migration-to-airlift.md +++ b/docs/migration-to-airlift.md @@ -133,18 +133,12 @@ serverConfig: ``` * The `log.levels-file` JVM option is no longer supported. -### JVM startup arguments +### Server startup command -The first arg `server` has been removed. +cd to the Trino Gateway server directory after extracting the TAR and use the following command: -Old config: -```bash -java -jar gateway-ha.jar server config.yaml -``` - -New config: ```bash -java -jar gateway-ha.jar config.yaml +bin/launcher start --config=etc/config.yaml ``` ### Format of `extraWhitelistPaths` diff --git a/docs/quickstart.md b/docs/quickstart.md index 42070458f..98ad0ce9c 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -15,27 +15,31 @@ under the project root folder, and run it at the temporary directory. It copies the following, necessary files to current directory: -- `gateway-ha.jar` from Maven Central using the version specified in the script -- `config.yaml` from the `docs` folder of the current project folder +- `trino-gateway-server.tar.gz` from Maven Central using the version specified in the script +- `config.yaml` from the `docs` folder of the current project folder to etc directory of the Trino Gateway server ```shell #!/usr/bin/env sh -VERSION=15 -BASE_URL="https://repo1.maven.org/maven2/io/trino/gateway/gateway-ha" -JAR_FILE="gateway-ha-$VERSION-jar-with-dependencies.jar" -GATEWAY_JAR="gateway-ha.jar" +VERSION=16 +BASE_URL="https://repo1.maven.org/maven2/io/trino/gateway/trino-gateway-server" +GATEWAY_TAR="trino-gateway-server-$VERSION.tar.gz" +GATEWAY_DIR="trino-gateway-server-$VERSION" CONFIG_YAML="config.yaml" # Copy necessary files -copy_files() { - if [[ ! -f "$GATEWAY_JAR" ]]; then - echo "Fetching $GATEWAY_JAR version $VERSION" - curl -O "$BASE_URL/$VERSION/$JAR_FILE" - mv "$JAR_FILE" "$GATEWAY_JAR" +copy_and_extract_files() { + if [[ ! -f "$GATEWAY_TAR" ]]; then + echo "Fetching $GATEWAY_TAR" + curl -O "$BASE_URL/$VERSION/$GATEWAY_TAR" fi - [[ ! -f "$CONFIG_YAML" ]] && cp ../docs/$CONFIG_YAML . + tar -xzf "$GATEWAY_TAR" + mkdir -p "$GATEWAY_DIR"/etc + echo -e "-server\n-XX:MinRAMPercentage=80\n-XX:MaxRAMPercentage=80" > "$GATEWAY_DIR"/etc/jvm.config + + [[ ! -f "$CONFIG_YAML" ]] && cp docs/$CONFIG_YAML . + cp $CONFIG_YAML "$GATEWAY_DIR"/etc/ } # Start PostgreSQL database if not running @@ -51,19 +55,19 @@ start_postgres_db() { } # Main execution flow -copy_files +copy_and_extract_files start_postgres_db # Start Trino Gateway server echo "Starting Trino Gateway server..." -java -Xmx1g -jar ./$GATEWAY_JAR ./$CONFIG_YAML +./$GATEWAY_DIR/bin/launcher start --config=$GATEWAY_DIR/etc/$CONFIG_YAML ``` You can clean up by running ```shell docker kill local-postgres && docker rm local-postgres -kill -5 $(jps | grep gateway-ha.jar | cut -d' ' -f1) +kill -5 $(jps | grep HaGatewayLauncher | cut -d' ' -f1) ``` ## Add Trino backends diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/HaGatewayLauncher.java b/gateway-ha/src/main/java/io/trino/gateway/ha/HaGatewayLauncher.java index 9b5e34293..9efa79c29 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/HaGatewayLauncher.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/HaGatewayLauncher.java @@ -109,10 +109,11 @@ public static void main(String[] args) throws Exception { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); - if (args.length != 1) { - throw new IllegalArgumentException("Expected exactly one argument (path of configuration file)"); + String configFile = System.getProperty("config"); + if (configFile == null) { + throw new IllegalArgumentException("Configuration file not specified. Use -Dconfig="); } - String config = Files.readString(Path.of(args[0])); + String config = Files.readString(Path.of(configFile)); HaGatewayConfiguration haGatewayConfiguration = objectMapper.readValue(replaceEnvironmentVariables(config), HaGatewayConfiguration.class); FlywayMigration.migrate(haGatewayConfiguration.getDataStore()); List modules = addModules(haGatewayConfiguration); diff --git a/gateway-ha/src/test/java/io/trino/gateway/TrinoGatewayRunner.java b/gateway-ha/src/test/java/io/trino/gateway/TrinoGatewayRunner.java index 1be8dc0ae..6c047cc7d 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/TrinoGatewayRunner.java +++ b/gateway-ha/src/test/java/io/trino/gateway/TrinoGatewayRunner.java @@ -60,7 +60,8 @@ public static void main(String[] args) mysql.withCopyFileToContainer(forClasspathResource("add_backends_mysql.sql"), "/docker-entrypoint-initdb.d/2-add_backends_mysql.sql"); mysql.setPortBindings(List.of("3306:3306")); mysql.start(); - HaGatewayLauncher.main(new String[] {"gateway-ha/config.yaml"}); + System.setProperty("config", "gateway-ha/config.yaml"); + HaGatewayLauncher.main(new String[] {}); log.info("======== SERVER STARTED ========"); } diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaMultipleBackend.java b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaMultipleBackend.java index e21c1b033..7ec1ef12c 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaMultipleBackend.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaMultipleBackend.java @@ -120,8 +120,8 @@ public MockResponse dispatch(RecordedRequest request) HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "test-config-template.yml"); // Start Gateway - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); // Now populate the backend HaGatewayTestUtils.setUpBackend( "trino1", "http://localhost:" + backend1Port, "externalUrl", true, "adhoc", routerPort); diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaSingleBackend.java b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaSingleBackend.java index 265ce5ae9..70cbad799 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaSingleBackend.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaSingleBackend.java @@ -58,8 +58,8 @@ void setup() File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "test-config-template.yml"); // Start Gateway - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); // Now populate the backend HaGatewayTestUtils.setUpBackend( "trino1", "http://localhost:" + backendPort, "externalUrl", true, "adhoc", routerPort); diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaWithRoutingRulesSingleBackend.java b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaWithRoutingRulesSingleBackend.java index 3bc3cec55..2fd7c0713 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaWithRoutingRulesSingleBackend.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/TestGatewayHaWithRoutingRulesSingleBackend.java @@ -55,8 +55,8 @@ void setup() File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "test-config-with-routing-template.yml"); // Start Gateway - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); // Now populate the backend HaGatewayTestUtils.setUpBackend( "trino1", "http://localhost:" + backendPort, "externalUrl", true, "system", routerPort); diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/TestNoXForwarded.java b/gateway-ha/src/test/java/io/trino/gateway/ha/TestNoXForwarded.java index 4081db3bc..33e7f10de 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/TestNoXForwarded.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/TestNoXForwarded.java @@ -57,8 +57,8 @@ void setup() File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "test-config-without-x-forwarded-template.yml"); // Start Gateway - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); // Now populate the backend HaGatewayTestUtils.setUpBackend( "trino1", "http://localhost:" + backendPort, "externalUrl", true, "adhoc", routerPort); diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/TestTrinoResource.java b/gateway-ha/src/test/java/io/trino/gateway/ha/TestTrinoResource.java index 99a00dcb6..dedbb1c20 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/TestTrinoResource.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/TestTrinoResource.java @@ -70,8 +70,8 @@ void setup() resourceGroupManager = new HaResourceGroupsManager(connectionManager); // Start Trino Gateway so migrations are run to create tables before inserting test data - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); prepareData(); } diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingAPI.java b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingAPI.java index 293e77bdf..48ae0a88e 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingAPI.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingAPI.java @@ -63,8 +63,8 @@ void setup() File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "test-config-with-routing-rules-api.yml"); // Start Gateway - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); // Now populate the backend HaGatewayTestUtils.setUpBackend( "trino1", "http://localhost:" + backendPort, "externalUrl", true, "adhoc", routerPort); diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestAuthorization.java b/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestAuthorization.java index 08dfd620a..214fccd48 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestAuthorization.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestAuthorization.java @@ -55,8 +55,8 @@ void setup() { postgresql.start(); File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(postgresql, routerPort, "auth/auth-test-config.yml"); - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); } @Test diff --git a/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestOIDC.java b/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestOIDC.java index e64dbb983..3337e8464 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestOIDC.java +++ b/gateway-ha/src/test/java/io/trino/gateway/ha/security/TestOIDC.java @@ -146,9 +146,9 @@ void setup() File testConfigFile = HaGatewayTestUtils.buildGatewayConfig(gatewayBackendDatabase, ROUTER_PORT, "auth/oauth-test-config.yml"); - String[] args = {testConfigFile.getAbsolutePath()}; System.out.println(ROUTER_PORT); - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); } @Test diff --git a/gateway-ha/src/test/java/io/trino/gateway/proxyserver/TestProxyRequestHandler.java b/gateway-ha/src/test/java/io/trino/gateway/proxyserver/TestProxyRequestHandler.java index 654023fa4..c5792839a 100644 --- a/gateway-ha/src/test/java/io/trino/gateway/proxyserver/TestProxyRequestHandler.java +++ b/gateway-ha/src/test/java/io/trino/gateway/proxyserver/TestProxyRequestHandler.java @@ -85,8 +85,8 @@ public MockResponse dispatch(RecordedRequest request) File testConfigFile = buildGatewayConfig(postgresql, routerPort, "test-config-template.yml"); - String[] args = {testConfigFile.getAbsolutePath()}; - HaGatewayLauncher.main(args); + System.setProperty("config", testConfigFile.getAbsolutePath()); + HaGatewayLauncher.main(new String[] {}); setUpBackend("custom", "http://localhost:" + customBackendPort, "externalUrl", true, "adhoc", routerPort); } diff --git a/pom.xml b/pom.xml index 6f5ab6d62..31c59df5b 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ gateway-ha + trino-gateway-server scm:git:git://github.com/trinodb/trino-gateway.git @@ -44,6 +45,7 @@ true true clean verify -DskipTests + 304 diff --git a/trino-gateway-server/pom.xml b/trino-gateway-server/pom.xml new file mode 100644 index 000000000..21bc1c3c1 --- /dev/null +++ b/trino-gateway-server/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + io.trino.gateway + trino-gateway-parent + 16-SNAPSHOT + + + trino-gateway-server + provisio + Trino Gateway - Server package + + + 2.1.4 + trino-gateway-server-${project.version} + + + io.trino.gateway.ha.HaGatewayLauncher + ${project.artifactId} + + + + false + + + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + ca.vanzyl.provisio.maven.plugins + provisio-maven-plugin + 1.0.24 + true + + + pack + + provision + + + ${project.basedir}/src/main/provisio + ${project.build.directory}/${server.tar.package} + + + + + + + io.takari.maven.plugins + takari-lifecycle-plugin + ${dep.takari.version} + + none + ${takari.skip} + + + + + org.basepom.maven + duplicate-finder-maven-plugin + + + aircompressor.* + + + + + + + diff --git a/trino-gateway-server/src/main/provisio/trino-gateway.xml b/trino-gateway-server/src/main/provisio/trino-gateway.xml new file mode 100644 index 000000000..cc4fc1212 --- /dev/null +++ b/trino-gateway-server/src/main/provisio/trino-gateway.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/trino-gateway-server/src/test/java/io/trino/gateway/server/TestDummy.java b/trino-gateway-server/src/test/java/io/trino/gateway/server/TestDummy.java new file mode 100644 index 000000000..8e2ae42db --- /dev/null +++ b/trino-gateway-server/src/test/java/io/trino/gateway/server/TestDummy.java @@ -0,0 +1,22 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.trino.gateway.server; + +import org.junit.jupiter.api.Test; + +public class TestDummy +{ + @Test + public void buildRequiresTestToExist() {} +}