Skip to content

Commit 06f4c79

Browse files
carmstrongMatthew Fisher
authored andcommitted
docs(contrib/rackspace): update to reflect CoreOS
Updates the Rackspace README and supporting scripts to provision a Deis CoreOS cluster on Rackspace.
1 parent b531857 commit 06f4c79

7 files changed

Lines changed: 182 additions & 278 deletions

contrib/rackspace/README.md

Lines changed: 74 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,86 @@
1-
Provision a Deis Controller on Rackspace
2-
========================================
1+
Provision a Deis Cluster on Rackspace
2+
======================================
33

4-
1. Install [knife-rackspace][kniferack] with `gem install knife-rackspace` or just `bundle install` from the root directory of your deis repository:
4+
We'll mostly be following the [CoreOS on Rackspace](https://coreos.com/docs/running-coreos/cloud-providers/rackspace/) guide. You'll need to have a sane python environment with pip already installed (`sudo easy_install pip`).
55

6-
```console
7-
$ cd $HOME/projects/deis
8-
$ gem install knife-rackspace
9-
Fetching: knife-rackspace-0.9.0.gem (100%)
10-
Successfully installed knife-rackspace-0.9.0
11-
1 gem installed
12-
Installing ri documentation for knife-rackspace-0.9.0...
13-
Installing RDoc documentation for knife-rackspace-0.9.0...
14-
```
6+
1. Install supernova and its dependencies:
7+
```console
8+
$ sudo pip install keyring
9+
$ sudo pip install rackspace-novaclient
10+
$ sudo pip install supernova
11+
```
1512

16-
2. Export your Rackspace credentials as environment variables and edit knife.rb to read them:
13+
2. Edit `~/.supernova` to match the following:
14+
```
15+
[production]
16+
OS_AUTH_URL = https://identity.api.rackspacecloud.com/v2.0/
17+
OS_USERNAME = {rackspace_username}
18+
OS_PASSWORD = {rackspace_api_key}
19+
OS_TENANT_NAME = {rackspace_account_id}
20+
OS_REGION_NAME = DFW (or ORD or another region)
21+
OS_AUTH_SYSTEM = rackspace
22+
```
1723

18-
```console
19-
$ cat <<'EOF' >> $HOME/.bash_profile
20-
export RACKSPACE_USERNAME=<your_rackspace_username>
21-
export RACKSPACE_API_KEY=<your_rackspace_api_key>
22-
source $HOME/.rackspacerc
23-
EOF
24-
$ cat <<'EOF' > $HOME/.rackspacerc
25-
export OS_AUTH_URL="https://identity.api.rackspacecloud.com/v2.0/"
26-
export OS_USERNAME=$RACKSPACE_USERNAME
27-
export OS_PASSWORD=$RACKSPACE_API_KEY
28-
export OS_TENANT_NAME=$RACKSPACE_USERNAME
29-
export OS_TENANT_ID=<your_rackspace_tenant_id>
30-
export OS_REGION_NAME=<your_rackspace_region_name>
31-
export OS_AUTH_SYSTEM="rackspace"
32-
EOF
33-
$ source $HOME/.bash_profile
34-
$ source $HOME/.rackspacerc
35-
$ cat <<'EOF' >> $HOME/.chef/knife.rb
36-
knife[:rackspace_api_username] = "#{ENV['RACKSPACE_USERNAME']}"
37-
knife[:rackspace_api_key] = "#{ENV['RACKSPACE_API_KEY']}"
38-
knife[:rackspace_ssh_keypair] = "deis"
39-
knife[:rackspace_region] = #{ENV['OS_REGION_NAME']}
40-
EOF
41-
$ knife rackspace server list
42-
Instance ID Name Public IP Private IP Flavor Image State
43-
```
24+
Your account ID is displayed in the upper right-hand corner of the cloud control panel UI, and your API key can be found on the Account Settings page.
4425

45-
3. Now you can follow the standard deis setup:
46-
```bash
47-
bundle install # Installs gem files like the knife tool
48-
berks install # Downloads the relevant cookbooks
49-
# '--ssl-verify' is only needed when using a self-hosted Chef Server
50-
# hint: you can also set that at $HOME/.berkshelf/config.json
51-
berks upload [--ssl-verify=false] # Upload the cookbooks to the Chef Server
52-
```
26+
3. Choose an existing keypair or generate a new one, if desired. Tell supernova about the key pair and give it an identifiable name:
5327

54-
4. Prepare a new server
55-
1. Create a server named `deis-prepare-image` using the Ubuntu 12.04 LTS image, performance1-2, 1GB performance server
56-
2. SSH in as root with the password shown
57-
3. Install the 3.11 kernel with: ```apt-get update && apt-get install -yq linux-image-generic-lts-saucy linux-headers-generic-lts-saucy && reboot```
58-
4. After reboot is complete, SSH back in as root and `uname -r` to confirm kernel is `3.11.0-17-generic`
59-
5. Run the `prepare-node-image.sh` script to optimize the image for fast boot times
28+
``console
29+
supernova production keypair-add --pub-key ~/.ssh/deis.pub deis-key
30+
```
6031
61-
```console
62-
$ ssh root@ip-address 'bash -s' < contrib/rackspace/prepare-node-image.sh
63-
Reading package lists... Done
64-
Building dependency tree
65-
Reading state information... Done
66-
...
67-
```
32+
4. Edit [cloud-config.yml](cloud-config.yml) and add a discovery URL. This URL will be used by all nodes in this Deis cluster.
33+
You can get a new discovery URL by sending a request to http://discovery.etcd.io/new.
6834
69-
5. Create a new image from the `deis-prepare-image` server named `deis-node-image`.
70-
1. In the server list in the Control Panel click the action cog for `deis-prepare-image`
71-
2. Select "Create New Image" name that image `deis-node-image`
72-
3. (optionally) Distribute the image to other regions
73-
4. (optionally) Create/update your Deis flavors to use your new images
35+
5. Run the [Rackspace provision script](provision-rackspace-cluster.sh) to spawn a new CoreOS cluster.
36+
You'll need to provide the name of the key pair you just added. Optionally, you can also specify a flavor name.
37+
```console
38+
$ ./provision-rackspace-cluster.sh
39+
Usage: provision-rackspace-cluster.sh <key pair name> [flavor]
40+
$ ./provision-rackspace-cluster.sh deis-key
41+
```
7442

75-
6. Make sure to add the `deis-controller` client object and the `<your_username>-validator` usernames to the Chef 'admins' group.
43+
By default, the script will provision 3 servers. You can override this by setting `DEIS_NUM_INSTANCES`:
44+
```console
45+
$ DEIS_NUM_INSTANCES=5 ./provision-rackspace-cluster.sh deis-key
46+
```
7647

77-
7. Back on your machine with deis cloned and the deis CLI installed, run the provisioning script to create a new Deis controller:
78-
* Change ```<region>``` to match the region your image is in (we will add SYD and HKG as soon as performance flavors are available there):
79-
* dfw
80-
* ord
81-
* iad
82-
* lon
48+
6. Once the cluster is up, get the IP address for any of the machines in the cluster, set
49+
FLEETCTL_TUNNEL, and run [the init script](initialize-rackspace-cluster.sh) to bootstrap the cluster
50+
remotely:
51+
```console
52+
$ export FLEETCTL_TUNNEL=23.253.219.94
53+
$ ./initialize-rackspace-cluster.sh
54+
The authenticity of host '23.253.219.94:22' can't be established.
55+
RSA key fingerprint is ce:3a:c1:3a:ad:11:bd:60:84:8e:60:a8:2f:19:1a:a6.
56+
Are you sure you want to continue connecting (yes/no)? yes
57+
Warning: Permanently added '23.253.219.94:22' (RSA) to the list of known hosts.
58+
Job deis-registry.service scheduled to 73c7d285.../23.253.218.114
59+
Job deis-logger.service scheduled to 21ad134c.../23.253.217.229
60+
Job deis-database.service scheduled to 73c7d285.../23.253.218.114
61+
Job deis-cache.service scheduled to 73c7d285.../23.253.218.114
62+
Job deis-controller.service scheduled to e5c14be6.../23.253.219.94
63+
Job deis-builder.service scheduled to e5c14be6.../23.253.219.94
64+
Job deis-router.service scheduled to 73c7d285.../23.253.218.114
65+
done!
66+
```
8367

84-
```console
85-
$ cd deis
86-
$ bundle install # if you have not already done so
87-
$ ./contrib/rackspace/provision-rackspace-controller.sh <region>
88-
Provisioning a deis controller on Rackspace...
89-
Creating new SSH key: id_rsa
90-
+ ssh-keygen -f /home/deis/.ssh/id_rsa -t rsa -N '' -C deis
91-
+ set +x
92-
Saved to /home/deis/.ssh/id_rsa
93-
Created data_bag[deis-formations]
94-
Created data_bag[deis-apps]
95-
Provisioning deis-controller-H7WVl with knife rackspace...
96-
+ knife rackspace server create --bootstrap-version 11.8.2 --rackspace-region ord --image f569b831-afe5-44f5-85eb-3bf9e1d0d336 --flavor performance1-2 --rackspace-metadata '{"Name": "deis-controller-H7WVl"}' --rackspace-disk-config MANUAL --server-name deis-controller-H7WVl --node-name deis-controller-H7WVl --run-list 'recipe[deis::controller]'
97-
Instance ID: cf7aeadd-4bb1-4f69-9238-7a0586a863b9
98-
Name: deis-controller-H7WVl
99-
Flavor: 2 GB Performance
100-
Image: deis-node-image
101-
Metadata: [ <Fog::Compute::RackspaceV2::Metadatum
102-
key="Name",
103-
value="deis-controller-H7WVl"
104-
>]
105-
RackConnect Wait: no
106-
ServiceLevel Wait: no
107-
SSH Key: deis
108-
...
109-
```
68+
7. After that, wait for the components to come up, check which host the controller is
69+
running on and register with Deis!
70+
```
71+
$ fleetctl list-units
72+
UNIT LOAD ACTIVE SUB DESC MACHINE
73+
deis-builder.service loaded active running deis-builder e5c14be6.../23.253.219.94
74+
deis-cache.service loaded active running deis-cache 73c7d285.../23.253.218.114
75+
deis-controller.service loaded active running deis-controller e5c14be6.../23.253.219.94
76+
deis-database.service loaded active running deis-database 73c7d285.../23.253.218.114
77+
deis-logger.service loaded active running deis-logger 21ad134c.../23.253.217.229
78+
deis-registry.service loaded active running deis-registry 73c7d285.../23.253.218.114
79+
deis-router.service loaded active running deis-router 73c7d285.../23.253.218.114
11080
111-
[kniferack]: http://docs.opscode.com/plugin_knife_rackspace.html
81+
$ deis register 23.253.219.94:8000
82+
username: deis
83+
password:
84+
password (confirm):
85+
email: info@opdemand.com
86+
```

contrib/rackspace/cloud-config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#cloud-config
2+
3+
coreos:
4+
etcd:
5+
# generate a new token for each unique cluster from https://discovery.etcd.io/new
6+
# uncomment the following line and replace it with your discovery URL
7+
# discovery: https://discovery.etcd.io/12345693838asdfasfadf13939923
8+
addr: $public_ipv4:4001
9+
# for multi-region and multi-cloud deployments, you need to use $public_ipv4 here as well
10+
peer-addr: $private_ipv4:7001
11+
units:
12+
- name: etcd.service
13+
command: start
14+
- name: fleet.service
15+
command: start
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Usage: ./initialize-rackspace-cluster.sh
4+
#
5+
6+
set -e
7+
8+
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
9+
CONTRIB_DIR=$(dirname $THIS_DIR)
10+
ROOT_DIR=$(dirname $CONTRIB_DIR)
11+
12+
source $CONTRIB_DIR/utils.sh
13+
14+
# check for fleetctl in $PATH
15+
if ! which fleetctl > /dev/null; then
16+
echo_red 'Please install fleetctl and ensure it is in your $PATH.'
17+
echo_red 'See https://github.com/coreos/fleet for more information'
18+
exit 1
19+
fi
20+
21+
if [ -z "$FLEETCTL_TUNNEL" ]
22+
then
23+
echo_red 'Please set $FLEETCTL_TUNNEL.'
24+
echo_red 'See https://github.com/coreos/fleet/blob/master/Documentation/remote-access.md'
25+
exit 1
26+
fi
27+
28+
cd $ROOT_DIR
29+
30+
# upload each component's systemd unit to the fleet cluster
31+
for component in registry logger database cache controller builder router
32+
do
33+
pushd $component/systemd > /dev/null
34+
fleetctl submit deis-$component.service
35+
fleetctl start deis-$component.service
36+
popd > /dev/null
37+
done
38+
39+
echo_green "Done! Inspect the state of the services with: fleetctl list-units"
40+
echo_green "Once all the services are running, you can register with your Deis cluster: deis register 1.2.3.4:8000"

contrib/rackspace/prepare-node-image.sh

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Usage: ./provision-rackspace-cluster.sh <key pair name> [flavor]
4+
#
5+
6+
set -e
7+
8+
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
9+
CONTRIB_DIR=$(dirname $THIS_DIR)
10+
11+
source $CONTRIB_DIR/utils.sh
12+
13+
if [ -z "$1" ]; then
14+
echo_red 'Usage: provision-rackspace-cluster.sh <key pair name> [flavor]'
15+
exit 1
16+
fi
17+
18+
if [ -z "$2" ]; then
19+
FLAVOR="performance1-2"
20+
else
21+
FLAVOR=$2
22+
fi
23+
24+
if ! which supernova > /dev/null; then
25+
echo_red 'Please install the dependencies listed in the README and ensure they are in your $PATH.'
26+
exit 1
27+
fi
28+
29+
if [ -z "$DEIS_NUM_INSTANCES" ]; then
30+
DEIS_NUM_INSTANCES=3
31+
fi
32+
33+
i=1 ; while [[ $i -le $DEIS_NUM_INSTANCES ]] ; do \
34+
echo_yellow "Provisioning deis-$i..."
35+
supernova production boot --image 6bdbd558-e66c-49cc-9ff3-126e7411f602 --flavor $FLAVOR --key-name $1 --user-data ./cloud-config.yml --config-drive true deis-$i ; \
36+
((i = i + 1)) ; \
37+
done
38+
39+
echo_green "Your Deis cluster has successfully deployed to Rackspace."
40+
echo_green "Please continue to follow the instructions in the README."

0 commit comments

Comments
 (0)