Skip to content

Commit cf4f174

Browse files
mboersmaGabriel Monroy
authored andcommitted
Updated Rackspace scripts for containerize support.
1 parent 08fd115 commit cf4f174

10 files changed

Lines changed: 82 additions & 20 deletions

contrib/digitalocean/prepare-controller-image.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash -ex
22

33
#
4-
# Prepare a Deis-optimized Controller image from a vanilla Ubuntu 12.04 droplet
4+
# Prepare a Deis Controller image for DigitalOcean.
55
#
66
# Instructions:
77
#
88
# 1. Launch a vanilla Ubuntu 12.04.3 droplet (64-bit)
99
# 2. Run this script (as root!) to optimize the image for faster provisioning
10-
# 3. Create a new snapshot named "deis-controller-base" from this droplet
10+
# 3. Create a new image named "deis-controller-image" from this droplet
1111
#
1212

1313
# Remove old kernel(s)
@@ -22,7 +22,7 @@ echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/dock
2222

2323
# upgrade to latest packages
2424
apt-get update
25-
apt-get dist-upgrade -yq
25+
apt-get upgrade -yq
2626

2727
# install required packages
2828
apt-get install lxc-docker-0.7.6 fail2ban curl git inotify-tools make python-setuptools python-pip -yq

contrib/digitalocean/prepare-node-image.sh

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash -ex
22

33
#
4-
# Prepare a Deis-optimized Node image from a vanilla Ubuntu 12.04 droplet
4+
# Prepare a Deis Node image for DigitalOcean.
55
#
66
# Instructions:
77
#
88
# 1. Launch a vanilla Ubuntu 12.04.3 droplet (64-bit)
99
# 2. Run this script (as root!) to optimize the image for faster provisioning
10-
# 3. Create a new snapshot named "deis-node-base" from this droplet
10+
# 3. Create a new snapshot named "deis-node-image" from this droplet
1111
#
1212

1313
# Remove old kernel(s)
@@ -22,7 +22,7 @@ echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/dock
2222

2323
# upgrade to latest packages
2424
apt-get update
25-
apt-get dist-upgrade -yq
25+
apt-get upgrade -yq
2626

2727
# install required packages
2828
apt-get install lxc-docker-0.7.6 fail2ban curl git inotify-tools make python-setuptools python-pip -yq

contrib/digitalocean/provision-digitalocean-controller.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ fi
5656

5757
# the name of the location we want to work with
5858
region_id=$1
59-
# The image that we want to use (deis-controller-base)
60-
image_id=$(knife digital_ocean image list | grep "deis-controller-base" | awk '{print $1}')
59+
# The image that we want to use (deis-controller-image)
60+
image_id=$(knife digital_ocean image list | grep "deis-controller-image" | awk '{print $1}')
6161
# the ID of the size (2GB)
6262
size_id=$(knife digital_ocean size list | grep "2GB" | awk '{print $1}')
6363

6464
if [[ -z $image_id ]]; then
65-
echo "Can't find saved image \"deis-controller-base\" in region $region_id. Please follow the"
65+
echo "Can't find saved image \"deis-controller-image\" in region $region_id. Please follow the"
6666
echo "instructions in prepare-digitalocean-snapshot.sh before provisioning a Deis controller."
6767
exit 1
6868
fi

contrib/ec2/prepare-controller-ami.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -ex
22

33
#
4-
# Prepare a Deis-optimized Controller AMI from a vanilla Ubuntu 12.04
4+
# Prepare a Deis Controller image for Amazon EC2.
55
#
66
# Instructions:
77
#

contrib/ec2/prepare-node-ami.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -ex
22

33
#
4-
# Prepare a Deis-optimized Node AMI from a vanilla Ubuntu 12.04
4+
# Prepare a Deis Node image for Amazon EC2.
55
#
66
# Instructions:
77
#

contrib/rackspace/prepare-rackspace-image.sh renamed to contrib/rackspace/prepare-controller-image.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -ex
22

