How to deploy Dropwizard comparison sample to Heroku PaaS platform
How to deploy Dropwizard comparison sample to Heroku PaaS platform
Leave feedback
On this page
There are lots of ways to publish application. One of the most popular among them is to deploy websites or web application with a help of PaaS (platform as a service). Luckily, GroupDocs.Comparison API created to be easily integrated with them. This article is about deploying comparison sample application, developed with Dropwizard Framework, to Heroku - very popular PaaS platforms. The comparison sample application is completely free to be used and modified. It is available on GitHub page.
System requirements
It is important to install next applications before deploying the sample to Heroku server
Heroku CLI - tool to create app in Heroku account (of course, you need an account)
Git - tool to work with sample application repository and to deploy it to Heroku server
After that, project with samples from GitHub will be downloaded to your local directory. Do not close the command line
General points in the project to be deployed to Heroku
Sample configured to use PORT environment variable (file configuration.yml). It must be done because Heroku can change port each time app starts
To let Heroku know how to run the application, special file (Procfile) was created
File system.properties was created to specify Java version that the app needs
Creating Heroku application
Run next command to go to samples directory and to run log in process
Heroku page will be opened in a browser where you must log in so that command line tool will have access to your account
Run command below to create new Heroku application
Where my-dropwizard-comparer is the name of new application. You are free to change it however you want, the only thing - it must be unique. The result of the command is a web url to access your new application and a link to heroku git repository. Below is an example of command line result output:
Next, add heroku repository link as a ‘remote’ to sample application repository using command below
Where my-dropwizard-comparer is Heroku app name, heroku-dropwizard heroku repository identifier. You can change it, but don’t forget new one.
Deploy the application to Heroku server using command below
Here is Demos/Dropwizard a path to the sample you want to push. It is relative, starts from git root of the sample. heroku-dropwizard is heroku repository identifier from previous step. master is a git branch in Heroku repository. At the moment Heroku deploys only master and main branches.
The command will upload Dropwizard sample to Heroku server and start its build. 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-dropwizard-comparer.herokuapp.com/) in your favourite browser to see the application that was uploaded. In order to check the app you can upload few files with a help of Comparison UI.
To manage applications you can use Heroku web interface
Useful commands
The command below will show common help of Heroku CLI
To see help for definite command, type it after help word
To see logs of specific application just run next command (you can add --tail parameter to show logs in real time)
It is easy to access remote filesystem running command below
Note: all changes in remote filesystem will be lost when the app restarts
To restart the app use command below
More opportunities
GroupDocs.Comparison API is not only modern but also powerful solution to compare different documents, images and other files. In the same time, comparison samples are fully free to use and open to be changed. You can update them to work with Heroku add-ons, for example database or files storages. Dropwizard sample has lots of options (see configuration.yml) which are available by setting environment variables. It is easy to change them in Heroku web interface or using command line. Furthermore, Dropwizard sample has embedded solution to use Google Drive API or Dropbox API as a storage of files to be compared. To find out more see Google Drive API integration and Dropbox API integration pages
Comparison sample application created using Dropwizard Framework is only one example of using GroupDocs.Comparison API for comparing Pdf, Word, Excel spreadsheet, PowerPoint presentations, Diagrams, CAD files, OpenOffice files, images and much more supported file formats. You can find more samples of using GroupDocs.Comparison with Java and Kotlin on GitHub page. For more details, options, and examples, go through the documentation and GitHub repository. Reach us on the forum for your queries.