Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
target
#target
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be reverted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi,

About the Dockerfile and .dockerignore adjustments:

The change in .dockerignore was needed only so the newly created Dockerfile could successfully build the test Docker image. I used that image in my own ECS development cluster to verify the new JHipster Registry version.

If this extra Dockerfile is not required in your official build process, then both the .dockerignore change can be reverted and the Dockerfile itself can be removed, since you will anyway be building and publishing the official image to DockerHub.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted .dockerignore and removed Dockerfile form commit. Like it was before...

node_modules
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:11-jre-focal
VOLUME /tmp
COPY target/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
6 changes: 6 additions & 0 deletions jgit-dependency.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>5.13.1.202206130422-r</version>
<scope>runtime</scope>
</dependency>
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<spring-boot.version>2.7.3</spring-boot.version>
<archunit-junit5.version>0.22.0</archunit-junit5.version>
<mapstruct.version>1.5.2.Final</mapstruct.version>
<jgit.version>5.13.1.202206130422-r</jgit.version>
<!-- Plugin versions -->
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-site-plugin.version>3.12.1</maven-site-plugin.version>
Expand Down Expand Up @@ -79,6 +80,7 @@
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
<sonar-maven-plugin.version>3.9.1.2184</sonar-maven-plugin.version>
<!-- jhipster-needle-maven-property -->
<spring-cloud.version>2021.0.8</spring-cloud.version>
</properties>

<dependencyManagement>
Expand All @@ -90,6 +92,21 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>3.1.8</version>
</dependency>
Comment thread
mraible marked this conversation as resolved.
Outdated
<!-- jhipster-needle-maven-add-dependency-management -->
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -253,6 +270,21 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>${jgit.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.http.apache</artifactId>
<version>${jgit.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.apache</artifactId>
<version>${jgit.version}</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package tech.jhipster.registry.config;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.eclipse.jgit.transport.SshSessionFactory;
import org.eclipse.jgit.transport.sshd.DefaultProxyDataFactory;
import org.eclipse.jgit.transport.sshd.JGitKeyCache;
import org.eclipse.jgit.transport.sshd.KeyCache;
import org.eclipse.jgit.transport.sshd.SshdSessionFactory;
import org.eclipse.jgit.transport.sshd.SshdSessionFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

/**
* Configures JGit to use the Apache MINA based SSH implementation so modern key algorithms are supported.
*/
@Configuration
public class JGitSshConfiguration {

private static final Logger log = LoggerFactory.getLogger(JGitSshConfiguration.class);

private final KeyCache keyCache = new JGitKeyCache();

@PostConstruct
void configureSshClient() {
SshSessionFactory currentFactory = SshSessionFactory.getInstance();
if (currentFactory instanceof SshdSessionFactory) {
log.debug("JGit already uses Apache MINA SSHD session factory");
return;
}

SshdSessionFactory sshdSessionFactory = new SshdSessionFactoryBuilder()
.setProxyDataFactory(new DefaultProxyDataFactory())
.build(keyCache);

SshSessionFactory.setInstance(sshdSessionFactory);
log.info("Configured JGit to use Apache MINA SSHD for SSH connections");
}

@PreDestroy
void shutdownSshClient() {
keyCache.close();
}
}