Tag: 春季启动

在多主机networking上部署springboot cloud netflix是否正确?

我正在用netflix云栈开发一个spring启动应用程序。 并将每个模块(微服务)部署在不同的docker容器中。 结构如下: 尤里卡 Zuul 微服务中的业务逻辑 MySQL的 Angular4用户界面 Keycloak – 用户pipe理和authentication ELK – 用于日志维护 豪猪 基普金 好吧,在面对很多问题之后,花费了大量的networking带宽在我以这种方式部署的问题上,我需要知道的是,如果这是正确的方法呢? 这里的限制是我已经提供了2个主机来testing这个configuration,并且进一步的行动计划还没有。 所以这里是我所做的:我还没有使用我提到的完整堆栈。 服务器1 尤里卡 Zuul 麋鹿 Server2上 Keycloak 业务逻辑微服务 MySQL的 Anguar4用户界面 尚未configuration和使用Hystrix和Zipkin。 所以我已经给Eurekaconfiguration了所有需要在Eureka上注册的微服务的Server1的IP:PORT。 Zuul也是如此(尤里卡的IP:PORT)。 在Angular4 UI中,我给出了Zuul部署的URL:PORT,因为所有的服务都将通过Zuul调用。 我知道这是正确的,因为服务需要知道尤里卡在哪里,rest可以通过尤里卡pipe理。 现在我的关键问题是,因为MySQL,ELK不能在Eureka上注册,所以在任何需要的地方给出IP:ELK的PORT和MySQL都是正确的。 ELK的configuration也是如此,我的要求是所有的日志都位于这个我已经使用docker,卷装但是我不知道如何在多主机环境下完成这个工作,我只能使docker把外部卷的日志,然后可能通过URL访问ELK,尚未testing此configuration。 如果是的话,那么这个configuration不是那么独立,如果我们认为它能够自己pipe理呢? 我已经configuration我的docker组成使用“network_mode”:主机,以便主机docker通信可以完成。 再次,我需要知道的是,我的configuration/体系结构是否适用于多主机环境,以及将来适用于云环境? 如果不是,请请引导我正确的path。 谢谢! 请原谅我的英语和语法,我已经尽我所能了解情况,如果您需要更多的意见,请指出并提出问题。

春季启动应用程序需要docker?

任何有关春季启动应用程序的build议都需要dockerization? 使用Dockerization增加部署时间? a. Spring boot app with docker then has to go with building image -> pushing to docker registry -> then pull from docker registry and at last running it. b. whole process takes time and Continuos deployment is taking now time. 由于Spring引导带有embedded式tomcat,build议将可执行jar文件作为java -jar运行,而您只需要在可部署主机上使用JRE? 让我知道你的想法

Docker中的Spring Boot

我正在学习如何在Spring Boot应用程序中使用Docker。 我遇到了一个小麻烦,我希望有人能看到这个问题。 我的应用程序严重依赖于在特定于环境的属性文件中设置的@Value。 在我的/ src /主要/资源我有三个属性文件 application.properties application-local.properties application-prod.properties 我通常启动我的应用程序:java -jar -Dspring.profiles.active = local build / libs / finance-0.0.1-SNAPSHOT.jar 并读取“application-local.properties”并正常运行。 不过,我正在使用这个src / main / docker / DockerFile: FROM frolvlad/alpine-oraclejdk8:slim VOLUME /tmp ADD finance-0.0.1-SNAPSHOT.jar finance.jar RUN sh -c 'touch /finance.jar' EXPOSE 8081 ENV JAVA_OPTS="" ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /finance.jar" ] 然后我开始: […]

在Docker容器中访问主机上的MySQL数据库

我有一个在Dockers容器中运行的Spring Boot应用程序。 该应用程序提供REST端点,可以使用http:// localhost:8080 / endpoint从主机成功调用。 以前,当这个应用程序运行在主机上而不是在Dockers中时,我可以从应用程序中使用jdbc:mariadb:// localhost:3308 / fi?user = userName&password = thePassword调用本地MariaDB。 现在应用程序在Dockers中运行,连接返回错误:“无法连接到地址=(host = localhost)(port = 3308)(type = master):连接被拒绝(连接被拒绝)” 进行连接的代码片段如下所示: Connection connection = DriverManager.getConnection("jdbc:mariadb://localhost:3308/fi?user=username&password=thePassword"); Statement stmt = connection.createStatement(); String query = ""; ResultSet rs = stmt.executeQuery("SELECT * ….;"); 我已经发布了8080端口来接受来自主机的REST调用,并试图发布或公开3308端口以允许进行数据库调用,而不提供帮助。 先谢谢你!

访问网页问题(上传到wildfly)

