Skip to content

Commit

Permalink
Merge branch 'main' into quarkus-loom
Browse files Browse the repository at this point in the history
  • Loading branch information
anavarr committed May 24, 2022
2 parents 0639068 + de381dc commit 671b2f3
Show file tree
Hide file tree
Showing 57 changed files with 969 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jakarta-rewrite.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Push changes to jakarta-rewrite
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.JAKARTA_PUSH_PAT }}
force: true
branch: jakarta-rewrite
- name: Report status
Expand Down
6 changes: 3 additions & 3 deletions bom/application/pom.xml
Expand Up @@ -50,7 +50,7 @@
<smallrye-context-propagation.version>1.2.2</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>2.7.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>2.21.0</smallrye-mutiny-vertx-binding.version>
<smallrye-mutiny-vertx-binding.version>2.22.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>3.16.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>1.1.2</smallrye-stork.version>
<jakarta.activation.version>1.2.1</jakarta.activation.version>
Expand Down Expand Up @@ -134,7 +134,7 @@
<netty.version>4.1.74.Final</netty.version>
<reactive-streams.version>1.0.3</reactive-streams.version>
<jboss-logging.version>3.5.0.Final</jboss-logging.version>
<mutiny.version>1.4.0</mutiny.version>
<mutiny.version>1.5.0</mutiny.version>
<kafka3.version>3.1.0</kafka3.version>
<lz4.version>1.8.0</lz4.version> <!-- dependency of the kafka-clients that could be overriden by other imported BOMs in the platform -->
<snappy.version>1.1.8.4</snappy.version>
Expand All @@ -159,7 +159,7 @@
<snakeyaml.version>1.30</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.3.4</mongo-client.version>
<mongo-crypt.version>1.4.0</mongo-crypt.version>
<mongo-crypt.version>1.2.1</mongo-crypt.version>
<proton-j.version>0.33.10</proton-j.version>
<okhttp.version>3.14.9</okhttp.version>
<hibernate-quarkus-local-cache.version>0.1.1</hibernate-quarkus-local-cache.version>
Expand Down
Expand Up @@ -254,7 +254,7 @@ public Index apply(PathVisit visit) {
"Can't read Jandex index from " + visit.getPath() + ": " + e.getMessage());
}
} catch (IOException e) {
throw new UncheckedIOException(e);
throw new UncheckedIOException("Can't read Jandex index from " + visit.getPath(), e);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/deploying-to-openshift.adoc
Expand Up @@ -361,7 +361,7 @@ quarkus.openshift.deployment-kind=Deployment
----

Since `Deployment` is a Kubernetes resource and not Openshift specific, it can't possibly leverage `ImageStream` resources, as is the case with `DeploymentConfig`. This means that the image references need to include the container image registry that hosts the image.
When the image is built, using Openshift builds (s2i binary and docker strategy) the Openshift internral image registry `image-registry.openshift-image-registry.svc:5000` will be used, unless an other registry has been explicitly specified by the user. Please note, that in the internal registry the project/namespace name is added as part of the image repository: `image-registry.openshift-image-registry.svc:5000/<project name>/<name>:<tag>`, so users will need to make sure that the target project/namespace name is aligned with the `quarkus.container-image.group`.
When the image is built, using Openshift builds (s2i binary and docker strategy) the Openshift internal image registry `image-registry.openshift-image-registry.svc:5000` will be used, unless an other registry has been explicitly specified by the user. Please note, that in the internal registry the project/namespace name is added as part of the image repository: `image-registry.openshift-image-registry.svc:5000/<project name>/<name>:<tag>`, so users will need to make sure that the target project/namespace name is aligned with the `quarkus.container-image.group`.

[source,properties]
----
Expand Down
Expand Up @@ -16,7 +16,7 @@ ifdef::prerequisites-docker[]
* A working container runtime (Docker or Podman)
endif::[]
ifdef::prerequisites-docker-compose[]
* Docker and Docker Compose
* Docker and Docker Compose or xref:podman.adoc[Podman], and Docker Compose
endif::[]
ifndef::prerequisites-no-cli[]
* Optionally the xref:cli-tooling.adoc[Quarkus CLI] if you want to use it
Expand Down
14 changes: 13 additions & 1 deletion docs/src/main/asciidoc/opentelemetry.adoc
Expand Up @@ -107,13 +107,15 @@ quarkus.opentelemetry.enabled=true // <2>
quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:4317 // <3>
quarkus.opentelemetry.tracer.exporter.otlp.headers=Authorization=Bearer my_secret // <4>
quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n // <5>
----

<1> All spans created from the application will include an OpenTelemetry `Resource` indicating the span was created by the `myservice` application. If not set, it will default to the artifact id.
<2> Whether OpenTelemetry is enabled or not. The default is `true`, but shown here to indicate how it can be disabled
<3> gRPC endpoint for sending spans
<4> Optional gRPC headers commonly used for authentication

<5> Add tracing information into log message.
== Run the application

The first step is to configure and start the https://opentelemetry.io/docs/collector/[OpenTelemetry Collector] to receive, process and export telemetry data to https://www.jaegertracing.io/[Jaeger] that will display the captured traces.
Expand Down Expand Up @@ -199,6 +201,16 @@ $ curl http://localhost:8080/hello
hello
----

When the first request has been submitted, you will be able to see the tracing information in the logs:

[source]
----
10:49:02 INFO traceId=, parentId=, spanId=, sampled= [io.quarkus] (main) Installed features: [cdi, opentelemetry, opentelemetry-otlp-exporter, rest-client, resteasy, smallrye-context-propagation, vertx]
10:49:03 INFO traceId=17ceb8429b9f25b0b879fa1503259456, parentId=3125c8bee75b7ad6, spanId=58ce77c86dd23457, sampled=true [or.ac.op.TracedResource] (executor-thread-1) hello
10:49:03 INFO traceId=ad23acd6d9a4ed3d1de07866a52fa2df, parentId=, spanId=df13f5b45cf4d1e2, sampled=true [or.ac.op.TracedResource] (executor-thread-0) hello
----


Then visit the http://localhost:16686[Jaeger UI] to see the tracing information.

Hit `CTRL+C` to stop the application.
Expand Down
77 changes: 77 additions & 0 deletions docs/src/main/asciidoc/podman.adoc
@@ -0,0 +1,77 @@
////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
////
= Using Podman with Quarkus

https://podman.io/[Podman] is a daemonless and rootless container engine for developing, managing, and running OCI Containers on your Linux system or other OS.
Podman can be used the same way as Docker with the `podman-docker` package.

== Installing Podman on Linux

The Podman package is available in several Linux distributions. To install it for your OS, please refer to the https://podman.io/getting-started/installation[Podman installation guide].
Below is the short installation instruction for popular Linux distributions:

.Fedora
[source,bash]
----
sudo dnf install podman podman-docker docker-compose
----
.Ubuntu (21.04 and later)
[source,bash]
----
sudo apt install podman podman-docker docker-compose
----

=== After installation

Podman is a daemonless container engine. Most Quarkus Dev Services and Testcontainers expect a running Docker daemon listening at a Unix socket.
That's why the following steps are required.
[source,bash]
----
# Enable the podman socket with Docker REST API
systemctl --user enable podman.socket --now
# Set the required envvars
export DOCKER_HOST=unix:///run/user/${UID}/podman/podman.sock
export TESTCONTAINERS_RYUK_DISABLED=true
----
For a detailed explanation, see this https://quarkus.io/blog/quarkus-devservices-testcontainers-podman/[blog article].

To make changes permanent, add the exported environment variables to the "init" file from your shell. For example, the `bash` shell uses the `~/.bashrc` file:
[source,bash]
----
echo "export DOCKER_HOST=unix:///run/user/${UID}/podman/podman.sock" >> ~/.bashrc
echo "export TESTCONTAINERS_RYUK_DISABLED=true" >> ~/.bashrc
----

=== Short names of images

Testcontainers and Quarkus Dev Services also expect the container service they make requests against to be non-interactive.
In case you have multiple registries configured in your Docker or Podman configuration, and when using short image names, Podman responds with a prompt asking which registry should be used to pull images.

While we recommend you to avoid short names and always use fully specified names including the registry,
Testcontainers unfortunately relies on short names internally for the time being.
If you are using Testcontainers, either directly or through Dev Services,
you need to disable this prompt by setting the `short-name-mode="disabled"` configuration property of Podman in `/etc/containers/registries.conf`.

== Other operating systems

Containers are really Linux. As such, Linux containers cannot run natively on macOS or Windows.
Therefore, the containers must run in a Linux virtual machine (VM), and a Podman client interacts with that VM.
So a native hypervisor subsystem and virtualization software is used to run the Linux VM on the OS, and then containers are run within this VM.

.macOS
macOS users can install Podman through https://brew.sh/[Homebrew]. Once you have set up `brew`, you can use the `brew install` command to install Podman and `docker-compose`:
[source,bash]
----
brew install podman
brew install docker-compose
podman machine init
podman machine start
alias docker='podman'
----
For more details, please see the https://podman.io/getting-started/installation#macos[official Podman documentation] and this https://www.redhat.com/sysadmin/replace-docker-podman-macos[article].

.Windows
Please see the https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md[Podman for Windows guide] for setup and usage instructions.
@@ -1,5 +1,6 @@
package io.quarkus.hibernate.orm.runtime;

import java.util.Comparator;
import java.util.Locale;

import javax.enterprise.inject.Default;
Expand Down Expand Up @@ -37,6 +38,19 @@ public static <T> InjectableInstance<T> extensionInstanceForPersistenceUnit(Clas
new PersistenceUnitExtension.Literal(persistenceUnitName));
}

