|
1 | | -Provision a Deis Controller on Rackspace |
2 | | -======================================== |
| 1 | +Provision a Deis Cluster on Rackspace |
| 2 | +====================================== |
3 | 3 |
|
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`). |
5 | 5 |
|
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 | +``` |
15 | 12 |
|
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 | +``` |
17 | 23 |
|
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. |
44 | 25 |
|
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: |
53 | 27 |
|
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 | +``` |
60 | 31 |
|
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. |
68 | 34 |
|
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 | +``` |
74 | 42 |
|
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 | +``` |
76 | 47 |
|
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 | +``` |
83 | 67 |
|
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 |
110 | 80 |
|
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 | +``` |
0 commit comments