docker容器的创build使用以下命令: docker run -p 8080:8080 -p 9990:9990 –name wildfly -d -it jboss/wildfly `/opt/jboss/wildfly/bin/standalone.sh -bmanagement 0.0.0.0` 当我创buildDocker容器时,我正在通过pipe理页面上载一个war文件,我可以在port 9990访问它。 从日志文件中可以看到,war文件的上传已成功结束,上下文path为/TestProject ,但是当我尝试访问broswer( http:// localhost:8080 / TestProject /…/ )时,我收到的消息是"This page isn't working" 。 .war文件在本地安装的wildfly中进行testing,并且正在工作。 日志文件: 12:24:01,974 WARN [org.jboss.as.ee] (MSC service thread 1-1) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the […]

Kafka Docker,docker-maven-plugin,Spring Boot

我试图通过Docker Maven Plugin启动Kafka https://github.com/fabric8io/docker-maven-plugin 我使用以下Maven图像: https : //hub.docker.com/r/wurstmeister/kafka/ 这是我的Mavenconfiguration: <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>${docker-maven-plugin.version}</version> <configuration> <showLogs>true</showLogs> <images> <image> <name>wurstmeister/kafka:1.0.0</name> <alias>kafka</alias> <run> <ports> <port>9092:9092</port> </ports> </run> </image> </images> </configuration> <executions> <execution> <id>prepare-containers</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>remove-containers</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> mvn docker:start -Dfile.encoding=UTF-8的输出mvn docker:start -Dfile.encoding=UTF-8命令: [INFO] Scanning for projects… [INFO] [INFO] […]

fabric8 springboot完整的例子

我想弄清楚如何使用fabric8 docker-maven-plugin来构build一个Spring Boot Docker镜像。 该文档包含位和字节,我显然缺less的东西。 有没有人有一个完整的pom.xml的例子呢?

在tomcat Docker容器上部署.war

我试图自动化在Docker容器上部署tomcat webapps'.war的过程。 为了实现这个目标,我开发了一个样例的spring启动应用程序来作为一个testing。 由于我的最终目标是将这个过程应用于旧的现有的战争应用程序,所以我将应用程序configuration为生成war文件,而不是使用tomcatembedded的jar。 示例应用程序只是一个带有/greeting?id=<id>端点的Spring MVC示例应用程序,该应用程序刚刚返回带有“Hello”消息的页面,其中是从MySQL数据库的表中读取的string。 应用程序部署在基于Tomcat映像的Docker容器上,而数据库部署在单独的mysql容器上。 当通过docker-compose脚本启动两个容器时,部署似乎已经成功:两个容器正在运行,tomcat实例处于活动状态,cotainer日志中没有可见的错误消息,我可以看到部署的webapp已标记为在http://<IP>:8082/manager/html的tomcatpipe理器界面中运行。 问题是,在http://<IP>:8082/myapp-sample-webapp/greeting?id=<id>我得到一个404错误。 我testing了在web应用程序中放置一个test.html静态文件,这在http://<IP>:8082/myapp-sample-webapp/test.html可见。 另外请注意,如果我将应用程序configuration为embeddedtomcat的jar应用程序(当然也会相应地更改Dockerfileconfiguration),则可以毫无问题地访问/greeting?id=<id>端点。 一个侧面的问题是我看不到任何应用程序生成的日志(既不在泊坞窗容器的日志与docker logs … ,也不在我configuration的/usr/local/tomcat/logs/myapp-sample-webapp.log日志文件为应用程序日志logging(请参阅下面的application.properties ),这是阻止我检查问题是否以某种方式失败连接到MySQL数据库相关。 这是应用程序的pom.xml文件是以下内容: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>eu.myapp</groupId> <artifactId>myapp-sample-webapp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>myapp-sample-webapp</name> <description>Project created for testing Docker packaging of a .war web application</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> <relativePath /> <!– lookup parent from repository –> </parent> […]

如何为Docker Composeconfigurationdns条目

我正在设置一个Spring应用程序来运行使用撰写。 应用程序需要build立到ActiveMQ的连接,或者为开发人员本地运行,或者为现有的分段/生产实例运行。 我设置了以下对于本地开发非常有用的工具: amq: image: rmohr/activemq:latest ports: – "61616:61616" – "8161:8161" legacy-bridge: image: myco/myservice links: – amq 并在应用程序configuration中声明AMQ连接为 broker-url=tcp://amq:61616 运行docker-compose up工作得很好,activeMQ在本地启动,我的应用程序强制启动并连接到它。 现在,我需要将其设置为分段/生产,其中ActiveMQ实例正在基础架构中的现有硬件上运行。 我的想法是要么使用弹簧configuration文件来处理不同的configuration,在这种情况下,'broker-url = tcp:// amq:61616'的应用程序configuration条目会变成类似broker-url=tcp://some.host.here:61616或find一些方法来在我的生产docker-compose.yml中创build一个dns条目,它将指向一个amq dns条目到相关的分段或生产队列。 这里最好的办法是什么,如果是DNS,我该如何设置? 谢谢!

在Docker容器中运行Spring Boot应用程序,无法连接MySQL

我试图学习Docker,并创build了一个运行MySQL服务器的容器。 它工作正常,当我在本地运行Spring Boot应用程序(无需Docker)时,我可以使用Spring Boot应用程序中的MySQL。 但是当我尝试在另一个Docker容器中运行Spring Boot应用程序时,与MySQL的连接失败,出现错误: java.net.ConnectException: Connection refused 在我的Spring Boot的application.properties我有这样的configuration: spring.datasource.url: jdbc:mysql://127.0.0.1/mydb spring.datasource.username=root spring.datasource.password= spring.datasource.driverClassName=com.mysql.jdbc.Driver 任何想法可能是错的?