In a previous blog post, I covered the steps for creating an IBM Container on Bluemix that hosts the Swift HelloWorld sample application. This time, I thought I would go over the steps for creating an IBM Container that hosts the Kitura-Starter application.
For those who are not familiar with Kitura, it is a lightweight web framework that you can use for building web services with complex routes. A lot of its design was inspired by Express.js (a Node.js module), given the success and high adoption rate that it’s had since its launch.
If you have not read the 10 Steps To Running a Swift App in an IBM Container blog post, now it’s a good time to go over it. Especially, make sure you cover steps 1 through 5 before attempting the following steps.
Once you have set up and configured your Cloud Foundry command line and the IBM Containers plugin as described here, you should push a copy of the ibmcom/kitura-ubuntu image to your Bluemix account. The
ibmcom/kitura-ubuntu Docker image extends the ibmcom/swift-ubuntu image by adding the Kitura-Starter sample application. The contents of the Dockerfile for the
ibmcom/kitura-ubuntu image can be found here.
To download the
ibmcom/kitura-ubuntu image from Docker Hub and push it to your Bluemix account, you can use the following command:
$ cf ic cpi ibmcom/kitura-ubuntu:latest <bluemix registry>/<namespace>/kitura-ubuntu
Please note that you should replace
<namespace> with the namespace assigned to your organization and
<bluemix registry> with the name of the registry for your Bluemix region. For instance, for the US South region, the name of the registry is
registry.ng.bluemix.net. Depending on your network connection, this step may take several minutes.
To access an IBM Container, a public IP address must be assigned to it and you can easily request one using the
cf ic ip request command.
We are now ready to create an IBM Container named
kitura-container that hosts the Kitura-Starter application by executing one simple command:
$ cf ic run -p <ip_address>:8080:8080 --name kitura-container <bluemix registry>/<namespace>/kitura-ubuntu
You should replace
<bluemix registry>, and
<namespace> with the corresponding values.
Thatâ€™s it! You should now have an IBM Container that runs the Kitura-Starter application. If you access your dashboard on Bluemix, you should see an entry for the
kitura-container you just created. You can click that entry to verify that the IBM Container is up and running the Kitura sample application. You can also use your browser to test that the Kitura sample application is running by going to
<ip_address> is the IP address assigned to your IBM Container. The â€śYou’re running Kituraâ€ť message should be displayed on your browser.
Our team is actively working on adding more functionality and capabiltiies to the Kitura web framework. If you’d like to parcitipate and contribute to this effort, please do so! Our code is open source and we welcome contributions from developers who are passionate about the Swift language, server side development, and quality. Also, we plan to implement Swift packages that will allow integrations with middleware software and Bluemix services. Stay tuned for updates!
Ricardo Olivieri, Senior Software Engineer, IBM Swift Engineering at IBM Cloud