How to deploy Spring comparison sample to Heroku PaaS platform
How to deploy Spring comparison sample to Heroku PaaS platform
Leave feedback
On this page
One of the most popular solutions to deploy web applications and websites is PaaS (platform as a service). Fortunately, GroupDocs.Comparison API developed to be easily integrated with them. This article describes the way you can deploy comparison example, developed with Spring Framework, to one of very popular PaaS platform - Heroku. The comparison example is completely free to use and modify. It is available on GitHub page.
System requirements
Next applications must be installed to deploy the sample to Heroku server
Heroku CLI - tool to access Heroku account (of course, you need an account)
Git - tool to download sample application and to deploy it to Heroku server
The command will download project with samples from GitHub to your local directory. Do not close the command line
Main points in the project to be deployed to Heroku
Maven profile to build JAR file is configured and active by default
Sample configured to use PORT environment variable (file configuration.yml). It is important, because Heroku can change port each time app starts
To say Heroku how to run the application was created special file (Procfile)
File system.properties was created to specify Java version our app needs
Creating Heroku application
Run next command in order to go to samples directory and to log in with Heroku account
The last command will open Heroku website where you should log in to grand command line tool access to your account
Use next command to create new Heroku application
Where my-spring-comparer is the name of the app. You can change it however you want, but it must be unique. The result of the command will be a web url to access your new app and a link to heroku git repository. Here is an example of command line output:
Next, add heroku repository link as a remote to sample app repository using next command:
Where my-spring-comparer is the name of Heroku app, heroku-spring is a name that will be used by git to identify heroku repository. You can change it, but don’t forget new one.
Deploy the application to Heroku server using next command
Here is Demos/Spring a path to the sample you want to push. The root of the path is a root directory of git project of the sample. heroku-spring is heroku repository name from previous step, that is used to identify it. master is a git branch in Heroku repository. At the moment Heroku deploys only master and main branches.
The command will upload Spring sample to Heroku server and start building it. You will see the output of the build process in the command line. Everything must finish successfully. If so, just open link from step 2 (https://my-spring-comparer.herokuapp.com/) in your favourite browser to see uploaded application. In order to check the app you can upload few files using Comparison UI.
You can manage your applications in Heroku web interface
Useful commands
Use next command to show common help of Heroku CLI
To show help for definite command, type it after help word
To show logs of specific application use next command (add --tail parameter to see logs in real time)
It is possible to access remote filesystem using next command
Don’t forget, all changes in remote filesystem will be lost when the app restarts
You can restart the app using next command
More opportunities
GroupDocs.Comparison API is a modern, useful and very powerful solution to compare different documents, files and images, while its samples are completely free to use and open to be modified. You can change them to work with Heroku add-ons, for example database or files storages. Spring sample has different configurations (see configuration.yml) which are available by setting environment variables. You can do it in Heroku web interface or from the command line. Moreover, Spring sample has implementations of using Google Drive API and Dropbox API as a sources of files for comparison. To find out more see Google Drive API integration and Dropbox API integration pages
Comparison sample application created with Spring Framework as a core, is just one example of using GroupDocs.Comparison API for comparing Pdf, Word, Excel documents, PowerPoint presentations, Diagrams, CAD files, images and much more supported file formats. There are more samples of using GroupDocs.Comparison with Java and Kotlin on GitHub page. To get more details, options, and examples, you can go through the documentation and GitHub repository. Reach us on the forum for your queries.