|
1 | | -# Provision a Deis Cluster on Amazon EC2 |
| 1 | +# Provision a Deis Cluster on Amazon AWS |
2 | 2 |
|
3 | | -## Install the [AWS Command Line Interface][aws-cli]: |
4 | | -```console |
5 | | -$ pip install awscli |
6 | | -Downloading/unpacking awscli |
7 | | - Downloading awscli-1.5.0.tar.gz (248kB): 248kB downloaded |
8 | | -... |
9 | | -Successfully installed awscli |
10 | | -``` |
11 | | - |
12 | | -## Configure aws-cli |
13 | | -Run `aws configure` to set your AWS credentials: |
14 | | -```console |
15 | | -$ aws configure |
16 | | -AWS Access Key ID [None]: *************** |
17 | | -AWS Secret Access Key [None]: ************************ |
18 | | -Default region name [None]: us-west-1 |
19 | | -Default output format [None]: |
20 | | -``` |
21 | | - |
22 | | -## Upload keys |
23 | | -Generate and upload a new keypair to AWS, ensuring that the name of the keypair is set to "deis". |
24 | | -```console |
25 | | -$ ssh-keygen -q -t rsa -f ~/.ssh/deis -N '' -C deis |
26 | | -$ aws ec2 import-key-pair --key-name deis --public-key-material file://~/.ssh/deis.pub |
27 | | -``` |
28 | | - |
29 | | -## Choose number of instances |
30 | | -By default, the script will provision 3 servers. You can override this by setting `DEIS_NUM_INSTANCES`: |
31 | | -```console |
32 | | -$ export DEIS_NUM_INSTANCES=5 |
33 | | -``` |
34 | | - |
35 | | -Note that for scheduling to work properly, clusters must consist of at least 3 nodes and always have an odd number of members. |
36 | | -For more information, see [optimal etcd cluster size](https://github.com/coreos/etcd/blob/master/Documentation/optimal-cluster-size.md). |
37 | | - |
38 | | -Deis clusters of less than 3 nodes are unsupported. |
39 | | - |
40 | | -## Customize user-data |
41 | | - |
42 | | -Create a user-data file with a new discovery URL this way: |
43 | | - |
44 | | -```console |
45 | | -$ make discovery-url |
46 | | -``` |
47 | | - |
48 | | -Or copy [`contrib/coreos/user-data.example`](../coreos/user-data.example) to `contrib/coreos/user-data` and follow the directions in the `etcd:` section to add a unique discovery URL. |
49 | | - |
50 | | -## Customize cloudformation.json |
51 | | -Any of the parameter defaults defined in deis.template.json can be overridden |
52 | | -by setting the value in [cloudformation.json](cloudformation.json) like so: |
53 | | - |
54 | | -``` |
55 | | - { |
56 | | - "ParameterKey": "InstanceType", |
57 | | - "ParameterValue": "m3.xlarge" |
58 | | - }, |
59 | | - { |
60 | | - "ParameterKey": "KeyPair", |
61 | | - "ParameterValue": "jsmith" |
62 | | - }, |
63 | | - { |
64 | | - "ParameterKey": "EC2VirtualizationType", |
65 | | - "ParameterValue": "PV" |
66 | | - }, |
67 | | - { |
68 | | - "ParameterKey": "AssociatePublicIP", |
69 | | - "ParameterValue": "false" |
70 | | - } |
71 | | -``` |
72 | | - |
73 | | -The only entry in cloudformation.json required to launch your cluster is `KeyPair`, |
74 | | -which is already filled out. The defaults will be applied for the other settings. |
75 | | - |
76 | | -If updated with update-ec2-cluster.sh, the InstanceType will only impact newly deployed instances (#1758). |
77 | | - |
78 | | -NOTE: The smallest recommended instance size is `large`. Having not enough CPU or RAM will result |
79 | | -in numerous issues when using the cluster. |
80 | | - |
81 | | -## Launch into an existing VPC |
82 | | -By default, the provided CloudFormation script will create a new VPC for Deis. However, the script |
83 | | -supports provisioning into an existing VPC instead. You'll need to have a VPC configured with an |
84 | | -internet gateway and a sane routing table (the default VPC in a region should be ready to go). |
85 | | - |
86 | | -To launch your cluster into an existing VPC, export three additional environment variables: ```VPC_ID```, |
87 | | -```VPC_SUBNETS```, ```VPC_ZONES```. ```VPC_ZONES``` must list the availability zones of the |
88 | | -subnets in order. |
89 | | - |
90 | | -For example, if your VPC has ID ```vpc-a26218bf``` and consists of the subnets ```subnet-04d7f942``` |
91 | | -(which is in ```us-east-1b```) and ```subnet-2b03ab7f``` (which is in ```us-east-1c```) you would |
92 | | -export: |
93 | | - |
94 | | -``` |
95 | | -export VPC_ID=vpc-a26218bf |
96 | | -export VPC_SUBNETS=subnet-04d7f942,subnet-2b03ab7f |
97 | | -export VPC_ZONES=us-east-1b,us-east-1c |
98 | | -``` |
99 | | - |
100 | | -## Run the provision script |
101 | | -Run the [cloudformation provision script][pro-script] to spawn a new CoreOS cluster: |
102 | | -```console |
103 | | -$ cd contrib/ec2 |
104 | | -$ ./provision-ec2-cluster.sh |
105 | | -{ |
106 | | - "StackId": "arn:aws:cloudformation:us-west-1:413516094235:stack/deis/9699ec20-c257-11e3-99eb-50fa01cd4496" |
107 | | -} |
108 | | -Your Deis cluster has successfully deployed. |
109 | | -Please wait for all instances to come up as "running" before continuing. |
110 | | -``` |
111 | | - |
112 | | -Check the AWS EC2 web control panel and wait until "Status Checks" for all instances have passed. |
113 | | -This will take several minutes. |
114 | | - |
115 | | -## Configure Deis |
116 | | -Set the default domain used to anchor your applications: |
117 | | - |
118 | | -```console |
119 | | -$ deisctl config platform set domain=mycluster.local |
120 | | -``` |
121 | | - |
122 | | -For this to work, you'll need to configure DNS records so you can access applications hosted on Deis. See [Configuring DNS](http://docs.deis.io/en/latest/installing_deis/configure-dns/) for details. |
123 | | - |
124 | | -If you want to allow `deis run` for one-off admin commands, you must provide an SSH private key that allows Deis to gather container logs on CoreOS hosts: |
125 | | - |
126 | | -```console |
127 | | -$ deisctl config platform set sshPrivateKey=<path-to-private-key> |
128 | | -``` |
129 | | - |
130 | | -## Initialize the cluster |
131 | | -Once the cluster is up, get the hostname of any of the machines from EC2, set |
132 | | -DEISCTL_TUNNEL, and issue a `deisctl install`: |
133 | | -```console |
134 | | -$ ssh-add ~/.ssh/deis |
135 | | -$ export DEISCTL_TUNNEL=ec2-12-345-678-90.us-west-1.compute.amazonaws.com |
136 | | -$ deisctl install platform && deisctl start platform |
137 | | -``` |
138 | | -Deisctl will deploy Deis and make sure the services start properly. |
139 | | - |
140 | | -## Configure load balancer |
141 | | -The Deis provisioning scripts for EC2 automatically create an Elastic Load Balancer for your Deis |
142 | | -cluster. However, ELBs on EC2 have a default timeout of 60 seconds, which will disrupt a ``git push`` |
143 | | -when using Deis. You should manually [increase this timeout](http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/config-idle-timeout.html) |
144 | | -to 1200 seconds to match the timeout on the router and application unit files. |
145 | | - |
146 | | -## Configure DNS |
147 | | -While you can reference the controller and hosted applications with public hostnames provided by EC2, it is recommended for ease-of-use that |
148 | | -you configure your own DNS records using a domain you own. See [Configuring DNS](http://docs.deis.io/en/latest/installing_deis/configure-dns/) for details. |
149 | | - |
150 | | -## Use Deis! |
151 | | -After that, register with Deis! |
152 | | -```console |
153 | | -$ deis register http://deis.example.org |
154 | | -username: deis |
155 | | -password: |
156 | | -password (confirm): |
157 | | -email: info@opdemand.com |
158 | | -``` |
159 | | - |
160 | | -## Hack on Deis |
161 | | - |
162 | | -See [Hacking on Deis](http://docs.deis.io/en/latest/contributing/hacking/). |
163 | | - |
164 | | -[aws-cli]: https://github.com/aws/aws-cli |
165 | | -[template]: https://s3.amazonaws.com/coreos.com/dist/aws/coreos-alpha.template |
166 | | -[pro-script]: provision-ec2-cluster.sh |
| 3 | +Please refer to the instructions at http://docs.deis.io/en/latest/installing_deis/aws. |
0 commit comments