Deploy A Backend App As An Android Engineer — Part 2

Iterate Faster With Ktor

In part 1 I outlined how to deploy an AppEngine app by deploying a .jar file. Since then Google has listened to mobile devs needing to build server side solutions and has launched Kotlin on Google Cloud Platform.

The documentation has room for improvement. I went through 2 other configuration tutorials, Standard and Flexible AppEngine setups in order to realize Ktor was what I needed to deploy a Kotlin app to run server tasks without endpoints.

Ktor allows a standalone backend app in Kotlin that can interact with other libraries just as one would on the client side. The great thing about Ktor is obscure library compatibility issues like this one with Guava, which is still a mystery, are less of an issue because the code runs similar to how it would on an IDE in that you can define the main method of the app and let it run.

Despite Jars being slow to work with I still am using a Jar deploy for some use cases. For instance, authenticating with Firebase is straightforward and reliable with service accounts used in Jars, whereas with ktor there is this issue with authentication that I’ve discovered.

Jars are Janky

  • ~10–20 min deploy times.
  • Must rebuild .jar every time to test new code or different environment types.
  • Library incompatibility issues.

Tutorial: Run a Kotlin Ktor app on Google App Engine Standard

This tutorial was quick, clear, and concise. I highly recommend it! One aspect it left out is versioning which is important as I like to have a staging and production version deployed to AppEngine.

Versioning with Gradle

App Engine Gradle Plugin Tasks and Properties


appengine {
deploy {
version = '1-2-0'

File Notes

appengine-web.xml sample uses:

web.xml: Under src/main/webapp/WEB-INF/ sample use:

  • web.xml: defines mappings between URL paths and the servlets that handle requests with those paths

Managing SDK Configurations

Rather than building artifacts in IntelliJ repeatedly the command line can quickly help you create and navigate between AppEngine projects, run your app to test, and deploy to the server.

Managing Deployed Apps

read original article here