1
=========================
2
Bazaar Windows EC2 Server
3
=========================
5
We have an Amazon EC2 virtual machine called Desolation_ for
6
building Windows packages and general testing on Windows. As of
7
2009-02-19, this is just experimental and this is a draft specification,
8
but we aim to use it for the production Windows installer build of 1.13 in
13
* `Bazaar Developer Documentation Catalog <index.html>`_.
16
.. _Desolation: http://en.wikipedia.org/wiki/Desolation_Island
22
* The instance is only running (and incurring charges) when it's needed
23
for testing or packaging.
25
* It can be started or stopped by anyone on the team using a
26
straightforward script.
28
* Multiple people can get into the same instance at the same time, e.g.
29
if one person needs to pass work on to some one else.
31
* We keep snapshot of the OS and tool chain so that we can roll back if
34
* bzr branches and similar information are kept on stable storage that
35
survives rollbacks of the OS state, and that can be backed up.
37
Later on we may try automated Windows testing in a similar setup.
43
The working disk and the AMI images are stored in one person's account for
46
Ideally we want to give other people access to run this machine without
47
giving full access to the account. I'm not sure if that's feasible. If
48
it's not, we might need to allow people to launch the image within their
49
own account; this may be problematic if the shared volume is already in
52
I don't think it's possible to have an EBS that's shared across accounts,
53
and they can't be attached to multiple running instances. So for now it's
54
probably best to just ignore the concept and store the working data on the
55
instance's local storage, and to copy things up e.g. to Launchpad as
58
On this machine, ``C:`` should be used only for the Windows system files,
59
``D:`` for installed programs and working directories, and other drive
60
letters can be used later for mounting EBS storage if desired.
62
Through ``ec2-modify-image-attribute`` we can allow nominated users to
63
access an existing image. We need to have their AWS opaque ID.
65
Through ``ec2-bundle-image`` we can make a new snapshot at any point,
66
which will be stored into the current user's S3 account.
68
We'll (probably) have one shared account for running builds which is also
69
an administrator for ease of installing software.
71
You do need to have an RSA keypair to get the initial password for a
72
Windows machine, even though you can't use it to log in later. As a quirk
73
of the tools(?) ``ec2-get-password`` needs the full path to the keypair
74
but ``ec2-add-keypair`` just wants part of the name. I guess this is
75
distinct from the account identifier because the image is relatively
76
untrusted(?). If the password is already set in the image, this shouldn't
79
It would be nice if rdesktop could use private key authentication but
82
Should check how the Launchpad ec2test scripts work.
92
* Be in the bzr core team. If you are interested in helping with
93
Windows packaging, testing or development just ask.
96
`Amazon EC2 API tools`_ (needs-packaging `bug 330930`_)
98
* Create a private key and certificate for yourself.
99
Check these environment variables are set and exported, e.g. by setting
100
them in the file ``~/.aws``. Make sure the files are private.::
102
EC2_PRIVATE_KEY=~/.ec2/pk-XXXXXX.pem
103
EC2_CERT=~/.ec2/cert-XXXXXX.pem
104
EC2_HOME=~/build/ec2-api-tools-1.3-30349
105
AWS_SECRET_ACCESS_KEY=XXXXXXXXX
106
AWS_ACCESS_KEY_ID=XXXXXXXXXXX
107
PATH=$PATH:$EC2_HOME/bin
108
JAVA_HOME=/usr/lib/jvm/java-6-openjdk
110
* Install the rdesktop client, to actually access the machine.
112
* Create an Amazon Web Services account, sign up for S3 and EC2, and do
113
the various steps to create authentication devices
115
* Possibly read some of the `EC2 documentation`_ for background.
117
.. _`bug 330930`: https://bugs.edge.launchpad.net/ubuntu/+bug/330930
118
.. _`Amazon EC2 API tools`:
119
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=368&categoryID=88
120
.. _`EC2 documentation`: http://aws.amazon.com/
122
* Create a security group for your that allows rdesktop access and icmp with::
124
ec2-add-group desolation-group -d 'bzr win32 build machine'
125
ec2-authorize desolation-group -p 3389 -s 1.2.3.4/32
126
ec2-authorize desolation-group -t -1:-1 -P icmp
128
Add your public IP there. You can repeat that command to allow others
132
To start up an instance
133
-----------------------
135
1. Get the right AMI image ID from another developer.
137
1. Start the instance::
139
ec2-run-instances $image_id -g desolation-group
141
This will print out some information including the image id, something
144
1. Actually starting the machine will take a few minutes. Once it's in
145
the *running* state, get the machine's public IP with ::
147
ec2-describe-instances
149
1. and then connect ::
151
rdesktop -g 1200x850 -u Administrator $machine_ip
153
Don't forget to shut it down when you're done, and check with
154
``ec2-describe-instances`` that it did terminate.
157
To save a system snapshot as an image
158
-------------------------------------
160
1. Bundle the current state. *Doing this will reboot the machine.*
161
You need to choose a unique s3 bucket name,
162
typically based on a domain or email address, which can contain
163
any number of images. You also need a name unique within the bucket
164
for this image, like ``desolation-vs2008-20090219``. And finally
165
it needs your AWS S3 access key and secret key, which should be set in
168
ec2-bundle-instance -b ec2.sourcefrog.net \
169
-p desolation-vs2008-2009021 \
170
-o "$AWS_ACCESS_KEY_ID" \
171
-w "$AWS_SECRET_ACCESS_KEY"
173
1. This will take several minutes: You can check progress with ::
175
ec2-describe-bundle-tasks
177
1. Register the files as an image, e.g.::
179
ec2-register ec2.sourcefrog.net/desolation-vs2008-2009021
181
This will give you an AMI id for the image.
183
1. Give access to other team members identified by their Amazon account id::
185
ec2-modify-image-attributes $ami_id -l -a 123412341234