|
| 1 | +# Provision a Deis Cluster on OpenStack |
| 2 | + |
| 3 | + |
| 4 | +### Prerequisites: |
| 5 | +Make sure that the following utilities are installed and in your execution path: |
| 6 | +- nova |
| 7 | +- neutron |
| 8 | + |
| 9 | +### Configure nova |
| 10 | +Create an `openrc.sh` file to match the following: |
| 11 | +``` |
| 12 | +[production] |
| 13 | +OS_AUTH_URL = {openstack_auth_url} |
| 14 | +OS_USERNAME = {openstack_username} |
| 15 | +OS_PASSWORD = {openstack_api_key} |
| 16 | +OS_TENANT_ID = {openstack_tenant_id} |
| 17 | +OS_TENANT_NAME = {openstack_tenant_name} |
| 18 | +``` |
| 19 | + |
| 20 | +(Alternatively, download OpenStack RC file from Horizon/Access & Security/API Access.) |
| 21 | + |
| 22 | +Source your nova credentials: |
| 23 | + |
| 24 | +```console |
| 25 | +# source openrc.sh |
| 26 | +``` |
| 27 | + |
| 28 | +### Set up your keys |
| 29 | +Choose an existing keypair or upload a new public key, if desired. |
| 30 | + |
| 31 | +```console |
| 32 | +$ nova keypair-add --pub-key ~/.ssh/deis.pub deis-key |
| 33 | +``` |
| 34 | + |
| 35 | +### Customize cloud-config.yml |
| 36 | +Edit [user-data](../coreos/user-data) and add a discovery URL. This URL will be used by all nodes in this Deis cluster. You can get a new discovery URL by sending a request to http://discovery.etcd.io/new. |
| 37 | + |
| 38 | +### Choose number of instances |
| 39 | +By default, the provision script will provision 3 servers. You can override this by setting `DEIS_NUM_INSTANCES`: |
| 40 | +```console |
| 41 | +$ DEIS_NUM_INSTANCES=5 ./provision-rackspace-cluster.sh deis-key |
| 42 | +``` |
| 43 | + |
| 44 | +Note that for scheduling to work properly, clusters must consist of at least 3 nodes and always have an odd number of members. |
| 45 | +For more information, see [optimal etcd cluster size](https://github.com/coreos/etcd/blob/master/Documentation/optimal-cluster-size.md). |
| 46 | + |
| 47 | +Deis clusters of less than 3 nodes are unsupported. |
| 48 | + |
| 49 | +### Deis network settings |
| 50 | +The script creates a private network called 'deis' if no such network exist. |
| 51 | + |
| 52 | +By default, the deis subnet IP range is set to 10.21.12.0/24. To override it and the default DNS settings, set the following variables: |
| 53 | +```console |
| 54 | +$ export DEIS_CIDR=10.21.12.0/24 |
| 55 | +$ export DEIS_DNS=10.21.12.3,8.8.8.8 |
| 56 | +``` |
| 57 | + |
| 58 | +**_Please note that this script does not handle floating IPs or routers. These should be provisioned manually either by Horizon or CLI_** |
| 59 | + |
| 60 | +### Run the provision script |
| 61 | +Run the [Openstack provision script](provision-openstack-cluster.sh) to spawn a new CoreOS cluster. |
| 62 | +You'll need to provide the name of the CoreOS image name (or ID), and the key pair you just added. Optionally, you can also specify a flavor name. |
| 63 | +```console |
| 64 | +$ cd contrib/openstack |
| 65 | +$ ./provision-openstack-cluster.sh |
| 66 | +Usage: provision-rackspace-cluster.sh <coreos image name/id> <key pair name> [flavor] |
| 67 | +$ ./provision-rackspace-cluster.sh coreos deis-key |
| 68 | +``` |
| 69 | + |
| 70 | +### Choose number of routers |
| 71 | +By default, the Makefile will provision 1 router. You can override this by setting `DEIS_NUM_ROUTERS`: |
| 72 | +```console |
| 73 | +$ export DEIS_NUM_ROUTERS=2 |
| 74 | +``` |
| 75 | + |
| 76 | +### Initialize the cluster |
| 77 | +Once the cluster is up: |
| 78 | +* **If required, allocate and associate floating IPs to any or all of your hosts** |
| 79 | +* Get the IP address of any of the machines from Openstack |
| 80 | +* set FLEETCTL_TUNNEL, and issue a `make run` from the project root: |
| 81 | + |
| 82 | +```console |
| 83 | +$ export FLEETCTL_TUNNEL=23.253.219.94 |
| 84 | +$ cd ../.. && make run |
| 85 | +``` |
| 86 | + |
| 87 | +The script will deploy Deis and make sure the services start properly. |
| 88 | + |
| 89 | +### Configure DNS |
| 90 | +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. |
| 91 | + |
| 92 | +### Use Deis! |
| 93 | +After that, register with Deis! |
| 94 | +```console |
| 95 | +$ deis register http://deis.example.org |
| 96 | +username: deis |
| 97 | +password: |
| 98 | +password (confirm): |
| 99 | +email: info@opdemand.com |
| 100 | +``` |
| 101 | + |
| 102 | +## Hack on Deis |
| 103 | +If you'd like to use this deployment to build Deis, you'll need to set `DEIS_HOSTS` to an array of your cluster hosts: |
| 104 | +```console |
| 105 | +$ DEIS_HOSTS="1.2.3.4 2.3.4.5 3.4.5.6" make build |
| 106 | +``` |
| 107 | + |
| 108 | +This variable is used in the `make build` command. |
0 commit comments