Show me the code! – By Davanum Srinivas

June 29, 2014

CFv2 Deployment on latest DevStack using MicroBOSH

Filed under: Uncategorized — Davanum Srinivas @ 9:32 pm

As promised, here’s a follow up to the 2 previous posts:

Let’s now deploy a full CFv2 instance using microbosh, instructions are from here:
Install Cloud Foundry on OpenStack

Here’s the edited flavor(s) that i used:
bosh-cfv2-flavors

Here’s the micro_bosh.yml for completeness:

Here’s the cf-173-openstack.yml originally from @ferdy with minor tweaks:

Things to tweak:
In my cf-173-openstack.yml, i had set static_ip to 172.24.4.10. So once the MicroBOSH finished deploying CFv2, i had to find the correct vm for the router and set its floating ip to 172.24.4.10. You can do this by running “bosh vms”, look for the ip address for “router/0″, then find the correct vm in horizon or using nova list and then set it’s ip address. You need to do this before you try to use the cf command line API. Be sure to download the latest and greatest CLI from https://github.com/cloudfoundry/cli#downloads.

Flaky Stuff:
postgres vm ran into trouble multiple times, i figured out how to stop/start the shell script by hand but since other vms like cloud_controller, clock_global, cloud_controller_worker had issues it was better to whack a big hammer and run “bosh delete deployment cf” and re-instantiate the vms. (yes, i tried combinations of bosh start/recreate/restart commands as well)

Hints:
bosh-lite’s README.md is very helpful about how to build the cf release. Andy’s blogpost helped quite a bit to peel the onion for debugging as did Dr Nic’s posts. Thanks Folks!

June 24, 2014

Deploying BOSH with Micro BOSH on latest DevStack

Filed under: Uncategorized — Davanum Srinivas @ 1:33 pm

Follow up to Running Cloud Foundry’s Micro BOSH On Latest DevStack, I had to bump the VOLUME_BACKING_FILE_SIZE to 200GB in devstack as 100GB was not enough. Instructions from http://docs.cloudfoundry.org/deploying/openstack/deploying_bosh.html were handy as usual. Here’s my bosh-openstack.yml

---
name: bosh-openstack
director_uuid: 80a0b9cc-a7e4-4134-81ee-a186e8bebff8

release:
  name: bosh
  version: latest

compilation:
  workers: 3
  network: default
  reuse_compilation_vms: true
  cloud_properties:
    instance_type: m1.small

update:
  canaries: 1
  canary_watch_time: 3000-120000
  update_watch_time: 3000-120000
  max_in_flight: 4

networks:
  - name: floating
    type: vip
    cloud_properties: {}
  - name: default
    type: dynamic
    cloud_properties: {}

resource_pools:
  - name: common
    network: default
    size: 8
    stemcell:
      name: bosh-openstack-kvm-ubuntu
      version: latest
    cloud_properties:
      instance_type: m1.small

jobs:
  - name: nats
    template: nats
    instances: 1
    resource_pool: common
    networks:
      - name: default
        default: [dns, gateway]

  - name: redis
    template: redis
    instances: 1
    resource_pool: common
    networks:
      - name: default
        default: [dns, gateway]

  - name: postgres
    template: postgres
    instances: 1
    resource_pool: common
    persistent_disk: 16384
    networks:
      - name: default
        default: [dns, gateway]

  - name: powerdns
    template: powerdns
    instances: 1
    resource_pool: common
    networks:
      - name: default
        default: [dns, gateway]
      - name: floating
        static_ips:
          - 172.24.4.2

  - name: blobstore
    template: blobstore
    instances: 1
    resource_pool: common
    persistent_disk: 51200
    networks:
      - name: default
        default: [dns, gateway]

  - name: director
    template: director
    instances: 1
    resource_pool: common
    persistent_disk: 16384
    networks:
      - name: default
        default: [dns, gateway]
      - name: floating
        static_ips:
          - 172.24.4.3

  - name: registry
    template: registry
    instances: 1
    resource_pool: common
    networks:
      - name: default
        default: [dns, gateway]

  - name: health_monitor
    template: health_monitor
    instances: 1
    resource_pool: common
    networks:
      - name: default
        default: [dns, gateway]

