Running dropwizard 1.1.2 on heroku - heroku

I have a dropwizard 1.1.2 application that works ok locally. I try to deploy this to heroku and I read that I need to override the ports values to be provided by heroku in the Procfile, something like the following:
web: java $JAVA_OPTS -Ddw.http.port=$PORT -Ddw.http.adminPort=$PORT -jar target/My_Website-1.0-SNAPSHOT.jar server target/classes/app.yml
This however is for older versions of Dropwizard and I am unable to find documentation for Dropwizard 1.1.2 working with heroku. If I don't provide the port information, heroku app starts, then crashes with the following message:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
What would be the correct Procfile and config.yml contents for using Dropwizard 1.1.2 with heroku? Thanks

I figured out. You need to pass only -Ddw.server.applicationConnectors[0].port=$PORT and not -Ddw.server.adminConnectors[0].port=$PORT in the Procfile

Related

GCloud: unable to listen on the Port defined by env variable

I am trying to deploy on Google Cloud Platform for the first time using the following two tutorials:
Gcloud build quickstart
Gcloud deploy quickstart
However, when running the final command gcloud builds submit --config cloudbuild.yaml, where cloudbuild.yaml is the name of the yaml file as per tutorial, throws the following error:
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
The image created by the build quickstart is not appropriate for the deploy quickstart. The latter, using Cloud Run needs something talking HTTP on port 8080.
If you using the deploy quickstart as-is, that should work. You can test this container image locally using:
docker run \
--interactive --tty \
--publish=8080:8080 \
gcr.io/gcbdocs/hello
and then try browsing or curling the endpoint http://localhost:8080. You should see Hello world!.
The error message from Cloud Run is somewhat generic and means that something went wrong. As a result it's often unhelpful.
If you're confident you're deploying a container image that talks HTTP on port 8080, I recommend you step through the instructions to try to see where you went wrong.

default fabric8 microservice errors out on integration test - Waiting for container:spring-boot. Reason:CrashLoopBackOff

Deployed fabric8 in Google Container Engine with 12 core 45GB RAM. Used gofabric8 0.4.69 for deploying fabric8 on GCE.
Tried to create a microservice, but it is failing in integration testing phase throwing the following error "Waiting for container:spring-boot. Reason:CrashLoopBackOff"
Please help to resolve this.
Which quickstart were you trying?
It sounds like the application terminated. I wonder if this shows any output:
kubectl get pod
kubectl logs nameofpod
where nameofpod is the pod that is crashing.
BTW the new fabric8-maven-plugin version (3.1.45 or later) now has a nicer fabric8:run goal.
If you clone the git repository to your local file system and update the version of fabric8-maven-plugin you should be able to run it via:
mvn fabric8:run
Then you get to see the output of the spring app in your console to see if something fails etc.

Play Evolutions Resolve NullPointerException

I am using Play 1.2.4 and deploying to Heroku. When I deployed most recently, I had a mistake in my latest db evolution (it was trying to add a column that was already there). It failed and needed to be resolved so I just ran the heroku run "play evolutions:resolve" command.
I have tried also running heroku restart and then the above command but that didn't work either.
The error I get when I run the heroku run "play evolutions:resolve" command is
Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true
Exception in thread "main" java.lang.NullPointerException
at play.db.Evolutions.main(Evolutions.java:54)
How can I fix the production environment on heroku?
It turns out I needed to add the --%prod flag.

Unable to deploy a ruby application in Cloudfoundry

I have the application ready
but when I am deploying I am facing an error
deployment facing error in heroku and cloud foundry
gems used are: event_calender
authlogic
error in : cloud foundry
wafuser#wafuser-VirtualBox:~/Documents/backups/backupnew/ecommerce$ vmc push
Would you like to deploy from the current directory? [Yn]: y
Application Name: shiva108
Detected a Rails Application, is this correct? [Yn]: y
Application Deployed URL [shiva108.cloudfoundry.com]:
Memory reservation (128M, 256M, 512M, 1G, 2G) [256M]:
How many instances? [1]: 1
Create services to bind to 'shiva108'? [yN]: y
1: mongodb
2: mysql
3: postgresql
4: rabbitmq
5: redis
What kind of service?: 2
Specify the name of the service [mysql-ceaf3]:
Create another? [yN]: n
Would you like to save this configuration? [yN]: n
Creating Application: OK
Creating Service [mysql-ceaf3]: OK
Binding Service [mysql-ceaf3]: OK
Uploading Application:
Checking for available resources: OK
Processing resources: OK
Packing application: OK
Uploading (192K): OK
Push Status: OK
Staging Application 'shiva108': OK
Starting Application 'shiva108': .
Error: Application [shiva108] failed to start, logs information below.
====> /logs/migration.log <====
Can anyone suggest a solution for my problem
Try using the following command:
vmc logs <app-name>
This will give you the logs you need.
Try using this commnd:
Heroku:
$ heroku logs
Cloud Foundry:
$ vmc files shiva108 logs/stderr.log

Heroku Boot Timeout (Error R10)

Every time I launch my app it cannot get past the 60 second point without:
2012-05-06T22:41:11+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-05-06T22:41:11+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2012-05-06T22:41:11+00:00 heroku[web.1]: Process exited with status 137
2012-05-06T22:41:12+00:00 heroku[web.1]: State changed from starting to crashed
Here is my Procfile:
web: bundle exec thin start -p $PORT
Any responses will be thoroughly appreciated.
If your app does take longer than 60 seconds for "good" reasons, you can work around the 60s boot time limit with https://github.com/dblock/heroku-forward.
The solution was that I had forgotten to include the -p $PORT in my Procfile line.
in Procfile change:
web: bundle exec thin start
to
web: bundle exec thin start -p $PORT
That fixed it for me.
Heroku's boot timeout bit me too. I read several blog posts about how to get around it and ended up automating some of the solutions into a gem.
To reduce the startup time on deploy, you can trim the gems loaded at boot time (this doesn't mean you have to trim them from the app, just boot time).
gem_bench evaluates which gems are likely to not be needed at boot time.
I have an app with about 250 gems and was able to add :require => false to about 60 of them, with dramatic effects.
https://github.com/acquaintable/gem_bench
Disclaimer: I am the author of this open source ruby gem. I wrote the gem to aid myself in solving this exact problem: the 60 second timeout on Heroku.
Hi i was facing the same issue.I have resolved this issue by increase the timeout in /config/unicorn.rb
change timeout 15 to timeout 20 in /config/unicorn.rb
In my case using nodejs I solved this adding a Procfile file with content:
worker: node index.js and push it to heroku.
After that make sure to disable the check "web npm start" and turn on the check "worker node index.js" just like the image attached below
herokuResourcesConfig
I was having the same error when deploying my Node app on Heroku.
I got it solved by adding a Procfile.
web: node app.js
It tells Heroku how to start the application.
The error is because of Heroku is not able to configure on which PORT to run the application.
It can be solved by specifying the PORT for Heroku, ie: in app.js
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`App is running on port ${ PORT }`);
});
Error R10 (Boot timeout)
is this hidden section of heroku allows you to increase the deployment time.
https://tools.heroku.support/limits/boot_timeout
I got this error because Heroku didn't have access to the Mongo Atlas database. You need to change this in the database settings
have the same issue, solved by creating file with proxy server
https://www.npmjs.com/package/http-proxy#setup-a-basic-stand-alone-proxy-server
proxy.js:
httpProxy.createProxyServer({
target, // target that can't cant be exposed, e.g. localhost:4000
changeOrigin: true,
}).listen(process.env.PORT); // port from heroku runtime
then
node server/proxy.js

Resources