How to deploy Ktor comparison sample to Heroku PaaS platform
How to deploy Ktor comparison sample to Heroku PaaS platform
Leave feedback
On this page
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
Heroku CLI - to get access to your account (of course, you need an account)
Git - to load the sample application and to deploy it to Heroku server
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
Special gradle task was added to build.gradle.kts. It is needed for Heroku to build the executable file the sample
Using port from PORT environment variable (file application.conf). It is important, because Heroku can change port each time app starts
File Procfile was created in order to say Heroku how to run out application
File system.properties was created to specify Java version our app needs
Creating Heroku application
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
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:
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.
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 (https://my-comparison-app-name.herokuapp.com/) in browser to see uploaded application. To check the app you can upload few files using Comparison UI.
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.
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.