33
#
4-
# Prepare a Deis-optimized AMI from a vanilla Ubuntu 12.04
4+
# Prepare a Deis Controller image for Rackspace.
55
#
66
# Instructions:
77
#
@@ -11,7 +11,7 @@
1111
# apt-get update && apt-get install -yq linux-image-generic-lts-raring linux-headers-generic-lts-raring && reboot
1212
# 3. After reboot is complete, SSH in and `uname -r` to confirm kernel is 3.8
1313
# 4. Run this script (as root) to optimize the image for fast boot times
14-
# 5. Create a new image from the server named "deis-base-image".
14+
# 5. Create a new image from the server named "deis-node-image".
1515
# 6. Distribute the image to other regions
1616
# 7. Create/update your Deis flavors to use your new images
1717
#
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash -ex
2+
3+
#
4+
# Prepare a Deis Node image for Rackspace.
5+
#
6+
# Instructions:
7+
#
8+
# 1. Launch a vanilla Ubuntu 12.04.3 droplet (64-bit)
9+
# 2. Run this script (as root!) to optimize the image for faster provisioning
10+
# 3. Create a new snapshot named "deis-node-image" from this droplet
11+
#
12+
13+
# Remove old kernel(s)
14+
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
15+
16+
# Add the Docker repository key to your local keychain
17+
# using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
18+
curl https://get.docker.io/gpg | apt-key add -
19+
20+
# Add the Docker repository to your apt sources list.
21+
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
22+
23+
# upgrade to latest packages
24+
apt-get update
25+
apt-get upgrade -yq
26+
27+
# install required packages
28+
apt-get install lxc-docker-0.7.6 fail2ban curl git inotify-tools make python-setuptools python-pip -yq
29+
30+
# wait for docker to start
31+
while [ ! -e /var/run/docker.sock ] ; do
32+
inotifywait -t 2 -e create $(dirname /var/run/docker.sock)
33+
done
34+
35+
# pull docker images
36+
docker pull deis/slugrunner
37+
38+
# install chef 11.x deps
39+
apt-get install -yq ruby1.9.1 ruby1.9.1-dev make
40+
update-alternatives --set ruby /usr/bin/ruby1.9.1
41+
update-alternatives --set gem /usr/bin/gem1.9.1
42+
43+
# clean and remove old packages
44+
apt-get clean
45+
apt-get autoremove -yq
46+
47+
# reset cloud-init
48+
rm -rf /var/lib/cloud
49+
50+
# purge SSH authorized keys
51+
rm -f /home/ubuntu/.ssh/authorized_keys
52+
rm -f /root/.ssh/authorized_keys
53+
54+
# remove /etc/chef so contents can't intefere with
55+
# node being converged (i.e. old keys)
56+
rm -f /etc/chef/*
57+
58+
# purge /var/log
59+
find /var/log -type f | xargs rm
60+
61+
# flush writes to block storage
62+
sync

contrib/rackspace/provision-rackspace-controller.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ if ! [[ "ord dfw iad lon" =~ $region ]]; then
4646
exit 1
4747
fi
4848
flavor='performance1-2'
49-
image=$(knife rackspace image list --rackspace-region $region | grep 'deis-base-image' | awk '{print $1}')
49+
image=$(knife rackspace image list --rackspace-region $region | grep 'deis-node-image' | awk '{print $1}')
5050
if [[ -z $image ]]; then
51-
echo "Can't find saved image \"deis-base-image\" in region $region. Please follow the"
51+
echo "Can't find saved image \"deis-node-image\" in region $region. Please follow the"
5252
echo "instructions in prepare-rackspace-image.sh before provisioning a Deis controller."
5353
echo
5454
exit 1

provider/digitalocean.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def seed_flavors():
2929
'params': json.dumps({
3030
'region': REGION_LIST[r],
3131
'size': '4GB',
32-
'image': 'deis-node-base'
32+
'image': 'deis-node-image'
3333
})
3434
})
3535
return flavors
@@ -89,7 +89,7 @@ def _get_droplet_kwargs(node, conn):
8989
return {
9090
'name': node['id'],
9191
'size_id': _get_id(conn.sizes(), params.get('size', '4GB')),
92-
'image_id': _get_id(conn.images(show_all=False), params.get('image', 'deis-node-base')),
92+
'image_id': _get_id(conn.images(show_all=False), params.get('image', 'deis-node-image')),
9393
'region_id': _get_id(conn.regions(), params.get('region', 'San Francisco 1')),
9494
'ssh_key_ids': [str(_get_id(conn.all_ssh_keys(),
9595
"deis-{formation}-{layer}".format(**node)))],

provider/rackspace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ def build_node(node):
9696
name = "{formation}-{layer}".format(**node)
9797
params['key_name'] = name
9898
tags = {'Name': name}
99-
# look up the saved image / snapshot by name 'deis-base-image', until we
99+
# look up the saved image / snapshot by name 'deis-node-image', until we
100100
# can create a public image at Rackspace--at which point we call list_images().
101101
try:
102-
image = next(i for i in conn.list_snapshots() if i.name == 'deis-base-image')
102+
image = next(i for i in conn.list_snapshots() if i.name == 'deis-node-image')
103103
except StopIteration:
104104
msg = """\
105-
Can't find saved image "deis-base-image" in region {}. Please follow the
105+
Can't find saved image "deis-node-image" in region {}. Please follow the
106106
instructions in prepare-rackspace-image.sh before scaling Deis nodes.
107107
""".format(region)
108108
raise EnvironmentError(msg)

0 commit comments

Comments
 (0)