Skip to content

Commit

Permalink
Merge pull request #39845 from gsmet/3.9.2-backports-1
Browse files Browse the repository at this point in the history
3.9.2 backports 1
  • Loading branch information
gsmet committed Apr 3, 2024
2 parents 9002ec7 + cc5ab4b commit 7d4d8e1
Show file tree
Hide file tree
Showing 106 changed files with 2,642 additions and 383 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ updates:
- dependency-name: org.apache.qpid:*
- dependency-name: biz.paluch.logging:logstash-gelf
- dependency-name: org.bitbucket.b_c:jose4j
- dependency-name: io.fabric8:maven-model-helper
ignore:
# this one cannot be upgraded due to the usage of proxies in new versions
# the proxy implements interfaces in a random order which causes issues
Expand Down
37 changes: 23 additions & 14 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
<wildfly-common.version>1.7.0.Final</wildfly-common.version>
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>2.3.1.Final</wildfly-elytron.version>
<jboss-threads.version>3.6.0.Final</jboss-threads.version>
<vertx.version>4.5.5</vertx.version>
<jboss-threads.version>3.6.1.Final</jboss-threads.version>
<vertx.version>4.5.7</vertx.version>
<httpclient.version>4.5.14</httpclient.version>
<httpcore.version>4.4.16</httpcore.version>
<httpasync.version>4.1.5</httpasync.version>
Expand All @@ -144,7 +144,7 @@
<infinispan.version>15.0.0.Final</infinispan.version>
<infinispan.protostream.version>5.0.1.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.107.Final</netty.version>
<netty.version>4.1.108.Final</netty.version>
<brotli4j.version>1.16.0</brotli4j.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<jboss-logging.version>3.5.3.Final</jboss-logging.version>
Expand Down Expand Up @@ -268,6 +268,15 @@

<!-- External BOMs -->

