Bluemix Deployment
Link Existing GitHub Repo with Bluemix and Set up Continuous Integration
It is a fair assumption that a lot of developers would be interested Bluemix platform functionalities blended in with something that they already developed. This chapter would help developers to integrate a project hosted on the GitHub with the Bluemix platform and to set up a continuous integration cycle with every commit and push to the GitHub. After following the steps below you would be able to link your GitHub repository with your Bluemix account, make changes to your projects in your favorite text editor, push those changes to the GitHub and watch from the Bluemix dashboard how it is picked up automatically and a build/deploy processes are triggered. After the deployment is finished you would be able to access your application in the cloud.
Set up a GitHub repository
Create a New Repo on GitHub. Click Create a new Repository
Optional: add README and .gitignore
Copy the gitHub url for this repo
On your local machine go into the project folder
Initialize git with: git init
Type: git add .
Type: git commit -m “First commit”
Type: git remote add origin
<your_repo_url>
Type: git push
Now the project is on the github and ready to be linked to the Bluemix
Link this repository to your Bluemix account
On Github from this newly created project go to Settings
On the left sidenav there will be Integrations&Services. Click it
Click ‘Add Service’ and search for IBM Bluemix DevOps Services
In the prompt form enter Bluemix credentials and click Add
On the Bluemix go to DevOps Services and click Create a Project
Click Link To An Existing Repository
Log in to GitHub if prompted
Select a repository from the dropdown
Set up Continuous Integration
In the top Right Corner of your project inside DevOpsServices click on Build&Deploy button
Click Add Stage
Click Jobs
Click Add Jobs and select from the dropdown
If Build&Deploy picked and the checkbox for auto pick up was selected now the repo should be connected to the bluemix and every time the commit is made and pushed to GitHub it will be pushed into the bluemix as well and build&deploy actions will be triggered automatically.
Configure multiple environment credentials access with VCAP_SERVICES
Bluemix services require a user to use credentials assigned to him/her by the Bluemix. The hard coded version is needed to run your application locally. But the hard coded version is not a good idea if the app is to be hosted in different places including GitHub. The Bluemix offers you to set up the configuration to use environmental variables they host. VCAP_SERVICES help us to leverage this functionality to manage Bluemix services credentials on the appication side.
It can be done on the server side in the file corresponding to the environmental configuration parameters.
Please follow the example of configuring the document_conversion services:
The next step would be simply to require the service and the configuration in your Node file and pull data for the service you need:
This will allow you to configure multiple Bluemix services in the centralized manner and to access the credentials easily from any Node file.
Last updated