Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
Anthony Amanse edited this page Jun 20, 2018 · 2 revisions

Short Name

Kitura on Kubernetes

Short Description

Develop a Full-Stack Swift application with a native iOS app and Kitura on Kubernetes

Offering Type

Cloud

Introduction

Full stack development can be tough. When coding in different languages and different frameworks, things can get messy. When Swift was open-sourced, a lot has changed and allowed iOS developers to fully code their backend with Swift. Kitura is one of the powerful server-side Swift web frameworks that helps developers concentrate and spend more time in the logic of their application. Kitura can also be deployed in Kubernetes and be exposed on a public domain to act as an iOS app's back-end infrastructure.

Author

Anthony Amanse

Code

https://github.com/IBM/kitura-on-kubernetes

Video

Overview

In this code pattern, we will create a simple step tracker iOS app written in Swift. The application's backend will also be written in Swift with the use of Kitura, a server-side web framework for Swift. This code pattern is for iOS developers who wish to write both their frontend and backend in one language. Working in one language helps developers concentrate and spend more time in the logic of their application rather than learning or dealing with another programming language. The 3 simple Kitura microservices will be deployed in Kubernetes, a container orchestration platform. The sample iOS app is a simple step tracker that rewards users with "fitcoins".

When you have completed this code pattern, you will understand how to:

  • Build a server-side Swift application with Kitura
  • Use Kitura with Swift Kuery to connect to a Database
  • Deploy Kitura microservices in Kubernetes
  • Integrate an iOS app with the Kitura backend
  • Make Kubernetes available under a public domain with TLS

Flow

Architecture diagram

  1. The first time the iOS app opens, it would try to register through the Users microservice.
  2. The Users microservice communicates with an external service for its avatar assignment to the user.
  3. The Users microservice then persists the user info in the database. The Users microservice would also update the steps of the users and award them "fitcoins".
  4. The Leaderboard microservice provides a way to give the users standings with their steps count based on the stored data in the database.
  5. The Shop microservice will get the products from the database where users can exchange them with their "fitcoins". This is also where the APIs for creating the transactions on updating the "fitcoins" of the users.

Included components

  • IBM Cloud Kubernetes Service: IBM Bluemix Container Service manages highly available apps inside Docker containers and Kubernetes clusters on the IBM Cloud.
  • Kitura: Kitura is a free and open-source web framework written in Swift, developed by IBM and licensed under Apache 2.0. It’s an HTTP server and web framework for writing Swift server applications.
  • PostgreSQL: Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs.

Featured technologies

  • Container Orchestration: Automating the deployment, scaling and management of containerized applications.
  • Databases: Repository for storing and managing collections of data.
  • Microservices: Collection of fine-grained, loosely coupled services using a lightweight protocol to provide building blocks in modern application composition in the cloud.
  • Mobile: Systems of engagement are increasingly using mobile technology as the platform for delivery.
  • Swift on the Server: Build powerful, fast and secure server side Swift apps for the Cloud

Blog

http://developer.ibm.com/code/?p=38904&preview=1&_ppp=c7db717d11

Links

  • Kitura: A powerful server-side Swift web framework.
  • Swift-Kuery-ORM: An ORM (Object Relational Mapping) library built for Swift. Using it allows you to simplify persistence of model objects with your server.
  • cert-manager: A native Kubernetes certificate management controller. It can help with issuing certificates from a variety of sources, such as Let’s Encrypt, HashiCorp Vault or a simple signing keypair.
  • Deploy a Core ML model with Watson Visual Recognition: code pattern shows you how to create a Core ML model using Watson Visual Recognition, which is then deployed into an iOS application.