public static class PersistenceUnitNameComparator implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
if (DEFAULT_PERSISTENCE_UNIT_NAME.equals(o1)) {
return -1;
} else if (DEFAULT_PERSISTENCE_UNIT_NAME.equals(o2)) {
return +1;
} else {
return o1.compareTo(o2);
}
}
}

@Deprecated
public static <T> InjectableInstance<T> legacySingleExtensionInstanceForPersistenceUnit(Class<T> beanType,
String persistenceUnitName) {
Expand Down
Expand Up @@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
Expand All @@ -24,9 +23,9 @@
import org.hibernate.tool.schema.spi.ScriptTargetOutput;
import org.hibernate.tool.schema.spi.TargetDescriptor;

public class HibernateOrmDevConsoleInfoSupplier implements Supplier<HibernateOrmDevConsoleInfoSupplier.PersistenceUnitsInfo> {
import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;

private static final String DEFAULT = "<default>";
public class HibernateOrmDevConsoleInfoSupplier implements Supplier<HibernateOrmDevConsoleInfoSupplier.PersistenceUnitsInfo> {

public static final PersistenceUnitsInfo INSTANCE = new PersistenceUnitsInfo();

Expand Down Expand Up @@ -99,7 +98,7 @@ public PersistenceUnitsInfo get() {
public static class PersistenceUnitsInfo {

private final Map<String, PersistenceUnitInfo> persistenceUnits = Collections
.synchronizedMap(new TreeMap<>(new PersistenceUnitNameComparator()));
.synchronizedMap(new TreeMap<>(new PersistenceUnitUtil.PersistenceUnitNameComparator()));

public Collection<PersistenceUnitInfo> getPersistenceUnits() {
return persistenceUnits.values();
Expand Down Expand Up @@ -229,17 +228,4 @@ public String getType() {
}

}

static class PersistenceUnitNameComparator implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
if (DEFAULT.equals(o1)) {
return -1;
} else if (DEFAULT.equals(o2)) {
return +1;
} else {
return o1.compareTo(o2);
}
}
}
}
Expand Up @@ -7,6 +7,8 @@

import org.junit.jupiter.api.Test;

import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;

public class PersistenceUnitNameComparatorTestCase {

@Test
Expand All @@ -16,7 +18,7 @@ public void puNameComparatorTest() {
names.add("alpha");
names.add("<default>");
names.add("beta");
names.sort(new HibernateOrmDevConsoleInfoSupplier.PersistenceUnitNameComparator());
names.sort(new PersistenceUnitUtil.PersistenceUnitNameComparator());

assertThat(names.get(0)).isEqualTo("<default>");
assertThat(names.get(1)).isEqualTo("alpha");
Expand Down
Expand Up @@ -3,12 +3,17 @@
import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;
import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem;
import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem;
import io.quarkus.hibernate.search.orm.elasticsearch.HibernateSearchElasticsearchPersistenceUnitConfiguredBuildItem;
import io.quarkus.hibernate.search.orm.elasticsearch.runtime.HibernateSearchElasticsearchRuntimeConfig;
import io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole.HibernateSearchDevConsoleRecorder;

Expand All @@ -18,9 +23,13 @@ public class HibernateSearchElasticsearchDevConsoleProcessor {
@Record(RUNTIME_INIT)
public DevConsoleRuntimeTemplateInfoBuildItem collectBeanInfo(HibernateSearchDevConsoleRecorder recorder,
HibernateSearchElasticsearchRuntimeConfig runtimeConfig,
CurateOutcomeBuildItem curateOutcomeBuildItem) {
return new DevConsoleRuntimeTemplateInfoBuildItem("indexedEntityTypes",
recorder.infoSupplier(runtimeConfig), this.getClass(), curateOutcomeBuildItem);
CurateOutcomeBuildItem curateOutcomeBuildItem,
List<HibernateSearchElasticsearchPersistenceUnitConfiguredBuildItem> peristenceUnitBuildItems) {
Set<String> persistenceUnitNames = peristenceUnitBuildItems.stream()
.map(HibernateSearchElasticsearchPersistenceUnitConfiguredBuildItem::getPersistenceUnitName)
.collect(Collectors.toSet());
return new DevConsoleRuntimeTemplateInfoBuildItem("indexedPersistenceUnits",
recorder.infoSupplier(runtimeConfig, persistenceUnitNames), this.getClass(), curateOutcomeBuildItem);
}

@BuildStep
Expand Down
@@ -1,4 +1,7 @@
<a href="{urlbase}/entity-types" class="badge badge-light">
<i class="fa fa-boxes fa-fw"></i>
Persistence units <span class="badge badge-light">{info:indexedPersistenceUnits.persistenceUnits.size}</span></a>
<a href="{urlbase}/entity-types" class="badge badge-light">
<i class="fa fa-search fa-fw"></i>
Indexed entity types <span class="badge badge-light">{info:indexedEntityTypes.size()}</span></a>
Indexed Entities <span class="badge badge-light">{info:indexedPersistenceUnits.numberOfIndexedEntities}</span></a>
<br>
@@ -1,11 +1,14 @@
{#include main}
{#title}Indexed Entities{/title}
{#body}
{#if info:indexedEntityTypes.isEmpty}
{#if info:indexedPersistenceUnits.persistenceUnits.isEmpty}
<p>No indexed entities were found.</p>
{#else}
<form method="post" enctype="application/x-www-form-urlencoded">
<input id="index" type="submit" class="btn btn-primary mb-2" value="Reindex Entities" >
<input id="index" type="submit" class="btn btn-primary mb-2" value="Reindex Entities">
<br/>
{#for indexedPersistenceUnit in info:indexedPersistenceUnits.persistenceUnits}
<h4><span class="badge">Persistence Unit</span> <i class="badge badge-info">{indexedPersistenceUnit.persistenceUnitName}</i></h4>
<table id="table" class="table table-striped">
<colgroup>
<col span="1" style="width: 5%;">
Expand All @@ -16,19 +19,20 @@
<tr>
<th scope="col">
<div class="custom-control">
<input type="checkbox" class="form-check-input" id="check-all">
<input type="checkbox" class="form-check-input" onChange="handleSelectAll(this)">
</div>
</th>
<th scope="col">Entity name</th>
<th scope="col">Entity type</th>
</tr>
</thead>
<tbody>
{#for indexedEntityType in info:indexedEntityTypes}
{#for indexedEntityType in indexedPersistenceUnit.indexedEntities}
<tr>
<td>
<div class="custom-control">
<input type="checkbox" class="form-check-input checkbox" name="{indexedEntityType.jpaName}" id="{indexedEntityType.jpaName}">
<input type="checkbox" class="form-check-input checkbox" name="{indexedEntityType.jpaName}"
id="{indexedEntityType.jpaName}" value="{indexedPersistenceUnit.persistenceUnitName}">
</div>
</td>
<td>{indexedEntityType.jpaName}</td>
Expand All @@ -37,15 +41,13 @@
{/for}
</tbody>
</table>
{/for}
</form>
<script type="text/javascript">
jQuery('#check-all').change(function() {
if (this.checked) {
jQuery('.checkbox').prop('checked', true);
} else {
jQuery('.checkbox').prop('checked', false);
}
});
function handleSelectAll(elem) {
$(elem).parents('table:first').find('.checkbox').prop('checked', elem.checked);
}

</script>
{/if}
{/body}
Expand Down
8 changes: 8 additions & 0 deletions extensions/hibernate-search-orm-elasticsearch/runtime/pom.xml
Expand Up @@ -38,6 +38,14 @@
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
</exclusion>
<!--
The activation implementation is coming from the quarkus-hibernate-orm extension.
The implementation contains the API.
-->
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down

0 comments on commit 671b2f3

Please sign in to comment.