properties:
  nats:
    address: 0.nats.default.bosh-openstack.microbosh
    user: nats
    password: nats

  redis:
    address: 0.redis.default.bosh-openstack.microbosh
    password: redis

  postgres: &bosh_db
    host: 0.postgres.default.bosh-openstack.microbosh
    user: postgres
    password: postgres
    database: bosh

  dns:
    address: 172.24.4.2
    db: *bosh_db
    recursor: 172.24.4.1

  blobstore:
    address: 0.blobstore.default.bosh-openstack.microbosh
    agent:
      user: agent
      password: agent
    director:
      user: director
      password: director

  director:
    name: bosh
    address: 0.director.default.bosh-openstack.microbosh
    db: *bosh_db

  registry:
    address: 0.registry.default.bosh-openstack.microbosh
    db: *bosh_db
    http:
      user: registry
      password: registry

  hm:
    http:
      user: hm
      password: hm
    director_account:
      user: admin
      password: admin
    resurrector_enabled: true

  ntp:
    - 0.north-america.pool.ntp.org
    - 1.north-america.pool.ntp.org

  openstack:
    auth_url: http://173.193.231.50:5000/v2.0
    username: admin
    api_key: passw0rd
    tenant: admin
    region:
    default_security_groups: ["default", "ssh", "bosh"]
    default_key_name: microbosh

October 17, 2012

Scripts to start/stop OpenStack environment built using DevStack

Filed under: Uncategorized — Davanum Srinivas @ 4:14 pm

Work in progress…Once i bootstrapped an OpenStack install using DevStack i wanted keep/use the environment that was just built. I could not find scripts to start/stop all the services, here’s my effort. If someone has a better way, please let me know!.

#!/bin/bash

