Skip to content

Instantly share code, notes, and snippets.

@odyssey4me
Last active September 21, 2017 14:47
Show Gist options
  • Save odyssey4me/439911c37ee27eace42f8e364c794e70 to your computer and use it in GitHub Desktop.
Save odyssey4me/439911c37ee27eace42f8e364c794e70 to your computer and use it in GitHub Desktop.
Build/customise RAX Public Cloud Images
References:
https://developer.rackspace.com/blog/bootstrap-your-qcow-images-for-the-rackspace-public-cloud/
https://community.rackspace.com/products/f/25/t/7186
https://community.rackspace.com/products/f/25/t/3808
Notes:
The swiftly conf file is ~/.swiftly.conf (not just ~/.swiftly)
IMPORTANT:
I could not get the Ubuntu 16.04 images to boot properly in RAX Public Cloud. Unfortunately it
seems the software provided for the agents does not properly support SystemD, so they don't
start properly. It's easier to build an instance in RAX Public Cloud in the region you want an
image, clean it up, shut it down and save it as an image. This works very well and is a *lot*
simpler.
apt-get update
apt-get purge -y nano
apt-get install -y git vim tmux fail2ban build-essential libffi-dev qemu-utils
curl --silent https://bootstrap.pypa.io/get-pip.py > /opt/get-pip.py
python /opt/get-pip.py pip==9.0.1 setuptools==33.1.1 wheel==0.29.0
pip install six swiftly
# clone the tooling repo
git clone https://github.com/odyssey4me/rpc_rd.git
cd rpc_rd/qcow_image
# compile/install the vhd utils
./compile_vhdutil.sh
# Download the images
DOWNLOAD_BASE_URL="https://cloud-images.ubuntu.com/releases"
wget ${DOWNLOAD_BASE_URL}/14.04/14.04.4/ubuntu-14.04-server-cloudimg-amd64-disk1.img \
-O ubuntu-14.04.4-server-cloudimg-amd64-disk1.img
wget ${DOWNLOAD_BASE_URL}/16.04/release-20170330/ubuntu-16.04-server-cloudimg-amd64-disk1.img \
-O ubuntu-16.04.2-server-cloudimg-amd64-disk1.img
# Edit the images appropriately
./modify_qcow.sh ubuntu-14.04.4-server-cloudimg-amd64-disk1.img
./modify_qcow.sh ubuntu-16.04.2-server-cloudimg-amd64-disk1.img
# Convert the images to XEN VHD format
./qcow_to_vhd.sh ubuntu-14.04.4-server-cloudimg-amd64-disk1.img .
./qcow_to_vhd.sh ubuntu-16.04.2-server-cloudimg-amd64-disk1.img .
# implement your openrc
# prep .swiftly.conf
source openrc
echo "[swiftly]" > .swiftly.conf
echo "auth_user = ${OS_USERNAME}" >> .swiftly.conf
echo "auth_key = ${OS_PASSWORD}" >> .swiftly.conf
echo "auth_url = ${OS_AUTH_URL}" >> .swiftly.conf
echo "region = ${OS_REGION_NAME}" >> .swiftly.conf
# Upload the images to CloudFiles
CLOUDFILES_CONTAINER="rpc-gating-images"
swiftly put ${CLOUDFILES_CONTAINER}
IMAGE_FILENAME="ubuntu-14.04.4-server-cloudimg-amd64-disk1.vhd"
swiftly put -i ${IMAGE_FILENAME} ${CLOUDFILES_CONTAINER}/${IMAGE_FILENAME}
IMAGE_FILENAME="ubuntu-16.04.2-server-cloudimg-amd64-disk1.vhd"
swiftly put -i ${IMAGE_FILENAME} ${CLOUDFILES_CONTAINER}/${IMAGE_FILENAME}
# Import the images into the Image Service
source openrc
IMAGE_FILENAME="ubuntu-14.04.4-server-cloudimg-amd64-disk1.vhd"
IMAGE_DESCRIPTION="Ubuntu 14.04.4 LTS prepared for RPC deployment"
./image-import.sh ${CLOUDFILES_CONTAINER} ${IMAGE_FILENAME} "${IMAGE_DESCRIPTION}"
IMAGE_FILENAME="ubuntu-16.04.2-server-cloudimg-amd64-disk1.vhd"
IMAGE_DESCRIPTION="Ubuntu 16.04.2 LTS prepared for RPC deployment"
./image_import.sh ${CLOUDFILES_CONTAINER} ${IMAGE_FILENAME} "${IMAGE_DESCRIPTION}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment