When I'm trying to run my Play! application on Herocu I have a message that I should run it with "play -DapplyEvolutions.default=true" command. But how can I do it?
Now what I'm doing is pushing to my webapp to heroku and operate with commands: "heroku ps" and "heroku logs". The last one gives me error details. How can I run application on heroku remotely?
Is this Play 2? If so you will need a Procfile containing:
web: target/start -Dhttp.port=$PORT -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL
Related
I recently run into an "H14 Error" While Trying To Deploy Gradle Spring Project into the HeroKu platform.
Error:
code=H14 desc="No web processes running"
In My Project Folder, I have a "Procfile"
web: java -jar build/server/webapp-runner-*.jar build/libs/*.war
web: java -jar target/ClockGUI-0.0.1-SNAPSHOT.jar
heroku ps:scale web=1
I have researched many solutions but not worked out.
Please help me. Thank you so much
There are at least two issues with your Procfile:
You can't declare two web processes.
What command runs your web server? That's the only one that should be declared this way.
(I'm not sure what ClockGUI-0.0.1-SNAPSHOT.jar is supposed to be, but assuming "GUI" means something like SWT, Swing, or JavaFX, it won't work on Heroku. Where would the interface appear?)
You've included a Heroku CLI command.
heroku ps:scale web=1 is a command that you might run locally to scale your application's web dynos. It's not something that should be baked into the application source code.
Consider an e-commerce application. At certain times of the year, you might see a spike in traffic. You could use this command to scale up additional web dynos to handle the load. That doesn't (and shouldn't) require redeploying the application.
Remove that line. It doesn't do anything in the Procfile anyway.
Commit the updated Procfile and redeploy. Then, if you don't have any web dynos running, run heroku ps:scale web=1 in a terminal, ideally from your project directory so Heroku can infer which app you want to scale.
I have a Java web app with Tomcat embedded in my jar file. I can containerize the app with Docker and run it with command java -jar -myapp.jar, but I can't run that container in Heroku. I tried using heroku CLI to dockerize and deploy, but Heroku gives me an error of "can't access jarfile".
I tried to fix this by using heroku deploy:jar to deploy my fat jar, but this erroneously gives me an error:
heroku deploy:jar target/*.jar -a medscanner2
-----> Packaging application...
- app: medscanner2
- including: target/medscanner2.jar
! ERROR: Could not get API key! Please install the Heroku CLI and run
`heroku login` or set the HEROKU_API_KEY environment variable.
! Re-run with HEROKU_DEBUG=1 for more info.
!There was a problem deploying to medscanner2.
!Make sure you have permission to deploy by running: heroku apps:info -a
medscanner2
I am signed into Heroku and I can use heroku auth:whoami to verify that, I can push containers and deploy them, so this error doesn't make any sense. I reran with HEROKU_DEBUG=1 and it did not return any more info.
I further tried to set the HEROKU_API_KEY variable in the CLI with a token I got from Heroku and this still caused the same error when I try to deploy the jar.
I am using a Procfile (although I am not sure it is necessary):
web: java -Dserver.port=$PORT -jar target/medscanner2.jar
Since the issue seems to be indicating there is an issue with access I don't see how the Procfile could be influencing it.
What is the best way for me to deploy a Java web app that does not using Spring Boot to Heroku? I have separately deployed the docker container successfully to Google app engine, so all this work for Heroku is very frustrating.
I ended up fixing this by using webapp-runner to deploy my app. It runs the webapp-runner jar which can run your .war files. This required adding the heroku-maven-plugin and maven-dependency-plugin.
I could then add a Procfile: web: java -jar target/dependency/webapp-runner.jar target/*.war --port $PORT
and use the Heroku CLI to add the app using git. The link with webapp-runner is a guide to deploying tomcat java apps with webapp-runner.
I'm looking for a way to run Heroku CLI commands within a java application hosted on Heroku.
I'd like to be able to run commands like heroku pg:backup heroku pg:restore etc
Is there a way to do that ?
EDIT : I added the Heroku CLI to my app, now I'm looking for a way to invoke heroku commands from my java code.
Maybe you could use something like this :
ProcessBuilder pb = new ProcessBuilder("/path/to/herokuCLI", "myCommand");
Problem is I don't know how to find the right path.
If you look at the file structure of your app on Heroku you can only find your .war + some "configuration files" which is quite normal as you only push a war to Heroku : Procfile system.properties target
Besides I don't think that's the right way to do that.
I'd like to avoid doing backup/restore operations in pure java code.
Maybe you can't rely on Heroku cmd to do the job for you after all.
You'll need to add the Heroku CLI buildpack to your application. You can do so with: heroku buildpacks:add heroku-community/cli
Push a new build after you've done so and you'll now be able to run CLI commands from inside your application dynos. You can see some additional information about this in the documentation.
I created a simple Java (maven) web application (WAR). On local Tomcat all works fine, however when I try to deploy to HEROKU the application does not show up (I get error instead on the home page of the app.
I run this command
heroku war:deploy myapp-ws-0.0.1-SNAPSHOT.war --app myapp-ws
and all actions are successful
the only parameter that I need on Heroku for my app to run is spring profile and I added it this way.
heroku config:set -Dspring.profiles.active="true"
I'm very new to heroku, but did anyone in the past deploy a war to heroku successfuly? I cannot find the problem, no error appears apart from the home page saying application Application Error. Any other information I should include here?
Ok, I got it working, first I was able to check logs:
heroku logs --tail --app myapp-ws
then I found out that you have to add one instance because at start there are zero
heroku ps:scale web=1
and finally I added my arguments in this way
heroku config:set WEBAPP_RUNNER_OPTS="-Dspring.profiles.active=test" --app myapp-ws
i developed a small play framework web application and i am deploying it online on heroku then i went through steps of how to deploy app in heroku ,i followed all the steps and i am having free account, i am getting error when i am running this command heroku ps in command line.
i wrote in Procfile :
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}
Error is :
rahul#inext:~/EntWebPrj$ heroku ps
=== web (1X): `target/start -Dhttp.port=${PORT} ${JAVA_OPTS}`
web.1: crashed 2013/08/21 15:29:19 (~ 4m ago)
and it is also not running on my app link it is showing some application error.
anyone give some idea to fix this error?