rm -rf /var/log/nova/*.log

service mysql start
service rabbitmq-server start

cd /opt/stack/glance/bin
/opt/stack/glance/bin/glance-registry --config-file=/etc/glance/glance-registry.conf > /var/log/nova/glance-registry.log 2>&1 &

cd /opt/stack/glance/bin
/opt/stack/glance/bin/glance-api --config-file=/etc/glance/glance-api.conf > /var/log/nova/glance-api.log 2>&1 &
echo "Waiting for g-api to start..."
if ! timeout 60 sh -c "while ! wget --no-proxy -q -O- http://127.0.0.1:9292;
do sleep 1; done"; then
        echo "g-api did not start"
        exit 1
fi
echo "Done."

cd /opt/stack/keystone/bin
/opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/keystone/logging.conf -d --debug > /var/log/nova/keystone-all.log 2>&1 &
echo "Waiting for keystone to start..."
if ! timeout 60 sh -c "while ! wget --no-proxy -q -O- http://127.0.0.1:5000;
do sleep 1; done"; then
        echo "keystone did not start"
        exit 1
fi
echo "Done."

cd /opt/stack/cinder/bin/
/opt/stack/cinder/bin/cinder-api --config-file /etc/cinder/cinder.conf > /var/log/nova/cinder-api.log 2>&1 &

cd /opt/stack/cinder/bin/
/opt/stack/cinder/bin/cinder-volume --config-file /etc/cinder/cinder.conf > /var/log/nova/cinder-volume.log 2>&1 &

cd /opt/stack/cinder/bin/
/opt/stack/cinder/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf > /var/log/nova/cinder-scheduler.log 2>&1 &

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-api > /var/log/nova/nova-api.log 2>&1 &
echo "Waiting for nova-api to start..."
if ! timeout 60 sh -c "while ! wget --no-proxy -q -O- http://127.0.0.1:8774;
do sleep 1; done"; then
        echo "nova-api did not start"
        exit 1
fi
echo "Done."

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-scheduler > /var/log/nova/nova-scheduler.log 2>&1 &

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-cert > /var/log/nova/nova-cert.log 2>&1 &

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-objectstore > /var/log/nova/nova-objectstore.log 2>&1 &

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-network > /var/log/nova/nova-network.log 2>&1 &

cd /opt/stack/nova/bin 
/opt/stack/nova/bin/nova-compute > /var/log/nova/nova-compute.log 2>&1 &

cd /opt/stack/noVNC
/opt/stack/noVNC/utils/nova-novncproxy --config-file /etc/nova/nova.conf  --web . > /var/log/nova/nova-novncproxy.log 2>&1 &

cd /opt/stack/nova/bin/
/opt/stack/nova/bin/nova-xvpvncproxy --config-file /etc/nova/nova.conf > /var/log/nova/nova-xvpvncproxy.log 2>&1 &

cd /opt/stack/nova/bin/
/opt/stack/nova/bin/nova-consoleauth > /var/log/nova/nova-consoleauth.log 2>&1 &

service apache2 start
#!/bin/bash

kill -9 `ps aux | grep -v grep | grep /opt/stack | awk '{print $2}'`

service apache2 stop
service rabbitmq-server stop
service mysql stop

May 3, 2012

Developers Kit for Pure Application System

Filed under: Uncategorized — Davanum Srinivas @ 11:54 am

The deployment engine / kit for Pure Application System is available to try as a vmdk – http://ibm.co/puredevkit  There is also a developerworks guide with a 5 part series that dives deep as well. See http://ibm.co/puredevlinks to get started.

January 4, 2012

Follow a user in Lotus Connections 3.0

Filed under: Uncategorized — Tags: , — Davanum Srinivas @ 3:35 pm

One main feature in Lotus Connections 3.0 is the asymmetric follow of someone (like twitter). The API documentation is here. Since sample code is always better here’s a HTTP GET python snippet to lookup the userid, given an email and then a quick HTTP POST to follow that user.

#!/usr/bin/python
import sys,urllib,urllib2,traceback,base64
from xml.dom import minidom

xml_data_header = """
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
   <category term="resource-follow" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
   <category term="profiles" scheme="http://www.ibm.com/xmlns/prod/sn/source"></category>
   <category term="profile" scheme="http://www.ibm.com/xmlns/prod/sn/resource-type"></category>
   <category term="
""".strip()
xml_data_footer = """
" scheme="http://www.ibm.com/xmlns/prod/sn/resource-id"></category>
</entry>
""".strip()

if len(sys.argv) != 4: 
        print 'Usage: follow <userid> <password> <email-of-user-to-follow>' 
        sys.exit(1)

base64string = base64.encodestring('%s:%s' % (sys.argv[1], sys.argv[2]))[:-1]

def getUuidForUser(email):
	uri = "https://w3-connections.ibm.com/profiles/atom/profile.do?format=lite&email=%s" % email
	req = urllib2.Request(uri)
	req.add_header('Content-type','application/atom+xml')
	req.add_header('Authorization', "Basic %s" % base64string)
	dom = minidom.parse(urllib2.urlopen(req))
	element = dom.getElementsByTagNameNS('http://www.ibm.com/xmlns/prod/sn', 'userid')[0]
	return element.firstChild.data

def followUser(uuid):
	uri = 'https://w3-connections.ibm.com/profiles/follow/atom/resources'
	query_string_values = {'source': 'profiles', 'type'  : 'profile'}
	payload = '%s%s%s' % (xml_data_header, uuid, xml_data_footer)

	try :
		if query_string_values:
		    uri = ''.join([uri, '?', urllib.urlencode(query_string_values)])
		req = urllib2.Request(uri, data=payload)
		req.add_header('Content-type','application/atom+xml')
		req.add_header('Authorization', "Basic %s" % base64string)
		response = urllib2.urlopen(req)
		return response.read()
	except urllib2.HTTPError, error:
		return error.read()

print followUser(getUuidForUser(sys.argv[3]))

October 8, 2011

Quick Start for WebSphere Liberty Profile – Deploying a WAR

Filed under: Uncategorized — Davanum Srinivas @ 12:58 pm

Download the WebSphere Application Server V8.5 Alpha Liberty Profile from:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download?lang=en

Create a new web app using maven:
http://maven.apache.org/guides/mini/guide-webapp.html

Unzip the server:

dims@dims-desktop:~$ unzip -q Downloads/was4d-20110927-1211.zip

Let’s use the default server for deploying our war

dims@dims-desktop:~$ cd was4d/usr/servers/defaultServer/

See which features are enabled

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cat server.xml
<server description="new server">

<!-- Enable features -->
<!--
<featureManager>
<feature>servlet-3.0</feature>
</featureManager>
-->

</server>

Add support for servlet and jsp’s

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ vi server.xml
dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cat server.xml
<server description="new server">

<!-- Enable features -->
<featureManager>
<feature>servlet-3.0</feature>
<feature>jsp-2.2</feature>
</featureManager>

</server>

Create a directory for dropping in our WAR

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ mkdir dropins
dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cd dropins/
dims@dims-desktop:~/was4d/usr/servers/defaultServer/dropins$ cp ~/my-webapp.war .
dims@dims-desktop:~/was4d/usr/servers/defaultServer/dropins$ cd ../../../..

Start the server

dims@dims-desktop:~/was4d$ date
Sat Oct 8 13:50:50 EDT 2011
dims@dims-desktop:~/was4d$ bin/was4d start
Starting defaultServer ...
OK.

Let’s see how long it took…just a few seconds.

dims@dims-desktop:~/was4d$ date
Sat Oct 8 13:50:56 EDT 2011

That’s it, point your browser to http://localhost:9080/my-webapp/

More information can be found at:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/announcing_the_was_v8_5_alpha1?lang=en

September 20, 2011

IBM SDK Java(TM) Technology Edition Version 7.0 is now available IBM DeveloperWorks

Filed under: Uncategorized — Davanum Srinivas @ 7:07 am

New Java features include:

  • NIO2 asynchronous I/O, JSR 203
  • New java.util.concurrent features including the fork/join framework
  • Better support for dynamic languages with the implementation of Invoke Dynamic, JSR 292
  • Small language changes (Project Coin)

IBM is introducing:

  • Balanced GC policy targeting short and consistent pause times on large heaps
  • More detailed and efficient format for verbose GC
  • Significant diagnostic improvements, including enhancements to javacore.txt contents
  • Shared classes cache supports additional content, better diagnostics, a programmable interface and improved control over file permissions and displaying cache contents
  • Real-time, incremental GC policy included for evaluation
  • Significant improvements in throughput, footprint and startup performance
  • Exploitation of Power7 and z196 hardware
  • Closer alignment with OpenJDK

IBM DeveloperWorks: https://www.ibm.com/developerworks/java/jdk/

September 19, 2011

Apache Axis – 10 years

Filed under: Uncategorized — Davanum Srinivas @ 7:19 pm

My very first patch to Apache Axis was 10 years + 1 week ago:

http://markmail.org/message/3c6bppbw23gyhj4v

Apache Axis was started 10 years + 9 months ago:

http://markmail.org/message/3oi5dogfn2xzcvrk

Roller coaster ride through life in general since then. Good friendships and Good times!

September 13, 2011

Compile/Install msn-pecan on ubuntu

Filed under: Uncategorized — Davanum Srinivas @ 11:30 am

msn-pecan is an alternative to the MSN plugin in pidgin. But the versions in the ubuntu repos are old. Here’s a quick 5 steps to compile/install msn-pecan on ubuntu.

  • sudo apt-get install libpurple-dev git-core
  • git clone git://github.com/felipec/msn-pecan.git
  • cd msn-pecan
  • make
  • sudo make install

August 29, 2011

iPhone and a bit of Rain

Filed under: Uncategorized — Davanum Srinivas @ 5:29 pm

Last week we were at the Animal Kingdom down in florida we ran into a bit of rain. I quickly wore a rain jacket and transferred the iPhone to the more drier pocket of the rain jacket, but the iPhone got a bit wet anyway. The iPhone shut off by itself and i could feel the battery draining. Back at the hotel, after a bit of research, found that thankfully the sensors had not tripped. I popped open the sim card and dried it with a hair dryer for about 5-10 mins and dropped it into a snack bag with rice. Left the iPhone alone for a couple of days with periodic drying with the hair dryer and it’s now working as well as it was. Whew!

Older Posts »

The Shocking Blue Green Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 131 other followers