<!-- Smallrye Common dependencies, imported as a BOM -->
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-bom</artifactId>
<version>${smallrye-common.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<!-- Netty dependencies, imported as a BOM -->
<dependency>
<groupId>io.netty</groupId>
Expand Down Expand Up @@ -342,15 +351,6 @@
<type>pom</type>
</dependency>

<!-- Smallrye Common dependencies, imported as a BOM -->
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-bom</artifactId>
<version>${smallrye-common.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<!-- Micrometer Core and Registries, imported as BOM -->
<dependency>
<groupId>io.micrometer</groupId>
Expand Down Expand Up @@ -6197,10 +6197,19 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j</artifactId>
<artifactId>apache-mime4j-core</artifactId>
<version>${mime4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j-dom</artifactId>
<version>${mime4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j-storage</artifactId>
<version>${mime4j.version}</version>
</dependency>

<!-- OpenTelemetry libs not in BOM -->
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ public interface Capability {
String KUBERNETES_CLIENT = QUARKUS_PREFIX + ".kubernetes.client";

/**
* @deprecated
* @deprecated Use more precise capability {@link Capability#SMALLRYE_METRICS}
* @see io.quarkus.deployment.metrics.MetricsCapabilityBuildItem
*/
@Deprecated
String METRICS = QUARKUS_PREFIX + ".metrics";
String CONTAINER_IMAGE_JIB = QUARKUS_PREFIX + ".container.image.jib";
String CONTAINER_IMAGE_DOCKER = QUARKUS_PREFIX + ".container.image.docker";
Expand All @@ -117,6 +118,7 @@ public interface Capability {

String SCHEDULER = QUARKUS_PREFIX + ".scheduler";

String SMALLRYE_METRICS = QUARKUS_PREFIX + ".smallrye.metrics";
String SMALLRYE_HEALTH = QUARKUS_PREFIX + ".smallrye.health";
String SMALLRYE_OPENAPI = QUARKUS_PREFIX + ".smallrye.openapi";
String SMALLRYE_GRAPHQL = QUARKUS_PREFIX + ".smallrye.graphql";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import static io.smallrye.config.ConfigMappings.ConfigClassWithPrefix.configClassWithPrefix;
import static io.smallrye.config.Expressions.withoutExpansion;
import static io.smallrye.config.PropertiesConfigSourceProvider.classPathSources;
import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_PROFILE;
import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_PROFILE_PARENT;
import static io.smallrye.config.SmallRyeConfigBuilder.META_INF_MICROPROFILE_CONFIG_PROPERTIES;
import static java.util.stream.Collectors.toSet;

Expand Down Expand Up @@ -1103,8 +1105,8 @@ public String getValue(final String propertyName) {
Map.of("quarkus.profile", "",
"quarkus.config.profile.parent", "",
"quarkus.test.profile", "",
SmallRyeConfig.SMALLRYE_CONFIG_PROFILE, "",
SmallRyeConfig.SMALLRYE_CONFIG_PROFILE_PARENT, "",
SMALLRYE_CONFIG_PROFILE, "",
SMALLRYE_CONFIG_PROFILE_PARENT, "",
Config.PROFILE, ""),
Integer.MAX_VALUE) {
@Override
Expand Down Expand Up @@ -1153,6 +1155,28 @@ private SmallRyeConfig getConfigForRuntimeRecording() {
}
builder.withSources(configSource);
}
builder.withSources(new AbstractConfigSource("Profiles", Integer.MAX_VALUE) {
private final Set<String> profiles = Set.of(
"quarkus.profile",
"quarkus.config.profile.parent",
"quarkus.test.profile",
SMALLRYE_CONFIG_PROFILE,
SMALLRYE_CONFIG_PROFILE_PARENT,
Config.PROFILE);

@Override
public Set<String> getPropertyNames() {
return Collections.emptySet();
}

@Override
public String getValue(final String propertyName) {
if (profiles.contains(propertyName)) {
return config.getConfigValue(propertyName).getValue();
}
return null;
};
});
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void registerClass(ClassLoader classLoader, String className, boolean me
}

try {
Class<?>[] declaredClasses = classLoader.loadClass(className).getDeclaredClasses();
Class<?>[] declaredClasses = Class.forName(className, false, classLoader).getDeclaredClasses();
for (Class<?> clazz : declaredClasses) {
registerClass(classLoader, clazz.getName(), methods, fields, false, serialization, unsafeAllocated,
reflectiveClass,
Expand Down
2 changes: 1 addition & 1 deletion docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<asciidoctorj-pdf.version>1.5.0-beta.8</asciidoctorj-pdf.version>
<asciidoctor.fail-if>WARN</asciidoctor.fail-if>
<roaster-jdt.version>2.26.0.Final</roaster-jdt.version>
<maven-model-helper.version>35</maven-model-helper.version>
<maven-model-helper.version>36</maven-model-helper.version>
<eclipse-collections.version>11.1.0</eclipse-collections.version>
<jgit.version>6.9.0.202403050737-r</jgit.version>

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/gradle-tooling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ You can change the working directory the development environment runs on:
[source,groovy]
----
quarkusDev {
workingDir = rootProject.projectDir
workingDirectory = rootProject.layout.projectDirectory.asFile
}
----
****
Expand All @@ -194,7 +194,7 @@ quarkusDev {
[source,kotlin]
----
tasks.quarkusDev {
workingDir = rootProject.projectDir.toString()
workingDirectory = rootProject.layout.projectDirectory.asFile
}
----
****
Expand Down
127 changes: 32 additions & 95 deletions docs/src/main/asciidoc/podman.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,143 +8,80 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
:topics: podman,devops,tooling
include::_attributes.adoc[]

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.
If you're using Podman with Quarkus, some one-off setup is needed, but once it's done, you can take advantage of all the Quarkus features.
https://podman.io/[Podman] is an open-source, daemonless, and rootless container engine for developing, managing, and running OCI Containers on Linux, Windows and Mac. It can be used to support the container functionality and Dev Services on Quarkus.

== Installing Podman

=== macOS
Podman's install approach varies depending on the operating system you are using, and the required steps also change over time depending on the version of Podman. For Mac and Windows we highly recommend installing through the Podman Desktop graphical application. It is the simplest option with the least number of steps, it adds additional functionality like automatic start, and it helps manage future updates. There is also a CLI-only option that may be used. However, this setup requires additional manual tasks to manage, update, and launch the Podman Machine environment.

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.
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.
In Podman, this is known as the Podman machine, and it is built into the tool.

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`:
[WARNING]
====
The Homebrew package manager on Mac (*brew*) *should not be used to install Podman* as it results in an unverified combination of components. This is due to Homebrew sharing dependencies between projects, along with limited vetting of upgrade requests. As an example, there were several instances where an update to qemu broke on Apple Silicon, preventing Podman machine VMs from booting.
====

[source,bash]
----
brew install podman
brew install docker-compose
podman machine init -v $HOME:$HOME
PODMAN_VERSION=`podman -v | sed 's/[a-zA-Z ]*//'`
sudo /opt/homebrew/Cellar/podman/$PODMAN_VERSION/bin/podman-mac-helper install
podman machine set --rootful
podman machine start
alias docker='podman'
----
On Linux, Podman is integrated as part of the operating system, and installed through the system's packager manager. As with Mac, and Windows, Podman Desktop can also be installed to supplement the Podman CLI. However, on Linux, Podman Desktop acts as a client to the native Podman integration, and does not manage the underlying Podman installation.

If you're using Podman 4.1 or higher, you don't need the `-v $HOME:$HOME` volume mount.
See https://podman-desktop.io/downloads/ for the latest version of Podman Desktop or pick the version that suits your operating system from the list below:

If you're using Mac M1, an extra step is required to https://edofic.com/posts/2021-09-12-podman-m1-amd64[make AMD64 images work]:
- https://podman-desktop.io/macos/[MacOS]
- https://podman-desktop.io/windows/[Windows]
- https://podman-desktop.io/linux/[Linux]

[source,bash]
----
podman machine ssh
sudo -i
rpm-ostree install qemu-user-static
systemctl reboot
----

Once the virtual machine restarts, you should be good to run dev services.
Additionally, if you are using Linux, see the Podman https://podman.io/docs/installation#installing-on-linux[Linux installation documentation] for instructions installing Podman to your specific Linux distribution.

For more details, please see
=== Docker compatibility mode

- the https://podman.io/getting-started/installation#macos[official Podman documentation]
- article about https://www.redhat.com/sysadmin/replace-docker-podman-macos[running Podman on Mac]
- https://xphyr.net/post/podman_on_osx/[another article], with good guidance on `--rootful` and mounting volumes
- article about https://edofic.com/posts/2021-09-12-podman-m1-amd64[running AMD64 images with Podman on Mac M1]
When installing Podman Desktop on Mac or Windows, it's important to enable Docker compatibility mode when prompted. This will ensure the podman-mac-helper is setup on your behalf (normally a manual action you are prompted to do after start), necessary for supporting /var/run/docker.sock (privileged location). It will also install support for Docker Compose.

=== 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.
== Platform differences

Before starting the Podman machine, set it to prefer rootful container execution:
While interacting with containers is mostly identical between Mac, Windows, and Linux, there are important environmental differences to be aware of. Notably, the way in which containers are executed is different, since "Containers are Linux". More specifically, containers contain Linux userland binaries with a dependency on the Linux kernel syscall interface. As such, Linux containers cannot run natively on macOS or Windows; they instead require the use of a virtual machine (VM), running Linux, to host them. For systems that require it, Podman includes a subsystem called Podman Machine that is used to manage this VM. Podman Desktop performs a guided interactive setup of this VM, and will automatically launch it on your behalf.

[source,bash]
----
podman machine set --rootful
----

This action only needs to be done once.

=== Linux
== Rootful vs Rootless

The Podman package is available in several Linux distributions.
Podman can in most cases be used as an drop-in-replacement for Docker, either with the `podman-docker` package, or using an alias (`alias docker=podman`).
To install it for your Linux OS, please refer to the https://podman.io/getting-started/installation#installing-on-linux[Podman installation guide].
Podman supports two modes of operation: rootful, in which case the container runs as root on the Linux host (or VM in the case of Mac/Windows), and rootless, where the container runs under a standard Unix user account. The latter offers significantly stronger security, but some containers are not capable of running under the increased restrictions. As an example, if a container creates new devices, loopback mount points, and performs other highly restricted operations, then they must be run as root. Note, that this is not to be confused with the USER value specified in Containerfile/Dockerfile, which refers to how processes inside the container perceive themselves. In rootless, processes running in a container with a USER of "root" will appear to each other as root, but due to pid namespacing, they will actually be running as a standard restricted user account on the host system.

=== Setting DOCKER_HOST on Linux
=== Configuring on Win & Mac

Podman supports two modes of operation: rootful, in which case the container runs as root on the host system, and rootless, where the container runs under a standard Unix user account.
On Linux, the REST API Unix socket is, by default, restricted to only allow the root user to access it.
This prevents someone from using a container to achieve a privilege escalation on the system.
While these restrictions can be softened to allow a special group instead of just root, the recommended approach is to use rootless Podman on Linux.
To use rootless Podman, you need to set a `DOCKER_HOST` environment variable to point to the user-specific socket.
On systems which involve a Podman Machine managed VM (Mac & Windows), container clients and Podman commands communicate remotely to either a rootful or rootless system service running the VM. Which is used is determined by the `rootful` setting of the Podman machine. For maximal compatibility, Podman Desktop defaults to enabling rootful for new machine instances. There is limited security impact to this since the VM itself is running under a user process. This can also be changed via the podman commands:

NOTE: In both cases, you need to start the REST API by enabling the Podman socket service through systemd, or at least by making sure Podman is running as a service.

[source,bash]
----
# Example 1: Enable the podman socket with Docker REST API with systemd (only needs to be done once)
systemctl --user enable podman.socket --now
----

[source,bash]
----
# Example 2: Enable the podman socket with Docker REST API on a system where systemd is not running (WSL etc)
podman system service --time=0
----

Then, you can obtain the path of the socket with the following command:

[source,bash]
podman machine set --rootful=true # or false
podman machine stop
podman machine start
----
$ podman info | grep -A2 'remoteSocket'

remoteSocket:
exists: true
path: /path/to/podman.sock
----
=== Configuring on Linux

Setting the `DOCKER_HOST` environment variable must be done every time or added to the profile:
On Linux systems, it's recommended to configure client access in a rootless configuration using a user systemd service.

This can be enabled using the following command:
[source,bash]
----
export DOCKER_HOST=unix:///path/to/podman.sock <1>
systemctl --user enable podman.socket --now
----
<1> Replace `/path/to/podman.sock` with the path you obtained previously.

For a detailed explanation, see this https://quarkus.io/blog/quarkus-devservices-testcontainers-podman/[blog article].

== After installation
==== Setting DOCKER_HOST on Linux

=== Testcontainers privileges
With the above rootless setup on Linux, you will need to configure clients, such as Quarkus and testcontainers by setting the `DOCKER_HOST` environment variable to point to the user service podman socket. The path be set using an expression which queries the path using the podman command:

Edit `~/.testcontainers.properties` and add the following line

[source,properties]
----
ryuk.container.privileged=true
----

Alternatively, you can disable ryuk:

[source,bash]
----
export TESTCONTAINERS_RYUK_DISABLED=true #not recommended - see above!
export DOCKER_HOST=$(podman info --format '{{.Host.RemoteSocket.Path}}')
----

This has the disadvantage of https://github.com/containers/podman/discussions/14238[disabling container cleanup], so you may find stale containers hanging around.
This can be a problem if you're running automated tests.
== Other Linux settings

== Short names of images
=== 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`.

0 comments on commit 7d4d8e1

Please sign in to comment.