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

时间:2020-03-18 16:59:52

标签: 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上启动此应用程序。

1 个答案:

答案 0 :(得分:2)

我发现了问题。我没有使用正确的端口绑定该进程。文件的正确内容为:

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