How to deploy Ktor comparison sample to Heroku PaaS platform

Platform as a service (PaaS) is very popular solution to deploy web applications and websites. Luckily, GroupDocs.Comparison API can easily be integrated with them. In the article is described how you can deploy comparison example, that is written with Ktor Framework to one of the most popular PaaS platform - Heroku. The comparison example is free to use and is available on GitHub page.

System requirements

To deploy the sample to Heroku server you need next applications to be installed

  1. Heroku CLI - to get access to your account (of course, you need an account)
  2. Git - to load the sample application and to deploy it to Heroku server

Getting sample application from GitHub

  1. Go to GitHub page with samples of GroupDocs.Comparison API

  2. Click green button Code on the right top of the page and copy HTTPS repository link

  3. Open Windows Command Line or Linux terminal and run next command

    git clone

Sample app was downloaded from GitHub to your local directory. Do not close the command line

Key points in the project to be deployed to Heroku

  1. Special gradle task was added to build.gradle.kts. It is needed for Heroku to build the executable file the sample
  1. Using port from PORT environment variable (file application.conf). It is important, because Heroku can change port each time app starts
  1. File Procfile was created in order to say Heroku how to run out application
  1. File was created to specify Java version our app needs

Creating Heroku application

  1. In command line run next commands

    It will open Heroku web page where you should log in to give command line tool access to your account

  2. Create application running next command:

    Where my-comparison-app-name is the name of the app. You can use any name, 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: |

Deploying sample application to Heroku

  1. Add heroku git repository link as a remote to sample app repository running next command:

    Where my-comparison-app-name is app name, heroku is just a name which will be used by git to identify heroku git repository. You can change it, but don’t forget new one.

  2. Push the application to Heroku server

    Here is Demos/Ktor 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 is a name from previous step, that is used to identify heroku git repository. master is a git branch in Heroku git repository. Heroku deploys only master and main branches.

    As a result of the command the sample will be uploaded to Heroku server and the build of the sample will be run. You will see the output of the build in command line. Everything must finish successfully. If so, just open link from step 2 ( in browser to see uploaded application. To check the app you can upload few files using Comparison UI.

You can manage your apps in Heroku web interface

Useful commands

  • To show common help use next commands

  • To show help for definite command, type it after help word

  • To show logs use next command (add --tail parameter to show logs in real time)

  • To access remote filesystem you can use next command

    Keep in mind, all changes in remote filesystem will be lost when the app restarts

  • To restart the app, use next commands

More opportunities

GroupDocs.Comparison API is a very powerful and modern solution for comparing different files, documents and images, while its samples are completely free and open to be modified. You can change them to work with Heroku add-ons, for example database or files storages. Ktor sample has different configurations (see comparer.conf) which are available by setting environment variables. You can do it in Heroku web interface or from the command line.

Get a Free API License

Lots of comparison settings, for example, generating summary page, sensitivity of comparison and so on, are available only with license. You can get a free temporary license in order to use the API without evaluation limitations.


Ktor sample app for GroupDocs.Comparison 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.

See also