java - Quarkus 应用程序在 Heroku 上的部署问题

标签 java heroku quarkus

我创建了一个 Quarkus 应用程序。

源代码位于https://github.com/ashusharmatech/quarkus-welcome-app

我正在尝试在 Heroku 平台上部署此应用程序。

我的应用程序正在按照构建日志正确构建:

-----> Java app detected
-----> Installing JDK 1.8... done
-----> Executing Maven
       $ ./mvnw -DskipTests clean dependency:list install
       [INFO] Scanning for projects...
       [WARNING] 
       [WARNING] Some problems were encountered while building the effective model for com.rest:rest:jar:1.0.0-SNAPSHOT
       [WARNING] 'build.plugins.plugin.version' for com.heroku.sdk:heroku-maven-plugin is missing. @ line 50, column 15
       [WARNING] 
       [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
       [WARNING] 
       [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
       [WARNING] 
       [INFO] 
       [INFO] ---------------------------< com.rest:rest >----------------------------
       [INFO] Building rest 1.0.0-SNAPSHOT
       [INFO] --------------------------------[ jar ]---------------------------------
       [INFO] 
       [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rest ---
       [INFO] 
       [INFO] --- maven-dependency-plugin:2.8:list (default-cli) @ rest ---
       [INFO] 
       [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rest ---
       [INFO] Using 'UTF-8' encoding to copy filtered resources.
       [INFO] Copying 2 resources
       [INFO] 
       [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ rest ---
       [INFO] Changes detected - recompiling the module!
       [INFO] Compiling 1 source file to /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/target/classes
       [INFO] 
       [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rest ---
       [INFO] Using 'UTF-8' encoding to copy filtered resources.
       [INFO] skip non existing resourceDirectory /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/src/test/resources
       [INFO] 
       [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ rest ---
       [INFO] Changes detected - recompiling the module!
       [INFO] Compiling 2 source files to /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/target/test-classes
       [INFO] 
       [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ rest ---
       [INFO] Tests are skipped.
       [INFO] 
       [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ rest ---
       [INFO] Building jar: /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/target/rest-1.0.0-SNAPSHOT.jar
       [INFO] 
       [INFO] --- quarkus-maven-plugin:1.2.1.Final:build (default) @ rest ---
       [INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
       [INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building thin jar: /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/target/rest-1.0.0-SNAPSHOT-runner.jar
       [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 2745ms
       [INFO] 
       [INFO] --- maven-install-plugin:2.4:install (default-install) @ rest ---
       [INFO] Installing /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/target/rest-1.0.0-SNAPSHOT.jar to /app/tmp/cache/.m2/repository/com/rest/rest/1.0.0-SNAPSHOT/rest-1.0.0-SNAPSHOT.jar
       [INFO] Installing /tmp/build_dee8d9fdefa09e7c7223ce42aa750f3e/pom.xml to /app/tmp/cache/.m2/repository/com/rest/rest/1.0.0-SNAPSHOT/rest-1.0.0-SNAPSHOT.pom
       [INFO] ------------------------------------------------------------------------
       [INFO] BUILD SUCCESS
       [INFO] ------------------------------------------------------------------------
       [INFO] Total time:  9.657 s
       [INFO] Finished at: 2020-03-18T16:53:26Z
       [INFO] ------------------------------------------------------------------------
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 58.6M
-----> Launching...
       Released v9
       https://quarkus-welcome-app.herokuapp.com/ deployed to Heroku

当我尝试使用 url 运行应用程序时 https://quarkus-welcome-app.herokuapp.com/

它不工作并给出以下错误:

2020-03-18T16:55:41.875986+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/welcome" host=quarkus-welcome-app.herokuapp.com request_id=d67655f1-fc5b-4074-a2ae-aa21c55f8ac1 fwd="103.252.52.43" dyno= connect= service= status=503 bytes= protocol=https
2020-03-18T16:55:42.873880+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=quarkus-welcome-app.herokuapp.com request_id=a8f907ec-fca8-4c71-ba21-11c56941fd86 fwd="103.252.52.43" dyno= connect= service= status=503 bytes= protocol=https

我假设此问题是由于 Procfile 命令出现问题而导致的。

web: java $JAVA_OPTS -jar target/classes:target/*-runner.jar

请告诉我如何在 Heroku 上启动此应用程序。

最佳答案

我发现了问题。我没有将进程绑定(bind)到正确的端口。文件的正确内容将是:

web: java -Dquarkus.http.port=$PORT $JAVA_OPTS -jar target/*-runner.jar

关于java - Quarkus 应用程序在 Heroku 上的部署问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60744175/

相关文章:

maven - 调试器无法附加 : handshake failed - received >GET/api/domai< - expected >JDWP-Handshake<

java - 冰雹 : loop for #1-#200

java - if else 语句失败

python - Flask/AngularJS 部署到 Heroku

java - 夸库斯 CDI : Interceptor has no bindings

gradle - 如何使用Gradle基于配置文件构建Quarkus容器?

java - 如果直接调用,HttpGet 工作正常,但如果从 Android Activity 调用,则会发出 400 响应

java - 如何在 Struts 2 和 JSP 的 Action 类中仅获取选定复选框的值

python - Heroku django 使用环境设置管理 shell (db, vars)