I am unable to deploy phoenix app to heroku because of failed dependency (called coherence) compilation, how to make it work? - heroku

So to start I made an Elixir application using Phoenix framework.
This application uses coherence dependency for authentication to the website. This dependency was installed as it is advised on the git repo with -full argument to install all the options coherence has.
Then, I did just change a couple of lines in config.exs file of my project to use mailgun service for mailing and put credentials over there.
Next, I installed and configured my other deps (they have nothing to do with coherence).
Locally, my application could compile and run without problems.
Then, I wanted to deploy it to Heroku using Phoenix guidelines.
When I completed all the steps, I got an error when trying to push the application to Heroku.
I then tried to check the file lib/mix/tasks/coherence.clean.ex and the line 162 where I found a comment that said there is an error with updating a config file, but I couldn't figure out what that means and how to solve that.
I tried to make a fresh phoenix application, installing coherence with the same or different options and afterward deploying it following the Phoenix guidelines. Every time I was getting the same error.
I also want to note that I did try to create elixir_buildpack.config file and putting always_rebuild=true there and had no success. (it is a solution mentioned in troubleshooting section of deploying to Heroku guide)
So, my question is, what do I need to change in my config.exs file (or elsewhere) in order to make at least a fresh application with coherence installed to compile and work on Heroku?
useful links:
coherence dep github link
Thanks a ton guys.

The Heroku Buildpack for Elixir currently defaults to Elixir 1.2.6 while the code that throws that error uses the else syntax with with, a feature that was added in Elixir 1.3.0, so you need to set the Elixir version to use to 1.3.0 or later by adding the following to elixir_buildpack.config:
elixir_version=1.3.2

Related

spring-mvc-404 page not found error in maven project

I have been trying to understand and clone the spring mvc login and registration process. As far as I know I am following the same code and process. Only thing I have changed is database details.0 Which works fine I am able to insert the data into the MySQL (8.0.27) database using test file. I am getting the same error even when I am trying his code I am getting error.
here is my code: https://drive.google.com/drive/folders/1JNkZp_O1Lh0y_1NdZ-A85KI1gfgy0_Em?usp=sharing
here is GitHub code: https://github.com/javabyranjith/spring-framework-mvc/tree/master/springmvc-userlogin
Errors I am getting:
action keyword in form was giving error "element loginProcess is not found"-> so I changed it to the form action then it worked
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
my questions are
can a different version of Apache Tomcat(10.0.13) server can cause the issue?
since I am using new Eclipse so I have updated the new libraries can this cause the issues?
Please suggest the changes so that I can run this project. Suggest the changes here or directly change it in the google drive folder.
Tomcat 10 does not work with Spring 5. Downgrade to Tomcat 9.
10th has jakarta packages renamed from javax, which spring 5 does not support.
Friendly advice, if you are using code from git, they left versions of stuff like java and tomcat for a reason, and the newest versions like Tomcat 10 and JDK17 went through a lot of changes, so always try with suggested versions and try to migrate them to higher ones. Except for Tomcat 10, you will have to wait for Spring 6 for that.
As for the new eclipse, it does not make any difference, the maven project is still the maven project, src, and pom.xml, the structure remained the same.
First try with suggested versions then you can ramp them up once you are sure that it is working.

Is it possible to deploy a raw Java web app to Heroku?

Very inexperienced user here...please be patient!
I inherited maintenance of Heroku app from someone no longer with the company. Having to re-deploy an app update is probably a once-a-year event, and here we are.
The instructions I have include building a standalone jar file containing my app and then deploying it to Heroku. Specifically the procedure for this is to use the Heroku CLI with the following command:
heroku deploy:jar webapp.jar -a my-app
Easy enough. Except he had his own instance of the Heroku CLI, and when I went to download my own copy, it appears that the deploy command no longer exists! Is this the case? Is this a deprecated command? Do I need to go through the process of figuring out how to set up a git repository to deploy this? (We are in fact using git to manage the source for this app, but it's behind our company firewall, so I'm not sure how practical/difficult it will be to set this up for Heroku). I just want to make sure I'm not missing something simple before investing a significant amount of time re-inventing the deployment process. Thanks.
The most popular mechanism is indeed to push the code from git to Heroku, providing the necessary files (i.e. profcile) to deploy the runtime.
An alternative is to create a Docker image and push it to the Heroku Registry (which in your case would require more reworking).
Refer to Deploy with Git, the firewall should not be a problem as Heroku will not access your code, but you will need to perform the push (git push heroku master)
I have to answer my own question because I was able to find the solution.
It turns out there is a plugin available for the heroku CLI that provides the deploy command. Running heroku plugins:install java will install the plugin that provides the deploy command in the heroku CLI.
See https://devcenter.heroku.com/articles/deploying-executable-jar-files for more information.

How to move cloud code from parse.com to heroku

I have moved parse sever from parse.com to heroku. Everything is working fine except cloud code('cloud/main.js' file).
I have replaced "main.js" of parse.com with "main.js" of parse server code and deployed on heroku, but it is not working. Getting following error when I make request from my mobile app
{"code":1,"message":"Internal server error."} (Code: 1, Version: x.xx.x)
Any idea?
Note:
I've followed following link for migrating parse server
https://learnappmaking.com/how-to-migrate-parse-app-parse-server-heroku-mongolab/
Migrating cloud code can range in difficulty depending on how involved that code is. Here's a workflow for validating your code:
1) Check that you can build your Heroku app locally with the right Node version.
2) Comment out all of your cloud code. You want to start introducing your code in parts and make sure it compiles with each re-introduced function.
3) Install the node modules for each service that you use. If you use stripe/mailgun or any other package, add them in your package.json file and run npm install. Then include them in your main.js file with the require('packageName').
4) The cloud server uses Express.js version 4.2 and a Parse.com runs Express version 2.0 or 3.0 but not 4.0. If you use any middlewear then you need to change it to the proper Express 4.0 syntax/methodology.
5) There is no support for cloud jobs so rename all your *.job functions to *.define and comment properly so you can come back to them later. If you did not use cloud jobs then don't worry.
6) If you did use cloud jobs, now you need to setup a heroku worker/scheduler to run those old *.job (now *.define) calls at the proper time intervals you had.

Building JAR files in a Heroku app

I have a web app running on Heroku from which I need to build and make available a JAR file when a user of the app requests it. I also need to run ProGuard on the generated JAR file. Is it possible to do this on Heroku?
We're working on exposing Heroku build infrastructure as services and what you describe is a use case that we want to support. You might be able to get something working by using or reverse-engineering heroku-push: https://github.com/ddollar/heroku-push
Here's the server-side bit that actually builds code: https://github.com/ddollar/anvil
Ryan Brainard has built a Java wrapper for Anvil: https://github.com/ryanbrainard/janvil

How configure a shared database with Play/Heroku?

I started by defining a framework ID as specified here
http://www.playframework.org/documentation/1.2/guide11
I called my server appnameheroku
Then I retrieved the database URL using
heroku config
from the console
I then added the following two lines to application.conf
%appnameheroku.jpa.ddl=validate
appnameheroku.db=postgres://....compute-1.amazonaws.com/etc
I then deploy the app and get the following error
Oops, an error occured
This exception has been logged with id 6963iilc8. I'm using the free version of Heroku.
Two things here: Storing config in the application code is a bad idea, as it prevents Heroku from carrying out a lot of administrative tasks on your behalf.
Therefore I would configure my application.conf as:
db=${DATABASE_URL}
jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
jpa.ddl=update
Heroku don’t recommend setting jpa.ddl to update for a real world production app. Use Play!’s database evolutions instead.

Resources