Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Tuesday, March 12, 2013

Bash script self-updates from github

Recently the systems engineering team @ Cloud9ers ($dayjob) has been busy building the infrastructure for a very ambitious and large scale project for one of our customers. The project involves tons of distributed programming besides lots of systems work as well. I'd like to share with the community a small tidbit of information. It's often some small things the one sometimes gives a moment to admire, and hereby share!

The problem

  • We are building a private cloud. Ubuntu server instances running on that are cloned from a master template
  • While most clouds provide what I call "Instance Identity" information through some pre-known web service URI, in our case we utilize VMware's "Invoke-VMScript" API to run scripts inside the cloned template, thus customizing it and giving it its identity, then puppet takes it from there. Note that we're using a simple vCenter+ESXi (no vCloud stuff here) no shared storage even!

Ok the real problem

  • Editing the template, and publishing it across the cloud (a topic for another post) takes considerable time! I wanted a way to be able to quickly update my identity scripts without having to re-build and re-publish images

Solution

  • A script with a trivially simple (thus mostly fixed) "bootstrap" section, which auto-updates itself from github and relaunches its-new-self!

Code

Nothing ground breaking, but still a cool trick eh! Yeah I could have added a broken this into multiple scripts and maybe run-parts them. Of-course this script is quite basic, but it's meant to remain that way since the heavy lifting is puppet's responsibility!
Note: To run this successfully the user this is run under, should have passwordless sudo rights to run "ip" and to run "itself" :) Got cool ideas, thoughts or comments? Leave me a message

Friday, September 23, 2011

Oneiric server, Deploy Server fleets p2

Welcome to the second installment of this article series. In the first part of this article we installed an Ubuntu server instance, made sure it became an orchestra installation server. If this is new to you, Orchestra is a new Oneiric server feature that enables admins to very easily deploy fleets of Ubuntu servers. Let's pick up where the first article stopped

First, let's check where we are. You see installing the orchestra server, it automatically downloads and imports various Ubuntu server ISOs and creates all the needed structure (distros, profiles ...etc) in the underlying cobbler system. Let's see what have we

$ sudo cobbler list
distros:
   hardy-i386
   hardy-x86_64  
   lucid-i386
   lucid-x86_64  
   maverick-i386 
   maverick-x86_64
   natty-i386
   natty-x86_64  
   oneiric-i386  
   oneiric-x86_64

profiles:
   hardy-i386
   hardy-i386-juju
   hardy-x86_64
   hardy-x86_64-juju
   lucid-i386
   lucid-i386-juju
   lucid-x86_64
   lucid-x86_64-juju
   maverick-i386
   maverick-i386-juju
   maverick-x86_64
   maverick-x86_64-juju
   natty-i386
   natty-i386-juju
   natty-x86_64
   natty-x86_64-juju
   oneiric-i386
   oneiric-i386-juju
   oneiric-x86_64
   oneiric-x86_64-juju

systems:

repos:
   hardy-i386
   hardy-i386-security
   hardy-x86_64
   hardy-x86_64-security
   lucid-i386
   lucid-i386-security
   lucid-x86_64
   lucid-x86_64-security
   maverick-i386
   maverick-i386-security
   maverick-x86_64
   maverick-x86_64-security
   natty-i386
   natty-i386-security
   natty-x86_64
   natty-x86_64-security
   oneiric-i386
   oneiric-i386-security
   oneiric-x86_64
   oneiric-x86_64-security

images:

mgmtclasses:
   orchestra-juju-acquired
   orchestra-juju-available
woah! that sure makes my life easier. If you're interested to see where the isos were downloaded (like I was) here you are
ls /var/lib/cobbler/isos/
hardy-i386-mini.iso    lucid-i386-mini.iso    maverick-i386-mini.iso    natty-i386-mini.iso    oneiric-i386-mini.iso
hardy-x86_64-mini.iso  lucid-x86_64-mini.iso  maverick-x86_64-mini.iso  natty-x86_64-mini.iso  oneiric-x86_64-mini.iso

Let's create a new virtual box VM, to serve as our new "server" that needs to be installed. Here's how it looks for me
12-oneiric01-vboxsettings

One thing is worth noting however, it's that the NIC is placed on the "intnet" network, which has the IP range 192.168.77.0/24 that we configured in the first part of this article
13-vbox-natty01-netsettings

now the only "real" thing you have to do, is to add a profile on the orchestra server for your new bare server. The profile binds its mac address, to a name and an installation profile (think OS to install, kickstart ..etc)

sudo cobbler system add --name="oneiric01.ubuntu.lan" --mac-address="08:00:27:B7:76:2A" --ip-address="192.168.77.33" --dns-name="oneiric01.ubuntu.lan" --hostname="oneiric01.ubuntu.lan" --profile="oneiric-x86_64-juju" --mgmt-classes="orchestra-juju-available" --kopts=" DEBCONF_DEBUG=developer netcfg/dhcp_timeout=120 netcfg/choose_interface=eth0"
Boot the server, choose PXE (For vbox that's F12 then "l" that's an L)

14-natty-PXEbooting

Watch the installer fly by (look ma hands free)

15-installer-running

and your box is ready!
16-Oneiric01-ready

That's how easy it is to install a fresh server off your orchestra box! So basically the only thing you need to do per server, is to attach it to a profile and that's it. Boot it and it installs whatever you provisioned for it. Of course any good admin already did that manually before, but it took effort and it wasn't standardized. Now you can count on Ubuntu server covering your back when you're tasked with installing a hundred servers

How cool was that! Got thoughts, comments or rotten tomatoes ? Shoot me a comment

Wednesday, September 21, 2011

Oneiric server, Deploy Server fleets p1

I'm gonna be posting a series of articles on new features and cool technology bits that are landing in Ubuntu Oneiric (11.10) server. Why? I like servers, I like cloud, I like Ubuntu, it all mixes well, what's not to like :)

During this first article, I'll be demoing (in a graphically intensive way :) what it takes (hint: not much!) to deploy a server fleet with Oneiric server. Orchestra is the name of a wonderful piece of technology that lands in Oneiric, that's been created on top of the open-source cobbler project. Orchestra is super easy to install and get started with, and enables you to very rapidly deploy tens or hundreds of physical servers. I'll be using virtualbox to build a small test "lab" on my laptop for purposes of this article. I did actually try KVM first, but faced some trouble getting PXE booting reliably, so I opted for virtualbox which worked flawlessly (kudos vbox guys, you rock!)

Let's get started, I created a VM to represent the very first "head node", that will install the rest of all nodes. Here is a summary of its configuration
1-orchestra
Pop in the virtual CD, boot it, press F6, add "priority=critical locale=en_US url=http://bit.ly/uquick" (Thanks Dustin!) so it looks like
2-orchestra-bootoptions
The uquick profile answers all the installer questions, such that the installation is fully automatic. Since the VM contains two NICs however, we'll need to select a primary one (eth0 in my case)
3-orchestra-whicheth
The installation runs like a champ, fully automated, give it a few minutes till it finishes everything and reboots into the server OS (oh that was easy!)
4-orchestra-login
Now I configure eth1 to have a static IP address of 192.168.77.1/24 (I made any address up), here is a snapshot of /etc/network/interfaces and I started eth1 using ifup
5-orchestra-eth1up
At this stage, I rebooted the server but you definitely don't have to. Let's start actually installing Orchestra

sudo apt-get update
sudo apt-get install ubuntu-orchestra-server -y

Everything proceeds automatically, for any question you get during package installation, I'll provide a picture with the answer :)
6-cobbler-password
7-nextserver
8-enable-dns-dhcp
9-dhcp-range
10-dhcp-gw
11-domain-name

