- Creating Web Components in Angular - February 23, 2021
- What is your Communication Style? - August 1, 2020
- Sharing is caring? - January 28, 2020
Ever wondered, how to deploy an application to cloud. Here I will give you an introduction how to deploy a sample .NET application to IBM Cloud. Even though I will be demonstrating with a .NET application, you can tweak it to change it according to your needs to suit applications made in other technologies.
We would be using an IBM cloud account, to deploy our sample app. You can sign up for their trial version.
Prerequisites:
Asp.Net Core (By default Visual Studio 2017 will have Asp.Net core installed. With Visual Studio 2015 you may need extra plugins for the same.)
Step 1: Signing up for a trial IBM Cloud account.
You can sign up for a free trial IBM Cloud account as below: quot;,
Once you are done with the registration, you would be taken to the dashboard:
Click on ‘Create Resource’ here. Since I would be deploying an ASP.NET Core app, I will select that as the type of resource that I want to create. You can select the resource as the type of application you want to deploy.
While creating the resource you have to enter your app name and other details. Remember the app name and the region that you select. This will be required later.
Once the app the created, click on ‘Visit App URL’. It will look as below.
Note down the URL for your application, as you would be pushing your new .NET application to this URL.
Step 2: Downloading the IBM Cloud CLI
Download IBM Cloud CLI here
Step 3: Creating a sample app
Now lets create a new a sample app to deploy. Lets open visual Studio 2017, and select a new ‘ASP.NET Core Web Application’ as follows:
Now run this sample application . It will look as below:
Now we need to publish this app, before deploying it on cloud. Right click on it and select publish details as follows:
Step 4: Pushing your sample app to Cloud
Once you have successfully published your app, open your command prompt and type the following command:
Ibmcloud login -u [username]
It will ask for password. Enter it
It will then ask for the region where you want to run it. Select the region that you had selected when creating your IBM Cloud account. If you don’t remember, either check the URL of your app, or go to your IBM Cloud account to find out the region.
Now type the following command to start using cloud foundry commands.
Ibmcloud target –cf
You are now set to push your application to cloud:
Navigate to the folder where you have published your code through command prompt
Type the following command:
cf push [appName]
The appname will be the one that you had entered while creating the IBM Cloud account.
Once the push is successful goto your original url and you will find that the app has been pushed to cloud.
We have successfully managed to push our app to cloud.