Monday, April 20, 2015

Configuring a local dev environment for IBM Bluemix

What is IBM Bluemix?


Using this great pizza-as-a-service paradigm, Bluemix is a SASS:
Fig 1: Bluemix is a SAAS


Developers can use existing Bluemix services, including Alchemy API:
Fig 2: Watson services on Bluemix


Developers can also deploy their own services, including containers using Docker technology.

This article will walk through the setup of a local development environment for working with Bluemix. All scripting and configuration is for Debian64-bit (Ubuntu 14.10 at the time of this article).


Python Development Environment


The first step is to create a python development environment.
# install pip 
sudo apt-get \
  install -y \
    build-essential \
    python-dev \
    python-pip

# install python setup-utils
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

pip is a package management system used to install and manage software packages written in Python and Setuptools is a package development process that enhances the Python standard library distribution utilities.


Installing Docker


Instructions for installing docker on Ubuntu are referenced below and the script is replicated here:
# add the Docker repository key to your local keychain: 
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

# add the Docker repository to your apt sources list: 
sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"

# prior to using any Ubuntu-maintained package installation, ensure existing packages are up to date: 
sudo apt-get update

# install the Docker-LXC package: 
sudo apt-get install -y lxc-docker

# install docker compose:
wget https://github.com/docker/compose/releases/download/1.1.0/docker-compose-$(uname -s)-$(uname -m)
mv docker-compose-$(uname -s)-$(uname -m) docker-compose
sudo chmod 777 docker-compose
sudo mv docker-compose /usr/local/bin/
docker-compose --version

Docker is a container-based software framework for automating deployment of applications. “Containers” are encapsulated, lightweight, and portable application modules.


IBM Extensions


Before you can create a container in Bluemix, you must install the IBM Containers Extension (ICE):
sudo apt-get \
  install -y \
    curl

# install ice
export ICE=icecli-2.0.zip
curl -O https://static-ice.ng.bluemix.net/$ICE
sudo pip install icecli-2.0.zip
rm $FILE
ice version



Cloud Foundry


Finally, we need to install the Cloud Foundry command line interface:
# install CF
export FILE=cf-cli_amd64.deb
wget -O $FILE https://cli.run.pivotal.io/stable?release=debian64&version=6.11.0&source=github-rel
sudo dpkg -i $FILE
sudo apt-get install -f -y
rm $FILE
cf --version



Miscellaneous Commands


We need to endsure that the necessary environment variables are set, user authorizations are in place and configuration files are correct.
# set docker env var
sudo sh -c 'echo "export DOCKER_TLS_VERIFY=1" >> /etc/environment'

# modify user authorization
sudo usermod -a -G docker $(whoami)

By default, the ice commands must be run with root authentication and therefore, require the prefix sudo. This last command will allow us to run docker and ice commands without sudo.



References

  1. [Blogger] Configuring a Python Development Environment
  2. [Blogger] Installing Docker on Ubuntu
  3. [GitHub] Individual Installation Scripts

1 comment:

  1. Very impressive article! The blog is highly informative and has answered all my questions.
    To introduce about our company andthe activities, B2B contact list is a database provider
    that helps you to boost your sales& grow your business through well-build
    IBM Bluemix Users Email list.

    ReplyDelete