commit be1576f26cc3ea46f879b31352476d00ae3eb056 Author: Andrea Cavalli Date: Wed Mar 2 12:36:45 2022 +0100 Initial commit diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..436c30b --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,67 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path + +name: Maven Package + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + strategy: + matrix: + include: + - { os: ubuntu-20.04, arch: "linux/amd64" } + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: "recursive" + - name: Setup variables + shell: bash + run: | + # ====== Variables + export REVISION=${{ github.run_number }} + + echo "REVISION=$REVISION" >> $GITHUB_ENV + - name: Set up JDK 17 + if: github.ref == 'refs/heads/master' + uses: actions/setup-java@v1 + with: + java-version: 17 + server-id: mchv-release-distribution + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} +# - name: Deploy lucene to Maven (Release) +# if: github.ref == 'refs/heads/master' +# shell: bash +# run: | +# cd lucene +# ./gradlew assemble -x test -x errorprone publishToMavenLocal -x signJarsPublication +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-core -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/core/build/libs/lucene-core-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/core/build/libs/lucene-core-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/core/build/libs/lucene-core-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-join -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/join/build/libs/lucene-join-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/join/build/libs/lucene-join-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/join/build/libs/lucene-join-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-analysis-common -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/analysis/common/build/libs/lucene-analysis-common-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/analysis/common/build/libs/lucene-analysis-common-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/analysis/common/build/libs/lucene-analysis-common-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-analysis-icu -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/analysis/icu/build/libs/lucene-analysis-icu-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/analysis/icu/build/libs/lucene-analysis-icu-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/analysis/icu/build/libs/lucene-analysis-icu-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-codecs -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/codecs/build/libs/lucene-codecs-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/codecs/build/libs/lucene-codecs-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/codecs/build/libs/lucene-codecs-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-backward-codecs -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/backward-codecs/build/libs/lucene-backward-codecs-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/backward-codecs/build/libs/lucene-backward-codecs-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/backward-codecs/build/libs/lucene-backward-codecs-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-queries -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/queries/build/libs/lucene-queries-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/queries/build/libs/lucene-queries-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/queries/build/libs/lucene-queries-9.0.0-SNAPSHOT-sources.jar +# mvn deploy:deploy-file -DgroupId=org.lucene -DartifactId=lucene-misc -Dversion=9.0.0-SNAPSHOT -DgeneratePom=true -Dpackaging=jar -DrepositoryId=mchv-release-distribution -Durl=https://mvn.mchv.eu/repository/mchv-snapshot -Dfile=lucene/misc/build/libs/lucene-misc-9.0.0-SNAPSHOT.jar -Djavadoc=lucene/misc/build/libs/lucene-misc-9.0.0-SNAPSHOT-javadoc.jar -Dsources=lucene/misc/build/libs/lucene-misc-9.0.0-SNAPSHOT-sources.jar +# env: +# MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} +# MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} + - name: Deploy to Maven (Release) + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "REVISION: $REVISION" + + mvn -B -Drevision=${REVISION} -Ddbengine.ci=true clean deploy + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..9759ec2 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +dbserver diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/it/cavallium/dbengine/database/remote/QuicServer.java b/src/main/java/it/cavallium/dbengine/database/remote/QuicServer.java new file mode 100644 index 0000000..996ce26 --- /dev/null +++ b/src/main/java/it/cavallium/dbengine/database/remote/QuicServer.java @@ -0,0 +1,49 @@ +package it.cavallium.dbengine.database.remote; + +import io.netty.handler.ssl.ClientAuth; +import io.netty.incubator.codec.quic.InsecureQuicTokenHandler; +import io.netty.incubator.codec.quic.QuicSslContext; +import io.netty.incubator.codec.quic.QuicSslContextBuilder; +import it.cavallium.dbengine.rpc.current.data.ServerBoundRequest; +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Objects; + +public class QuicServer { + + public static void main(String[] args) throws URISyntaxException { + String keyFileLocation = System.getProperty("it.cavalliumdb.keyFile", null); + String keyFilePassword = System.getProperty("it.cavalliumdb.keyPassword", null); + String certFileLocation = System.getProperty("it.cavalliumdb.certFile", null); + String clientCertsLocation = System.getProperty("it.cavalliumdb.clientCerts", null); + String bindAddress = Objects.requireNonNull(System.getProperty("it.cavalliumdb.bindAddress", null), "Empty bind address"); + var bindURI = new URI("inet://" + bindAddress); + + QuicSslContext sslContext = QuicSslContextBuilder + .forServer(new File(keyFileLocation), keyFilePassword, new File(certFileLocation)) + .trustManager(new File(clientCertsLocation)) + .applicationProtocols("db/0.9") + .clientAuth(ClientAuth.REQUIRE) + .build(); + var qs = reactor.netty.incubator.quic.QuicServer + .create() + .port(bindURI.getPort()) + .host(bindURI.getHost()) + .tokenHandler(InsecureQuicTokenHandler.INSTANCE) + .secure(sslContext) + .handleStream((in, out) -> in + .withConnection(conn -> conn.addHandler(new RPCServerBoundRequestDecoder())) + .receiveObject() + .doFirst(() -> { + System.out.println("###################################Stream created"); + }) + .cast(ServerBoundRequest.class) + .log() + .then() + ); + qs.warmup().block(); + var conn = qs.bindNow(); + conn.onDispose().block(); + } +} diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e69de29