August 5, 2016 | Written by: Evan Compton
Share this post:
Disclaimer: IBM Cloud Tools for Swift (ICT) is no longer supported. Check out IBM Cloud App Service to take advantage of the same features of ICT in a more comprehensive experience for building Cloud Native applications in any programming language.
Currently in beta, the IBM Cloud Tools for Swift (ICT) application runs on MacOS and is part of a larger effort to bring Swift to the server and radically simplify end to end mobile application development. If you are interested in Swift, explore the resources available on the Swift@IBM developer portal.
ICT is for developers who are most productive in the Xcode environment and want complementary deployment and management capabilities in a local environment. We use this tool ourselves to extend proven productivity with Xcode in these areas:
- Code generation and provisioning to pre-tested Kitura runtimes
- Unified management of credentials
- Centralized control and monitoring of assets deployed on the cloud
- Local notifications of remote actions
Since many existing iOS and MacOS clients currently connect to Node.js backends, ICT also facilitates managing and monitoring Node.js and other Bluemix runtimes.
In this post, I’ll show you the steps for creating a Node.js app and using ICT running locally on your computer to make a change to the app, redeploy it, and add a service to it.
A platform’s value is proportional to the ways in which it can be misused. A smart person from the past
If you need a quick overview, please see this step-by-step guide demonstrating how to deploy an end-to-end Swift app and this video demonstration of ICT.
First log into Bluemix; if you need an account, click the button below to register for free.
Sign up for Bluemix
In this walkthru, use the new Bluemix console UI. Begin by selecting the big plus icon on your dashboard. Then select Cloud Foundry Applications and finally SDK for Node.js:
Name your application and click on the Create button:
While Bluemix is creating the initial app, you’ll see some steps to take. Look for the button labeled Download Starter Code:
Click it, unzip the file, and move its contents to a folder that you’ll remember.
Adding the sample app to ICT
If you haven’t done so already, download and install IBM Cloud Tools for Swift:
Start and log into ICT with your Bluemix credentials, then select the + button in the top right to create a new project:
On the Project Creation screen, select the Create Empty Project button:
Give your project a name that reflects your application:
Your project should now be created and you should be on the detail screen:
Right now there’s nothing in it, but we’re about to fix that. Select the + button across from Cloud Runtimes. You should see a pop up, select the + sign for the Add existing Cloud Runtime option:
A sheet should appear showing a list of all your current Bluemix Applications. Select the app you created earlier and click Next:
A dialog should appear to select the folder that contains your app. Find the folder you downloaded earlier and select it:
ICT running locally on your computer will now try to contact your Cloud Foundry app on Bluemix; when it does, it should show up on the project detail page with a Running status. Click on the app card:
You can now see the details of the application, including its URL on Bluemix and where it lives on your local computer:
Updating the sample app with ICT
From the App Detail screen, click on the application link below its name; this should open up the default Bluemix Node.js greeting page with a header saying “Hi there!”:
We’re going to make a slight change to this page. Open the directory that has the app code—ICT can open Finder at the location for you by clicking on the path—and go into the public folder. Open up
index.html and change the
h1 tag on line 18 to some new title:
Save the file and go back to the App Detail page in ICT and select the Deploy icon:
Once ICT notifies you that the app is running again, open up the Bluemix route. You should now see your changes reflected on the page:
Adding a service to the sample app using ICT
In the Bluemix console, select your app from the Dashboard and click on Connect New in the Connections section:
Select the Cloudant NoSQL DB service and give it a name that you’ll recognize easily; then click the Create button to add it to your app:
When prompted, restage your app to make the service available for use. Then go back to ICT and before long, you should see your new service appear in the Services section:
Getting service credentials from within ICT
On the App Detail Screen, hover over the service card and select the Download Credentials option:
Select the folder where you want to save the credentials:
You should see a new file in that folder called credentials-your service name.json:
Open up that file and you should see the credentials needed to use the service in your app locally:
IBM Cloud Tools eases application management for Bluemix users both using Swift and non-Swift applications. It will make any Bluemix user’s life much easier when updating and monitoring their applications. We are continuously improving the app based on your feedback (feel free to offer feedback in the comments section below). You can also see a demo of deploying a Swift app in this video.
—Contributions by Brian White Eagle (@bweagle)