Skip to content

Commit dcc6a0f

Browse files
author
jdeolive
committed
using ec2-migrate-bundle to move ami to us west
git-svn-id: http://svn.opengeo.org/suite/trunk@2606 fe66add1-021f-4af3-b75b-ea5154e73f91
1 parent 6eb1f8e commit dcc6a0f

6 files changed

+101
-10
lines changed

aws/build_ubuntu_ami.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ if [ -z $SKIP_CREATE_IMAGE ]; then
176176

177177
scp $SSH_OPTS s3cfg-$ACCOUNT ubuntu@$HOST:/tmp/s3cfg
178178
check_rc $? "upload s3cfg-$ACCOUNT"
179-
179+
180+
scp $SSH_OPTS s3cfg-$ACCOUNT.us-west ubuntu@$HOST:/tmp/s3cfg.us-west
181+
check_rc $? "upload s3cfg-$ACCOUNT.us-west"
180182

181183
ssh $SSH_OPTS ubuntu@$HOST "cd /tmp && ./bundle_s3_image.sh $IMAGE_NAME $IMAGE_ARCH -p $PRODUCT_ID $SKIP_PRODUCT_CODE"
182184
check_rc $? "remote bundle image"

aws/bundle_s3_image.sh

+20-9
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ if [ -e /boot/grub/menu.lst ]; then
4646
sudo sed -i 's/root=LABEL=uec-rootfs/root=\/dev\/sda1/g' /boot/grub/menu.lst
4747
fi
4848

49-
for region in "us-east-1" "us-west-1"; do
50-
51-
IMAGE_NAME=$IMAGE_NAME_BASE-$region
5249
IMAGE_MANIFEST=/tmp/image.manifest.xml
53-
rm $IMAGE_MANIFEST
5450

5551
if [ -z $SKIP_BUNDLE ]; then
5652
# bundle the image
57-
sudo ec2-bundle-vol --region $region -c $EC2_CERT -k $EC2_PRIVATE_KEY -u $S3_USER -r $IMAGE_ARCH
53+
sudo ec2-bundle-vol -c $EC2_CERT -k $EC2_PRIVATE_KEY -u $S3_USER -r $IMAGE_ARCH
5854
check_rc $? "ec2-bundle-vol"
5955
fi
6056

@@ -64,7 +60,9 @@ if [ ! -e $IMAGE_MANIFEST ]; then
6460
fi
6561

6662
S3_BUCKET=$S3_BUCKET_ROOT/$IMAGE_NAME
63+
S3_BUCKET_WEST=$S3_BUCKET_ROOT_WEST/$IMAGE_NAME
6764
S3CMD_CONFIG=/tmp/s3cfg
65+
S3CMD_CONFIG_WEST=/tmp/s3cfg.us-west
6866

6967
s3cmd -c $S3CMD_CONFIG ls s3://$S3_BUCKET_ROOT
7068
check_rc $? "listing contents of $S3_BUCKET_ROOT"
@@ -74,16 +72,24 @@ s3cmd -c $S3CMD_CONFIG ls s3://$S3_BUCKET_ROOT | grep $IMAGE_NAME
7472
if [ $? -eq 0 ]; then
7573
s3cmd -c $S3CMD_CONFIG -r del s3://$S3_BUCKET
7674
fi
75+
s3cmd -c $S3CMD_CONFIG_WEST ls s3://$S3_BUCKET_ROOT_WEST | grep $IMAGE_NAME
76+
if [ $? -eq 0 ]; then
77+
s3cmd -c $S3CMD_CONFIG_WEST -r del s3://$S3_BUCKET_WEST
78+
fi
7779

7880
if [ -z $SKIP_UPLOAD ]; then
7981
# upload the bundle
8082
ec2-upload-bundle --retry -b $S3_BUCKET -m $IMAGE_MANIFEST -a $S3_ACCESS_KEY -s $S3_SECRET_KEY
8183
check_rc $? "ec2-upload-bundle"
84+
85+
ec2-migrate-bundle --retry -a $S3_ACCESS_KEY -s $S3_SECRET_KEY -b $S3_BUCKET -m `basename $IMAGE_MANIFEST` -d $S3_BUCKET_WEST --location us-west-1
86+
check_rc $? "ec2-migrate-bundle $S3_BUCKET to us-west-1"
8287
fi
8388

84-
if [ -z $SKIP_REGISTER ]; then
85-
# register the ami
86-
IMAGE_ID=$( ec2-register --region $region $S3_BUCKET/image.manifest.xml -n $IMAGE_NAME -a $IMAGE_ARCH | cut -f 2 )
89+
# register_ami <S3_BUCKET> <LOCATION>
90+
function register_ami() {
91+
#IMAGE_ID=$( ec2-register $S3_BUCKET/image.manifest.xml -n $IMAGE_NAME -a $IMAGE_ARCH | cut -f 2 )
92+
IMAGE_ID=$( ec2-register --region $2 $1/image.manifest.xml -n $IMAGE_NAME -a $IMAGE_ARCH | cut -f 2 )
8793
check_rc $? "ec2-register"
8894

8995
if [ ! -z $PRODUCT_ID ] && [ -z $SKIP_PRODUCT_CODE ]; then
@@ -100,5 +106,10 @@ if [ -z $SKIP_REGISTER ]; then
100106
#ec2-create-tags $IMAGE_ID --tag geoserver --tag postgis --tag opengeo --tag openlayers --tag gis --tag geospatial --tag "opengeo suite"
101107
#check_rc $? "create image tags for $IMAGE_ID"
102108
fi
109+
}
110+
111+
if [ -z $SKIP_REGISTER ]; then
112+
# register the ami
113+
register_ami $S3_BUCKET us-east-1
114+
register_ami $S3_BUCKET_WEST us-west-1
103115
fi
104-
done

aws/s3-dev.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
S3_USER=372029072695
22
S3_BUCKET_ROOT=s3.dev.suite.opengeo.org
3+
S3_BUCKET_ROOT_WEST=s3.us-west.dev.suite.opengeo.org
34
S3_ACCESS_KEY=AKIAIEIFXZRDU4AY5B3Q
45
S3_SECRET_KEY=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

aws/s3-prod.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
S3_USER=431117387956
22
S3_BUCKET_ROOT=s3.prod.suite.opengeo.org
3+
S3_BUCKET_ROOT_WEST=s3.us-west.prod.suite.opengeo.org
34
S3_ACCESS_KEY=AKIAI7SFU3MT3R5WKHSA
45
S3_SECRET_KEY=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

aws/s3cfg-dev.us-west

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[default]
2+
access_key = AKIAIEIFXZRDU4AY5B3Q
3+
bucket_location = us-west-1
4+
cloudfront_host = cloudfront.amazonaws.com
5+
cloudfront_resource = /2010-07-15/distribution
6+
default_mime_type = binary/octet-stream
7+
delete_removed = False
8+
dry_run = False
9+
encoding = UTF-8
10+
encrypt = False
11+
follow_symlinks = False
12+
force = False
13+
get_continue = False
14+
gpg_command = None
15+
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
16+
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
17+
gpg_passphrase =
18+
guess_mime_type = True
19+
host_base = s3.amazonaws.com
20+
host_bucket = %(bucket)s.s3.amazonaws.com
21+
human_readable_sizes = False
22+
list_md5 = False
23+
log_target_prefix =
24+
preserve_attrs = True
25+
progress_meter = True
26+
proxy_host =
27+
proxy_port = 0
28+
recursive = False
29+
recv_chunk = 4096
30+
reduced_redundancy = False
31+
secret_key = LbEM4l6xxqHiJUY6Kb6eHyvl3Ryn3ItefAz02mnd
32+
send_chunk = 4096
33+
simpledb_host = sdb.amazonaws.com
34+
skip_existing = False
35+
socket_timeout = 10
36+
urlencoding_mode = normal
37+
use_https = False
38+
verbosity = WARNING

aws/s3cfg-prod.us-west

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[default]
2+
access_key = AKIAI7SFU3MT3R5WKHSA
3+
bucket_location = us-west-1
4+
cloudfront_host = cloudfront.amazonaws.com
5+
cloudfront_resource = /2010-07-15/distribution
6+
default_mime_type = binary/octet-stream
7+
delete_removed = False
8+
dry_run = False
9+
encoding = UTF-8
10+
encrypt = False
11+
follow_symlinks = False
12+
force = False
13+
get_continue = False
14+
gpg_command = None
15+
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
16+
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
17+
gpg_passphrase =
18+
guess_mime_type = True
19+
host_base = s3.amazonaws.com
20+
host_bucket = %(bucket)s.s3.amazonaws.com
21+
human_readable_sizes = False
22+
list_md5 = False
23+
log_target_prefix =
24+
preserve_attrs = True
25+
progress_meter = True
26+
proxy_host =
27+
proxy_port = 0
28+
recursive = False
29+
recv_chunk = 4096
30+
reduced_redundancy = False
31+
secret_key = aKbeL+akiq069+k8FFScdKXTogTwb8ZnXjD4yObq
32+
send_chunk = 4096
33+
simpledb_host = sdb.amazonaws.com
34+
skip_existing = False
35+
socket_timeout = 10
36+
urlencoding_mode = normal
37+
use_https = False
38+
verbosity = WARNING

0 commit comments

Comments
 (0)