deploying jhipster on heroku - heroku

I'm having problems with heroku deployment.
I changed the version number in build.gradle
running:
$ ./gradlew -Pprod bootRepackage -x test
ok ! Then:
$ heroku deploy:jar --jar build/libs/*war
it uploaded the previous war file for some reason ? I though the heroku plugin was some how damaged. So I tried to re install it:
$ heroku plugins:install https://github.com/heroku/heroku-deploy.
Installing plugin https://github.com/heroku/heroku-deploy.... !
▸ yarn --non-interactive --mutex=file:/home/amfibia/.cache/heroku/yarn --cache-folder=/home/amfibia/.cache/heroku/yarn exited with code 1
▸ error Refusing to download the git repo {"protocol":"https:","hostname":"github.com","repository":"https://github.com/heroku/heroku-deploy.#latest"} over HTTPS without a commit hash - possible certificate error?
▸
What does that mean ?? Then I tried to specify the version of the war file it should upload:
$ heroku deploy:jar --jar build/libs/colony-0.7.7-SNAPSHOT.war
but it had errors in the i18n - it worked fine when:
./gradlew
it was perfekt in dev. Now I'm stuck. I had just taken application-prod.yml out of git because I didn't want my email info on github. Could that have caused this problem ? application-prod.yml is in its place but also in .gitignore

Related

heroku - Couldn't find that process type (web)

I am following the tutorial here
but I got the error
Scaling dynos... !
▸ Couldn't find that process type (web).
when doing
heroku ps:scale web=1
I followed the solution here
by delete the buildpack and use heroku buildpacks:set heroku/python
But the error still happend
and for buildpacks:
heroku buildpacks
=== teaching-system Buildpack URL
heroku/python
it seem to be correct
What is wrong with it?
This is what I did to past this error in Django. It's on Windows10
Add Procfile -in the same folder where you have git, manage.py
Procfile
-------------------------------
web: gunicorn <django-root-name(containing wsgi)>.wsgi --log-file -
Installing gunicorn(for later use)
>python -m pip install gunicorn
Clearing BuildPacks & fixing them
>heroku buildpacks:clear
>heroku buildpacks:add heroku/python
commit(empty-commit) & push
>git commit --allow-empty -m "Adjust push heroku master"
git push heroku master
That's what made me pass this scaling dyno.. blah blah
Update:
For local development, add following file
Procfile.windows
------------------------------------------
web: python manage.py runserver 0.0.0.0:5000
Make sure that you have a Procfile that is in the same directory as your Pipfile and Pipfile.lock files.
I'm using django and in Procfile I had:
#Procfile
web: gunicorn <my_project_name>.wsgi --log-file -
Install gunicorn if you haven't already. I had the same error and spent a long time trying to resolve it so I hope this helps. The syntax will change depending on what framework and language you're using, but the idea should be similar.
in Django,i solved creating the next files:
--------------------------------------------
**Procfile.windows** :
web: python manage.py runserver 0.0.0.0:5000
-------------------------------------------
**requirements.txt** :
django
gunicorn
django-heroku
------------------------------------------
**runtime.txt** :
python-3.7.7
-------------------------------------------------------
**Procfile** :
web: gunicorn <name of my main folder app>.wsgi --log-file -
----------------------
**.env** :
TIMES=2
----------------------
and after just do a commit to local repository,so the steps will be:
*
heroku login
heroku create
git commit -m "gogogo heroku"
git push heroku master
heroku ps:scale web=1
heroku open
*
I solved this problem a few week later in another Flask project
It was caused by loosing library: gunicorn in current virtual environment
It may have happened if you have modified your Procfile or renamed it after pushing to Heroku master. If so, you can try to make it work by rebuilding the index.
In my case this worked:
remove cached files (only the paths are removed from the index, not the real files!!!)
git rm -r --cached .
add all files to the index
git add .
commit
git commit -m "hopefully fixed error"
run rest of the heroku commands again
worked for me! hope it does for you.

Heroku run Jar file once deployed?

I have deployed my jar file to heroku using:
heroku deploy:jar <filename>.jar --app <appname>
Once deployed, how do I run the jar file with specific params, i.e. locally i would execute:
java -jar <filename>.jar <param1> <param2>
Am i using the Heroku service correctly? In essence I just need to run the Main command within the jar file and get the logs when completed.
Any help would be much appreciated.
heroku deploy:jar <filename>.jar --app <appname>
With this you essentially hardcorded:
jar <filename>.jar
Here is an example where you can configure parameters for your command
https://github.com/NNTin/shell-kun/tree/6b35e4b731bcf500366f60bbceafe076bf969fe1
Note: We are looking here at older software because HEAD no longer has it.
You need Procfile. app.json and the Heroku Deploy (see link in README.md) button are optional. They make deploying easier since you don't have to touch terminal/CLI.
Essentially you extend your Procfile to:
web: jar <filename>.jar $ARGS_AND_FLAGS
worker: jar <filename>.jar $ARGS_AND_FLAGS
web when you are utilizing a $PORT, worker when not.
Now you can modify your command by editing the environment variable ARGS_AND_FLAGS.
In this case the web process is activated and the worker process is deactivated.
After you changed your environment variable you can deactivate and then activate your process.
Create a Procfile in the same directory where you run heroku deploy:jar with the content:
web: java -jar <filename>.jar <param1> <param2>
and redeploy the app.

Building a dev environment in Heroku for Phoenix

I'm trying to set up Phoenix 1.2 so that I have two Heroku environments: one for dev/testing (which will keep the this-app-12345.herokuapp.com url), and a standard production environment.
Currently, I set up my app the usual way:
mix phoenix.new my_app
cd my_app
mix ecto.create
mix ecto.migrate
git init && git add . && git commit -m "Initial commit"
heroku create
This gives me a Heroku instance:
Creating app... done, ⬢ first-instance-12345
https://first-instance-12345.herokuapp.com/ | https://git.heroku.com/first-instance-12345.git
I then add the buildpacks, change the config/ files and run git push heroku master and everything works.
Now I'd like to create another Heroku instance, to which I can also deploy. If I run heroku create again, I get:
Creating app... done, ⬢ second-instance-23456
https://second-instance-23456.herokuapp.com/ | https://git.heroku.com/second-instance-23456.git
If I replace the url in prod.exs with the new instance...
config :my_app, MyApp.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "second-instance-23456.herokuapp.com", port: 443], force_ssl: [rewrite_on: [:x_forwarded_proto]],
...and then commit and run git push heroku master, it will still deploy to first-instance-12345.herokuapp.com, which isn't what I want.
Re-running buildpacks doesn't help either.
$ heroku buildpacks:add https://github.com/HashNuke/heroku-buildpack-elixir
▸ The buildpack https://github.com/HashNuke/heroku-buildpack-elixir is already set on your app.
$ heroku buildpacks:add https://github.com/gjaldon/phoenix-static-buildpack
▸ The buildpack https://github.com/gjaldon/phoenix-static-buildpack is already set on your app.
Is there a standard method (or any method) to get Phoenix to deploy to multiple heroku environments? (And hopefully specify which one/s on deploy)
The standard way to deploy an app to multiple Heroku apps is to add multiple remotes to the repo and push to the one you want to deploy to. Making that change to config/prod.exs will have no effect on where the app is deployed.
Here's how to add the two remotes:
$ git remote add first https://git.heroku.com/first-instance-12345.git
$ git remote add second https://git.heroku.com/second-instance-23456.git
Now you can deploy to the first one using:
$ git push first master
and to the second using:
$ git push second master
Certainly the best way to do so is to have two different instances as #dogbert wrote.
Also remember about changing Procfile for heroku, because you want to run app using different environments eg.
# Procfile for prod
web: MIX_ENV=prod mix phoenix.server
# Procfile for dev
web: MIX_ENV=dev mix phoenix.server
For both environments you would need to apply migrations:
heroku run MIX_ENV=<env> ecto.migrate

Deploying tagged builds from Travis-CI to Heroku

I am trying to get Travis-CI to automatically deploy a successful tagged build to Heroku. Below is my .travis.yml setup:
deploy:
provider: heroku
strategy: git
run:
- "rake db:migrate"
- restart
on:
tags: true
Upon tagging the repository:
git tag -a 1.0.0 -m "release 1.0.0"
and pushing to the remote repository, Travis-CI kicks off the build but exits immediately after the following:
$ git fetch --tags
Done. Your build exited with 0.
Travis-CI does not deploy the application to Heroku. Am I missing a piece?
There is currently a glitch with on: tags: true that the condition is never met and the code will never trigger a deploy. The github issue is here. The issue should be resolved soon, and in the meantime you can use a branch like releases to update your heroku app with on:branch.
Update:
To fix on:tags, you can do this, as refrenced in the above github issue.
on:
tags: true
all_branches: true

Heroku toolbelt command requires app-name

How do you specify the app you want when you log in to Heroku from the command line?
I was trying to check the logs so when I first logged in I tried:
Heroku logs
this then told me:
! No app specified.
! Run this command from an app folder or specify which app to use with --app <app name>
I then tried:
heroku --app my-appname
but i get:
`--app` is not a heroku command.
I have tried all combinations.
You still need to include the command:
heroku logs --app app-name
You can also use -a instead of --app:
heroku logs -a app-name
Another option is to associate your (git) project to Heroku. From heroku open - no app specified:
$ cd app-dir
$ heroku git:remote -a app-name
$ heroku logs
Try this:
heroku git:remote -a [app_name]
This should allow you to call commands without having to specify which app you want them to be called on.
You could try adding --app app-name after you sentence.
Example: $ heroku domains:add your-domain --app app-name
Heroku CLI automatically detects the app name by scanning the git remotes for the current working copy.
If you're not in the app's local git clone, you need to specify the app name:
heroku logs --app app-name
or
heroku logs -a app-name
or by specifying the remote name:
heroku logs --remote production
You can reference this part of the Heroku documentation:
https://devcenter.heroku.com/articles/using-the-cli#app-commands
From my tests the Heroku CLI will infer the app from the current Git remote.
So to change to the "test" app:
git config heroku.remote test
And to come back to the default "heroku" application, which is probably your production app:
git config heroku.remote heroku
Not sure this is a good idea though...
For future solution seekers-
The error says a possible solution.
Run this command from an app folder
cd to the app directory root, then run your desired command.

Resources