page-brochureware.php

Deploy Swift Applications via DevOps Toolchain

Introduction

The following end-to-end tutorial demonstrates the steps to create a basic Swift web application and deploy it with the DevOps Toolchain. Enabling a toolchain is a valuable option as it creates a team-based development environment for Swift projects. When creating a toolchain, the App Service provisions a Git repository, useful for viewing source code, cloning a project, and creating issues for tracking. Additionally, the toolchain includes a continuous delivery pipeline that is customized for the selected deployment platform: Cloud Foundry or Kubernetes. Use the toolchain to set up continuous delivery by automating builds, tests, and deployments through the delivery pipeline, GitHub, and more.



Using IBM Cloud App Service

IBM Cloud App Service is an online console that makes it easy to quickly create and manage applications, configure and attach services (such as databases, notifications, and Watson), and monitor and deploy apps. The App Service can deploy to IBM Cloud as a Cloud Foundry application, to IBM Container Service, or to both environments using a DevOps toolchain.

  1. Create a new project and toolchain

    1. From the Starter Kits page in the App Service, select a Starter Kit based on programming language. For example, for a Swift Kitura application, go to Kitura Basic then click Select Starter Kit.
      • Note: Be sure to log into an IBM Cloud account first before createing a project. First-time users can register for a free account.
    2. Enter project name.
    3. Enter a unique hostname. This hostname will be used for the project route.
      For example: my-swift-kitura-project.mybluemix.net.
    4. Click Create Project.
    5. After the project is created, click Create Toolchain in the Deploy with Toolchain panel.
    6. Select a deployment method. The deployment options include:
      • Cloud Foundry App, where underlying infrastructure does not need to be managed.
      • Kubernetes Cluster, where a set of worker nodes can be provisioned and configured to deploy and manage highly available application containers.
    7. Click Create after configuring any options to create the toolchain.


  2. View and edit the Swift project with Git

    1. Click View Toolchain in the Deploy with Toolchain panel:
      • Issues create and manage issues within the newly created Git project.
      • Git view the project commit history as well as make edits.
      • Eclipse Orion Web IDE a full in-browser editor for modifying the Git project.
      • Delivery Pipeline monitor and change the project delivery pipeline to automate deployment.
    2. Click Eclipse Orion Web IDE under the Code column.
    3. This view shows the entire contents of the project. Choose a file on the left-hand menu to edit and change.
      For example: public/index.html.
    4. Click the code window, change some of the code (e.g. a header), then click on the Git button to commit the changes. Edit the commit message, keep the target branch as master, then commit changes.


  3. Start builds and verify deployment in the delivery pipeline

    1. Navigate back to the toolchain, then click Delivery Pipeline in the Deliver column.
    2. In the Build Stage, notice that the commit made earlier is listed under Last Input. This commit triggered the stage to create a new build of the project with the new changes.
    3. Wait for the Build and Deploy Stages to complete, then verify that the jobs passed.
    4. If the project has an exposed endpoint, click the link under Last Execution Result in the Deploy Stage to launch the app in a browser and verify the changes from earlier were made and deployed. The log files can also verify successful deployment.


Conclusion

This tutorial explained how to:
  • Use IBM Cloud App Service to create a new web application.
  • Configure a DevOps toolchain to automatically handle the project deployment.
  • Modify the project and commit a change to trigger the deployment pipeline.
For more information, check out Swift@IBM and take a look at the following tutorials: