|
1 | | -Provision a Deis Controller on Amazon EC2 |
2 | | -========================================= |
| 1 | +Provision a Deis Cluster on Amazon EC2 |
| 2 | +====================================== |
3 | 3 |
|
4 | | -1. Install [knife-ec2][knifec2] with `gem install knife-ec2` or just |
5 | | -`bundle install` from the root directory of your deis repository: |
| 4 | +1. Install the [AWS Command Line Interface][aws-cli]: |
6 | 5 | ```console |
7 | | -$ cd $HOME/projects/deis |
8 | | -$ gem install knife-ec2 |
9 | | -Fetching: knife-ec2-0.6.4.gem (100%) |
10 | | -Successfully installed knife-ec2-0.6.4 |
11 | | -1 gem installed |
12 | | -Installing ri documentation for knife-ec2-0.6.4... |
13 | | -Installing RDoc documentation for knife-ec2-0.6.4... |
| 6 | +$ pip install awscli |
| 7 | +Downloading/unpacking awscli |
| 8 | + Downloading awscli-1.3.6.tar.gz (173kB): 173kB downloaded |
| 9 | + ... |
14 | 10 | ``` |
15 | 11 |
|
16 | | -2. Export your EC2 credentials as environment variables and edit knife.rb |
17 | | -to read them: |
| 12 | +2. Run `aws configure` to set your AWS credentials: |
18 | 13 | ```console |
19 | | -$ cat <<'EOF' >> $HOME/.bash_profile |
20 | | -export AWS_ACCESS_KEY=<your_aws_access_key> |
21 | | -export AWS_SECRET_KEY=<your_aws_secret_key> |
22 | | -EOF |
23 | | -$ source $HOME/.bash_profile |
24 | | -$ cat <<'EOF' >> $HOME/.chef/knife.rb |
25 | | -knife[:aws_access_key_id] = "#{ENV['AWS_ACCESS_KEY']}" |
26 | | -knife[:aws_secret_access_key] = "#{ENV['AWS_SECRET_KEY']}" |
27 | | -EOF |
28 | | -$ knife ec2 server list |
29 | | -Instance ID Name Public IP Private IP Flavor Image SSH Key Security Groups State |
| 14 | +$ aws configure |
| 15 | +AWS Access Key ID [None]: *************** |
| 16 | +AWS Secret Access Key [None]: ************************ |
| 17 | +Default region name [None]: us-west-1 |
| 18 | +Default output format [None]: |
30 | 19 | ``` |
31 | 20 |
|
32 | | -3. Download and install the [EC2 Command Line Tools][ec2cli] as described in |
33 | | -[AWS' documentation][ec2cli] and ensure they are available in your $PATH: |
| 21 | +3. Upload a new keypair to AWS, ensuring that the name of the keypair is set to "deis". |
| 22 | + |
| 23 | +4. Edit [cloudformation-parameters.json][cf-params], ensuring to add a new discovery URL. |
| 24 | +You can get a new one by sending a new request to http://discovery.etcd.io/new. |
| 25 | +```console |
| 26 | + { |
| 27 | + "ParameterKey": "DiscoveryURL", |
| 28 | + "ParameterValue": "https://discovery.etcd.io/40826e8da55f4d9026935ab67b243c6a" |
| 29 | + } |
| 30 | +``` |
| 31 | +NOTE: If you're interested in running your own discovery endpoint or want to know more |
| 32 | +about the discovery URL, see http://discovery.etcd.io for more information. You can also |
| 33 | +read more on how you can customize this cluster by looking at the |
| 34 | +[CoreOS EC2 template][template] and applying it to |
| 35 | +[cloudformation-parameters.json][cf-params]. |
| 36 | + |
| 37 | +5. Run the [cloudformation provision script][pro-script] to spawn a new CoreOS cluster: |
34 | 38 | ```console |
35 | | -$ ec2-describe-group |
36 | | -GROUP sg-33d1045a 693041077886 default default group |
37 | | -PERMISSION 693041077886 default ALLOWS tcp 0 65535 FROM USER 693041077886 NAME default ID sg-33d1045a ingress |
38 | | -PERMISSION 693041077886 default ALLOWS udp 0 65535 FROM USER 693041077886 NAME default ID sg-33d1045a ingress |
39 | | -PERMISSION 693041077886 default ALLOWS icmp -1 -1 FROM USER 693041077886 NAME default ID sg-33d1045a ingress |
| 39 | +$ ./provision-ec2-cluster.sh |
| 40 | +{ |
| 41 | + "StackId": "arn:aws:cloudformation:us-west-1:413516094235:stack/deis/9699ec20-c257-11e3-99eb-50fa01cd4496" |
| 42 | +} |
| 43 | +Your Deis cluster has successfully deployed. |
| 44 | +Please wait for it to come up, then run ./initialize-ec2-cluster.sh |
40 | 45 | ``` |
41 | 46 |
|
42 | | -4. Run the provisioning script to create a new Deis controller: |
| 47 | +6. Once the cluster is up, get the hostname of any of the machines from EC2, set |
| 48 | +FLEETCTL_TUNNEL, then run [the init script][init-script] to bootstrap the cluster |
| 49 | +remotely: |
43 | 50 | ```console |
44 | | -$ ./contrib/ec2/provision-ec2-controller.sh us-west-2 |
45 | | -Creating security group: deis-controller |
46 | | -+ ec2-create-group deis-controller -d 'Created by Deis' |
47 | | -GROUP sg-3c3a1c0c deis-controller Created by Deis |
48 | | -+ set +x |
49 | | -Authorizing TCP ports 22,80,443,514 from 0.0.0.0/0... |
50 | | -+ ec2-authorize deis-controller -P tcp -p 22 -s 0.0.0.0/0 |
51 | | -... |
52 | | -ec2-203.0.113.33.us-west-2.compute.amazonaws.com |
53 | | -ec2-203-0-113-33.us-west-2.compute.amazonaws.com Chef Client finished, 74 resources updated |
54 | | -... |
55 | | -Instance ID: i-31c8d106 |
56 | | -Flavor: m1.large |
57 | | -Image: ami-72e27c42 |
58 | | -Region: us-west-2 |
59 | | -Public DNS Name: ec2-203-0-113-33.us-west-2.compute.amazonaws.com |
60 | | -Public IP Address: 203.0.113.33 |
61 | | -Run List: recipe[deis::controller] |
62 | | -... |
| 51 | +$ export FLEETCTL_TUNNEL=ec2-12-345-678-90.us-west-1.compute.amazonaws.com |
| 52 | +$ ./initialize-ec2-cluster.sh |
| 53 | +The authenticity of host '54.215.248.50:22' can't be established. |
| 54 | +RSA key fingerprint is 86:10:74:b9:6a:ee:3b:21:d0:0f:b4:63:cc:10:64:c9. |
| 55 | +Are you sure you want to continue connecting (yes/no)? yes |
| 56 | +Warning: Permanently added '54.215.248.50:22' (RSA) to the list of known hosts. |
| 57 | +Job deis-registry.service started on aec641dc.../172.31.21.4 |
| 58 | +Job deis-logger.service started on 494dcb6a.../172.31.5.226 |
| 59 | +Job deis-database.service started on aec641dc.../172.31.21.4 |
| 60 | +Job deis-cache.service started on aec641dc.../172.31.21.4 |
| 61 | +Job deis-controller.service started on aec641dc.../172.31.21.4 |
| 62 | +Job deis-builder.service started on 494dcb6a.../172.31.5.226 |
| 63 | +Job deis-router.service started on aec641dc.../172.31.21.4 |
| 64 | +done! |
| 65 | +``` |
| 66 | + |
| 67 | +7. After that, wait for the components to come up, check which host the controller is |
| 68 | +running on and register with Deis! |
| 69 | +``` |
| 70 | +$ fleetctl list-units |
| 71 | +UNIT LOAD ACTIVE SUB DESC MACHINE |
| 72 | +deis-builder.service loaded active running deis-builder d9f1f3ea.../172.31.5.62 |
| 73 | +deis-cache.service loaded active running deis-cache d9f1f3ea.../172.31.5.62 |
| 74 | +deis-controller.service loaded active running deis-controller d9f1f3ea.../172.31.5.62 |
| 75 | +deis-database.service loaded active running deis-database 13c5541b.../172.31.5.61 |
| 76 | +deis-logger.service loaded active running deis-logger d9f1f3ea.../172.31.5.62 |
| 77 | +deis-registry.service loaded active running deis-registry 4c263e91.../172.31.24.155 |
| 78 | +deis-router.service loaded active running deis-router 13c5541b.../172.31.5.61 |
| 79 | +$ deis register ec2-12-345-678-90.us-west-1.compute.amazonaws.com:8000 |
| 80 | +username: deis |
| 81 | +password: |
| 82 | +password (confirm): |
| 83 | +email: info@opdemand.com |
63 | 84 | ``` |
64 | 85 |
|
65 | | -[knifec2]: http://docs.opscode.com/plugin_knife_ec2.html |
| 86 | +[aws-cli]: https://github.com/aws/aws-cli |
| 87 | +[template]: https://s3.amazonaws.com/coreos.com/dist/aws/coreos-alpha.template |
| 88 | +[cf-params]: cloudformation-parameters.json |
| 89 | +[pro-script]: provision-ec2-cluster.sh |
| 90 | +[init-script]: initialize-ec2-cluster.sh |
0 commit comments