- 1 Introduction
- 2 How to build and deploy any application on Bluemix via CLI
- 3 Conclusion
The focus of this tutorial is to create a live application on Bluemix using Command Line Interface(CLI). Beginners spend most of their time to understand the features, functions, and usability of the Bluemix and that takes a lot of time to learn so here we’ve made it quite easy for you to understand.
However, to realize the usefulness of their applications, beginners often have to deal with server management, as well as installing and configuring the server also requiring its implementation to run as fast as possible. This small tutorial covers how you can deploy a web application(Node.js Application) just by doing some simple steps, giving you an overview of working with Bluemix through CLI. We’ve also covered how to test and demonstrate the app when it is deployed.
How to build and deploy any application on Bluemix via CLI
Things Required to deploy your application on Bluemix
- IBM Bluemix Account(Trial account works like a charm).
- Cloud Foundry CLI for Windows
- Stable ISP
Creating the application on Bluemix via Cloud Foundry Apps:-
- Open Bluemix website and click on Login
- Sign into you Bluemix Account with your credentials.
- After Logging into Bluemix account, you will be redirected to the dashboard
- Click on Create App or Click on Catalog
- In Catalog section, scroll down, and you will find Cloud Foundry App section.
- Go to SDK for Node.js.
- P.S: You can also select framework as per your area of interest because the procedure to deploy apps on Bluemix is same for all other apps.
- After selecting the framework, it will redirect you to another page where it will ask you to enter the name of your application and URL of it
- Click Create, and it will start building and deploying your app, it will take some seconds to start the application
Click on View App and check whether your application has successfully deployed and it’s running smoothly or not.
Building and Deploying the application on Bluemix via Command Line Interface(CLI) after modifying the code
So finally our application is deployed on Bluemix, now comes the modification part, use the Cloud Foundry command line interface to download, modify, and redeploy your Cloud Foundry applications and service instances instantly.
- Download CF Command Line Interface from Github and install it on your Windows machine
- After installing Command Line Interface(CLI), Download the starter code which is being provided by Bluemix
- After downloading the starter code, extract it into a new folder and rename that folder to your application name.
- Open your Application folder – Go to Public folder – Edit index.html file(use any tools like notepad, notepad++, etc. to edit it)
- Just edit some minor things like h1 tags, description of the page and save it.
- Now open up your application folder and press “SHIFT + Right Click” anywhere and click on “open command window here.”
- Now enter this code inside command prompt to set the region, P.S if you have created your application in US South Region then enter this
cf api https://api.ng.bluemix.net
or if you have created your application in Sydney then
cf api https://api.au-syd.bluemix.net
or if you have created it in the United Kingdom
cf api https://api.eu-gb.bluemix.net
- After selecting your region, login into your Bluemix account
- Finally, its time to rebuild and deploy your Bluemix application, to rebuild and deploy your application enter this command and then it will start deploying your application.
- Your application is successfully updated and deployed on Bluemix.
- View your application
So your Node.js application is successfully built and deployed on Bluemix, well the procedure for others application like PHP, Liberty for Java, etc. is also the same as we did in above tutorial. So after this small tutorial, I hope you would be able to create an application on Bluemix from an existing template/catalog, how to use Command Line Interface(CLI) and how to build and deploy your application.