Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Deploy A Backend App As An Android Engineer — Part 2
Iterate Faster With KtorOriginal photo by SpaceX on Unsplash
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.
Deploy A Backend App As An Android Engineer
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
build.gradle
appengine { deploy { version = '1-2-0' }}
File Notes
appengine-web.xml sample uses:
- Specify Java 8 runtime
- Scaling
- Resource files using include
- SSL enabled (HTTP vs HTTPs)
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
I’m Adam Hurwitz — hit the clapping hands icon and check out the rest of my writing if you enjoyed the above. Thanks for reading!
Resources
GCP
IntelliJ
- Configuring your development environment
- Creating a new App Engine project
- Adding (GCP) Framework Support (to IntelliJ)
- Creating a new (IntelliJ) application (to use with GCP)
- Checking out an existing (IntelliJ) project (to use with GCP)
Kotlin
- Run a Kotlin Ktor app on Google App Engine Standard
- App Engine Gradle Plugin Tasks and Properties
- ktorio/ktor-samples
- Logging Console
- ktor
- Kotlin on Google Cloud Platform
Online Communities
- stackoverflow.com/questions/tagged/google-cloud-kotlin
- Cloud Kotlin Google Group
- GoogleCloudPlatform/kotlin-samples
- googleapis/google-cloud-java
- GoogleCloudPlatform/app-gradle-plugin
Deploy A Backend App As An Android Engineer — Part 2 was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.