That's it! You've just installed and configured your first Ubuntu Orchestra server, and you're now ready to install a fleet of Ubuntu servers the easy way! In part 2 of this article, I'll go through creating a second server, PXE booting and installing it from the orchestra server. (Extra credit: If you can't wait, try PXE booting a fresh server right now. Note that after installation, orchestra actually downloads and auto-imports a few Ubuntu mini ISOs, thus will need a few minutes depending on your internet connection speed)

So, what do you think of this coolness? Is this easier than the last time you tried building yourself an automated network installer? Shoot me a comment, let me know what you think

Monday, April 18, 2011

Help Squash Natty Server Bugs

Mirroring a post from Ubuntu Server developer Dave Walker, If you're capable and willing to help squash some server bugs, your effort and contribution is really needed now! Join us on irc #ubuntu-server, ask around if you need help. Thanks in advance

Here is a list of current bugs that should hopefully be fixed for Natty release.  The bugs with "Not assigned to anyone :(", could really do  with someone volunteering to take.  Please feel free to assign yourself, if you are willing to take on working towards a fix. 

If you are an assignee, please make sure that the current status (and comments) accurately represent the status before tomorrows server team meeting. 

== Bugs for the server team == 
[655533] [likewise-open] [master] package likewise-open 5.4.0.42111-2ubuntu2 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 (http://pad.lv/655533
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-18 
[726769] [eucalyptus] package eucalyptus-common 2.0.1 bzr1255-0ubuntu1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 (http://pad.lv/726769
 * Bug Status: Confirmed 
 * Assigned to: Dave Walker 
 * Last updated: 2011-04-18 
[661453] [dovecot] dovecot.conf always shows as having been locally modified on update (http://pad.lv/661453
 * Bug Status: Confirmed 
 * Assigned to: Clint Byrum 
 * Last updated: 2011-04-18 
[745946] [cloud-init] cloud-final job did not run in ec2-automated-tests (http://pad.lv/745946
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-18 
[759943] [mod-wsgi] mod_wsgi.so-3.2 gives errors (http://pad.lv/759943
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 
[764391] [cobbler] cobbler fails to manage bind9  (http://pad.lv/764391
 * Bug Status: Confirmed 
 * Assigned to: James Page 
 * Last updated: 2011-04-18 
[745930] [cloud-init] cloud-init timeout waiting for metadata service on EC2 (http://pad.lv/745930
 * Bug Status: New 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 
[760288] [Ubuntu] JeOS is oversized (http://pad.lv/760288
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 

 == Bugs being worked on in other areas, more for information == 
[728088] [debian-installer] iscsi root with or without auth fails to boot (http://pad.lv/728088
 * Bug Status: Confirmed 
 * Assigned to: Colin Watson 
 * Last updated: 2011-04-14 
[747090] [linux] wrong return address sometimes pushed for INT in kvm (not qemu) (http://pad.lv/747090
 * Bug Status: Fix Committed 
 * Assigned to: Andy Whitcroft 
 * Last updated: 2011-04-18 
[566818] [plymouth] Cryptsetup passphrase prompt during boot: every character typed repeats the prompt (http://pad.lv/566818
 * Bug Status: Confirmed 
 * Assigned to: Surbhi Palande 
 * Last updated: 2011-04-16 
[580319] [upstart] dhcp3-server launches before upstart brings all interface, thus failing to start (http://pad.lv/580319
 * Bug Status: Triaged 
 * Assigned to: James Hunt 
 * Last updated: 2011-04-18 
[759545] [grub2] user prompted to update unmodified grub configuration during Ubuntu server upgrade (http://pad.lv/759545
 * Bug Status: New 
 * Last updated: 2011-04-18 

Friday, February 18, 2011

Volunteer QA to Ubuntu Server

A great way to help contribute to Ubuntu and ensure Ubuntu Server remains the rock solid platform that it is, is by committing to helping perform specific QA tests in predefined scenarios. If you're interested, the following test cases specifically need someone to step up and commit to them
These tests are being marked as NOT required for ISO release exit criteria for Ubuntu Server. Quoting Robbie Williamson "Our decision was based on the lack of consistently available resources to verify these configurations. With that said, we are keeping them optional"

Robbie adds "Anyone wishing to reverse this decision, please contact me directly.  I have no problem adding them back along with your agreement to run them for each ISO release"

Again that's a great way to contribute to Ubuntu. If interested please contact Robbie directly, or contact me (leave a comment right here) and I will help get you on track

Monday, January 17, 2011

Help Ubuntu Server, Voice your Opinion

Hello Ubuntu Cloud and Server communities. Now is your chance to voice your opinion about Ubuntu server, as well as help make it better! The Ubuntu marketing team would like more insight into why your organization has chosen to deploy Ubuntu on the server/cloud sides (or why they did not) as well as your opinion as to how Ubuntu server can improve. If you're a pro-IT person deploying or supporting Ubuntu server or cloud in any capacity, please help make Ubuntu better by helping us better understand your needs. Here's a survey designed for just that
Thanks!

Thursday, January 13, 2011

Ubuntu Server news storm

Check out my interview with Dustin Kirkland. Take a sneak peak into Ubuntu Server's future directions. The server team is working on some pretty exciting technologies for the natty release and later. Things touched on

  • Virtualization and LXC improvements
  • Higher quality Java packaging
  • Automated Server ISO testing, ensuring rock solid releases
  • Even more Upstart polish
  • Improving Ubuntu server's Cluster stack
  • Datacenter power efficiency with powernap
  • UEC and EC2 image improvements, pv-grub support
  • Cloud "desktop" images! wow!
  • HUGE project for cloud/data-center automatic deployment, management, monitoring, debugging. IMO this takes Ubuntu server way above anything out there. The technology is all about picking and integrating the best of breed open-source server technologies. While you could always do that work yourself, having a tightly integrated stack that is known to work, is what makes Ubuntu server an easy and fun platform to build upon
Exciting times indeed, check out the full interview at

Video link: http://www.youtube.com/watch?v=CWNjzwci5e8

Friday, December 10, 2010

Help Fix Ubuntu Server Packages FTBFS

With every transition to a new Ubuntu release, certain packages break due to different reasons such as newer versions of components, an updated tool-chain and so on. Since we all love and care about Ubuntu Server, here is a list of Ubuntu server packages that currently FTBFS (Fails to Build from Source)
http://tinyurl.com/server-ftbfs

This means that those packages are not compiling and building the intended binary packages on Natty. This is a great way for you to get involved! If you know how to build packages from source code (the trio ./configure ; make ; make install) and can debug things like missing development packages, missing headers ...etc, then this will be a walk in the park for you :) Everyone's favorite Daniel Holbach is working on a proper guide for fixing these things, however for now you can find lots of useful information at
https://wiki.ubuntu.com/Bugs/HowToFix

In case you need help, the channel #ubuntu-motu on freenode IRC is a good place to ask

Tuesday, November 30, 2010

Ubuntu Server in EC2 Cloud, Easy!

I am starting to create a series of screencasts to demonstrate various topics relating to running Ubuntu on the cloud or as the cloud. The first video demos how easy it is to start your very first Ubuntu server in the Amazon EC2 cloud. If you ever wanted to play with Ubuntu server in the cloud and had any doubts, this video should put them to rest :)



If you think that is cool, and if you want to contribute your own, please grab me.It's real easy to create such screencasts, I can help get you kick-started. And hey you'd be helping the Ubuntu community, and on your way to becoming an online celebrity, what's not to like! If you'd like to follow similar screencasts, subscribe to this youtube channel

Let me know in comments what you would like to see in future screencasts, or whether certain topics interest you. If you are using Ubuntu server in the cloud professionally, I'm very interested to hear back from you. Grab me (kim0) on #ubuntu-cloud on IRC (freenode) for a chat. Awaiting the flood of screencasts :)

Monday, August 9, 2010

Ubuntu Server 10.04.1 virtual release party

Ubuntu Server LTS 10.04.1 is targeting to be released this Thursday on the 12th of August. This point release is especially important for the "server" variant of Ubuntu. This is because many conservative sys-admins wait for the first point release before deploying a server OS. The idea being, any bugs the fine QA people at Canonical might have missed, would be caught by the community during the period between the GA and point releases. This means that for many, this next 12th of August is the "actual" release date for Lucid server LTS! In short, on the 12th Ubuntu Server 10.04.1 is ready to rock the world!

In order to celebrate this awesomeness, we'll be having our own little server release party in the clouds :) What a mouthful, well basically I've put up a nice little web application that tracks all cities around the world that are running Ubuntu Server 10.04. Of course you will need to hit that web app with your server box first so that your city becomes registered and shows up on the map! So if you're already running 10.04 server, be sure to hit that application. If you're not, then you should be! Go grab yourself the 10.04 server iso, install it, then hit the app with it

But wait a minute, you say you don't have a web browser on your server box. No problemo. I'll list a few cool ways (well in a serverish way at least) to hit that web app without leaving your comfortable bash shell! Hey community, if you can think of cooler CLI methods, be sure to put them in your comments. if something is very cool, I'll add it to this post. Here we go


1- elinks --dump http://maps.ubuntu.com/hit/

2- curl http://maps.ubuntu.com/hit/

3- wget http://maps.ubuntu.com/hit/

4- python -c 'import urllib; urllib.urlopen("http://maps.ubuntu.com/hit/").read()'

5- /bin/echo -e 'GET /hit/ HTTP/1.1\nHost: maps.ubuntu.com\n\n' | socat - tcp:maps.ubuntu.com:80


Well I guess that should be enough to wet your appetite. Of course "technically" you don't have to visit the web app using your server box. Hitting it from your Ubuntu desktop has the same effect, but where's the fun in that! If you're running Ubuntu Servers in multiple cities, you are encouraged to hit that app from all cities in which you operate. If you coordinate the hit with some cool stuff (maybe a puppet recipe or bounce over ec2 or something of that sort) let me know about it :)

Whichever CLI way you choose to hit the app with, you'd be missing out on seeing lots of cute little Ubuntu logos over a world-wide Google map. Now that is something you wouldn't wanna miss, so be sure to visit the app from your graphical browser as well to view the list of marked cities running Ubuntu Server. On release day (12th of Aug) it would be very cool to have every major city in the world marked on that map, so please spread the word as much as you can (yes that means retweet it, digg it, slashdot it, tell you mom about it ...etc)