|
1 | | -Deis on DigitalOcean |
2 | | -==================== |
| 1 | +# Provision a Deis Cluster on Digital Ocean |
3 | 2 |
|
4 | | -Unfortunately, DigitalOcean does not yet provide CoreOS images. This |
5 | | -prevents Deis from being deployed on DigitalOcean. |
| 3 | +Note that Digital Ocean does not support CoreOS images natively. To work around this, the provision |
| 4 | +scripts for Digital Ocean first create a CoreOS image which will be used for provisioning the cluster. |
6 | 5 |
|
7 | | -If you use DigitalOcean, please |
8 | | -[show your support](http://digitalocean.uservoice.com/forums/136585-digital-ocean/suggestions/4250154-suport-coreos-as-a-deployment-platform) |
9 | | -for CoreOS and help us to support Deis on DO. |
| 6 | +Digital Ocean support was contributed by [sttts](https://github.com/sttts). The CoreOS bootstrapping |
| 7 | +is heavily based on [Levi Aul's code](https://gist.github.com/tsutsu/490f35f48897df0f5173). |
| 8 | + |
| 9 | +To deploy Deis to Digital Ocean: |
| 10 | + |
| 11 | +## Customize cloud-config.yml |
| 12 | +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. |
| 13 | + |
| 14 | +## Install tugboat and authorize: |
| 15 | +The tugboat gem consumes the Digital Ocean API. |
| 16 | +```console |
| 17 | +$ gem install tugboat |
| 18 | +$ tugboat authorize |
| 19 | +``` |
| 20 | +You can leave all but the client and API keys as the defaults. |
| 21 | + |
| 22 | +## Upload keys |
| 23 | +Choose an SSH keypair to use for Deis and import it to Digital Ocean: |
| 24 | +```console |
| 25 | +$ tugboat add-key deis |
| 26 | +``` |
| 27 | + |
| 28 | +Then, get the ID of the key: |
| 29 | +```console |
| 30 | +$ tugboat keys |
| 31 | +``` |
| 32 | + |
| 33 | +## Create a Deis image: |
| 34 | +```console |
| 35 | +$ ./provision-digitalocean-deis-image.sh <SSH KEY ID> |
| 36 | +``` |
| 37 | + |
| 38 | +## Choose number of instances |
| 39 | +By default, the script will provision 3 servers. You can override this by setting `DEIS_NUM_INSTANCES`: |
| 40 | +```console |
| 41 | +$ export DEIS_NUM_INSTANCES=5 |
| 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 | +## Deploy cluster |
| 50 | +Run the provision script: |
| 51 | +```console |
| 52 | +$ ./provision-do-cluster.sh <REGION_ID> <IMAGE_ID> <SSH_ID> <SIZE> |
| 53 | +``` |
| 54 | + |
| 55 | +Not all regions allow private networks. Choose one which does (at the time of this writing, NY 2, |
| 56 | +Amsterdam 2, Singapore 1 or London 1) - check the web UI for the current private network support. |
| 57 | + |
| 58 | +You can enumerate all the regions with: |
| 59 | + |
| 60 | +```console |
| 61 | +$ tugboat regions |
| 62 | +``` |
| 63 | + |
| 64 | +The provisioning script uses a 512 MB droplet by default because for image creation |
| 65 | +more memory is not needed. Deis controller nodes will need at least 2 GB to even start all |
| 66 | +the services. Add the memory requirements of deployed applications and choose an adequate |
| 67 | +droplet size. The default is 8 GB (ID "65"). You can enumerate all sizes with: |
| 68 | + |
| 69 | +```console |
| 70 | +$ tugboat sizes |
| 71 | +``` |
| 72 | + |
| 73 | +## Choose number of routers |
| 74 | +By default, the Makefile will provision 1 router. You can override this by setting `DEIS_NUM_ROUTERS`: |
| 75 | +```console |
| 76 | +$ export DEIS_NUM_ROUTERS=2 |
| 77 | +``` |
| 78 | + |
| 79 | +## Initialize the cluster |
| 80 | +Once the cluster is up, get the IPs of any of the machines using `tugboat droplets`, set |
| 81 | +FLEETCTL_TUNNEL to one of these IPs: |
| 82 | +```console |
| 83 | +$ export FLEETCTL_TUNNEL=23.253.219.94 |
| 84 | +$ cd ../.. && make run |
| 85 | +``` |
| 86 | +The script will deploy Deis and make sure the services start properly. |
| 87 | + |
| 88 | +### Configure DNS |
| 89 | +You'll need to configure DNS records so you can access applications hosted on Deis. See [Configuring DNS](http://docs.deis.io/en/latest/operations/configure-dns/) for details. |
| 90 | + |
| 91 | +### Use Deis! |
| 92 | +After that, register with Deis! |
| 93 | +```console |
| 94 | +$ deis register http://deis.example.org |
| 95 | +username: deis |
| 96 | +password: |
| 97 | +password (confirm): |
| 98 | +email: info@opdemand.com |
| 99 | +``` |
| 100 | + |
| 101 | +## Hack on Deis |
| 102 | +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: |
| 103 | +```console |
| 104 | +$ DEIS_HOSTS="1.2.3.4 2.3.4.5 3.4.5.6" make build |
| 105 | +``` |
| 106 | + |
| 107 | +This variable is used in the `make build` command. |
0 commit comments