Skip to content

Commit

Permalink
ref(*): deprecate cluster domain object
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Monroy committed Oct 19, 2014
1 parent 121ae2e commit bda1c9c
Show file tree
Hide file tree
Showing 59 changed files with 522 additions and 946 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,26 @@ $ deisctl install platform
$ deisctl start platform
```

This can take some time - the **builder** and **registry** components must download and install the beefy Heroku cedar stack. Grab some more coffee!
This can take some time - the **builder** must download and install the beefy Heroku cedar stack. Grab some more coffee!

Your Deis platform should be accessible at `deis.local3.deisapp.com`. For clusters on other platforms see our guide to [Configuring DNS](http://docs.deis.io/en/latest/installing_deis/configure-dns/).

## Configure Deis

Now that Deis is running there are a few administrative settings we need to provide.

Set the default domain used to anchor your applications. For a Vagrant environment, use `local3.deisapp.com` as it will resolve to your local routers:

```console
$ deisctl config platform set domain=local3.deisapp.com
```

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:

```console
$ deisctl config platform set sshPrivateKey=~/.vagrant.d/insecure_private_key
```

## Install the Deis Client

If you're using the latest Deis release, use `pip install --upgrade deis` to install the latest [Deis Client](https://pypi.python.org/pypi/deis/) or download [pre-compiled binaries](https://github.com/deis/deis/tree/master/client#get-started).
Expand All @@ -100,22 +116,6 @@ $ deis keys:add

Use `deis keys:add` to add your SSH public key for `git push` access -- normally `$HOME/.ssh/id_rsa.pub`.

## Initialize a Cluster

Initialize a `dev` cluster with a list of CoreOS hosts and your CoreOS private key.

```console
$ deis clusters:create dev local3.deisapp.com --hosts=172.17.8.100 --auth=~/.vagrant.d/insecure_private_key
```

The parameters to `deis clusters:create` are:
* cluster name (`dev`) - the name used by Deis to reference the cluster
* cluster hostname (`local.3deisapp.com`) - the hostname under which apps are created, like `balancing-giraffe.local3.deisapp.com`
* cluster members (`--hosts`) - a comma-separated list of cluster members -- not necessarily all members, but at least one (for cloud providers, this is a list of the IPs like `--hosts=10.21.12.1,10.21.12.2,10.21.12.3`)
* auth SSH key (`--auth`) - the SSH private key used to provision servers -- cannot have a password (for cloud providers, this key is likely `~/.ssh/deis`)

The `dev` cluster will be used as the default cluster for future `deis` commands.

# Usage

Deis supports 3 deployment workflows:
Expand Down
207 changes: 2 additions & 205 deletions client/deis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
Subcommands, use ``deis help [subcommand]`` to learn more::
apps manage applications used to provide services
clusters manage clusters used to host applications
ps manage processes inside an app container
config manage environment variables that define app config
domains manage and assign domain names to your applications
Expand All @@ -23,7 +22,7 @@
releases manage releases of an application
keys manage ssh keys used for `git push` deployments
perms manage permissions for shared apps and clusters
perms manage permissions for applications
Developer shortcut commands::
Expand Down Expand Up @@ -431,7 +430,6 @@ def apps_create(self, args):
Creates a new application.
- if no <id> is provided, one will be generated automatically.
- if no <cluster> is provided, a <cluster> named "dev" will be used.
Usage: deis apps:create [<id>] [options]
Expand All @@ -441,8 +439,6 @@ def apps_create(self, args):
exist with this name.
Options:
--cluster=<cluster>
target cluster to host application [default: dev].
--no-remote
do not create a `deis` git remote.
"""
Expand All @@ -455,9 +451,6 @@ def apps_create(self, args):
app_name = args.get('<id>')
if app_name:
body.update({'id': app_name})
cluster = args.get('--cluster')
if cluster:
body.update({'cluster': cluster})
sys.stdout.write('Creating application... ')
sys.stdout.flush()
try:
Expand Down Expand Up @@ -911,200 +904,6 @@ def builds_list(self, args):
else:
raise ResponseError(response)

def clusters(self, args):
"""
Valid commands for clusters:
clusters:create create a new cluster
clusters:list list accessible clusters
clusters:update update cluster fields
clusters:info print a represenation of the cluster
clusters:destroy destroy a cluster
Use `deis help [command]` to learn more.
"""
return self.clusters_list(args)

def clusters_create(self, args):
"""
Creates a new cluster.
Usage: deis clusters:create <id> <domain> --hosts=<hosts> --auth=<auth> [options]
Arguments:
<id>
a uniquely identifiable name for the cluster, such as 'dev' or 'prod'.
<domain>
a domain under which app hostnames will live. This must be provided to support
multiple applications hosted on the cluster.
NOTE: this requires wildcard DNS configuration on the domain. For example, a
<domain> of `deisapp.com` requires that `*.deisapp.com` resolves to one of the
cluster's router endpoints or the load balancer in front of the routers.
--hosts=<hosts>
a comma-separated list of the cluster members' private IP addresses.
--auth=<auth>
a local file path to an SSH private key. This is the key used to provision and
connect to the cluster members. This key must not have a password.
NOTE: for EC2 and Rackspace, this key is likely `~/.ssh/deis`.
Options:
--type=<type>
cluster type [default: coreos].
"""
body = {'id': args['<id>'], 'domain': args['<domain>'],
'hosts': args['--hosts'], 'type': args['--type']}
auth_path = os.path.expanduser(args['--auth'])
if not os.path.exists(auth_path):
self._logger.error('Path to authentication credentials does not exist: {}'.format(auth_path))
sys.exit(1)
with open(auth_path) as f:
data = f.read()
body.update({'auth': base64.b64encode(data)})
sys.stdout.write('Creating cluster... ')
sys.stdout.flush()
try:
progress = TextProgress()
progress.start()
response = self._dispatch('post', '/api/clusters', json.dumps(body))
finally:
progress.cancel()
progress.join()
if response.status_code == requests.codes.created: # @UndefinedVariable
data = response.json()
cluster = data['id']
self._logger.info("done, created {}".format(cluster))
else:
raise ResponseError(response)

def clusters_info(self, args):
"""
Prints information about a cluster.
Usage: deis clusters:info <id>
Arguments:
<id>
the uniquely identifiable name for the cluster.
"""
cluster = args.get('<id>')
response = self._dispatch('get', "/api/clusters/{}".format(cluster))
if response.status_code == requests.codes.ok: # @UndefinedVariable
self._logger.info("=== {} Cluster".format(cluster))
self._logger.info(json.dumps(response.json(), indent=2) + '\n')
else:
raise ResponseError(response)

def clusters_list(self, args):
"""
Lists available clusters.
Usage: deis clusters:list
"""
response = self._dispatch('get', '/api/clusters')
if response.status_code == requests.codes.ok: # @UndefinedVariable
data = response.json()
self._logger.info("=== Clusters")
for item in data['results']:
self._logger.info("{id}".format(**item))
else:
raise ResponseError(response)

def clusters_destroy(self, args):
"""
Destroys a cluster.
Usage: deis clusters:destroy <id> [options]
Arguments:
<id>
the uniquely identifiable name for the cluster.
Options:
--confirm=<id>
skips the prompt for the cluster name. <id> is the uniquely identifiable name
for the cluster.
"""
cluster = args.get('<id>')
confirm = args.get('--confirm')
if confirm == cluster:
pass
else:
self._logger.warning("""
! WARNING: Potentially Destructive Action
! This command will destroy the cluster: {cluster}
! To proceed, type "{cluster}" or re-run this command with --confirm={cluster}
""".format(**locals()))
confirm = raw_input('> ').strip('\n')
if confirm != cluster:
self._logger.info('Destroy aborted')
return
sys.stdout.write("Destroying cluster... ".format(cluster))
sys.stdout.flush()
try:
progress = TextProgress()
progress.start()
before = time.time()
response = self._dispatch('delete', "/api/clusters/{}".format(cluster))
finally:
progress.cancel()
progress.join()
if response.status_code in (requests.codes.no_content, # @UndefinedVariable
requests.codes.not_found): # @UndefinedVariable
self._logger.info('done in {}s'.format(int(time.time() - before)))
else:
raise ResponseError(response)

def clusters_update(self, args):
"""
Updates cluster fields.
Usage: deis clusters:update <id> [options]
Arguments:
<id>
the uniquely identifiable name for the cluster.
Options:
--domain=<domain>
a domain under which app hostnames will live. See `deis help clusters:create`
for more information.
--hosts=<hosts>
a comma-separated list of the cluster members' private IP addresses.
--auth=<auth>
a local file path to an SSH private key. This is the key used to provision and
connect to the cluster members. This key must not have a password.
--type=<type>
cluster type (default: coreos).
--id=<id>
the (new) uniquely identifiable name for the cluster.
"""
cluster = args['<id>']
body = {}
for k, arg in (('domain', '--domain'), ('hosts', '--hosts'),
('auth', '--auth'), ('type', '--type'), ('id', '--id')):
if k == 'auth' and args.get('--auth') is not None:
auth_path = os.path.expanduser(args['--auth'])
if not os.path.exists(auth_path):
self._logger.error(
"Path to authentication credentials does not exist: {}".format(auth_path))
sys.exit(1)
with open(auth_path) as f:
data = f.read()
body.update({'auth': base64.b64encode(data)})
else:
v = args.get(arg)
if v:
body.update({k: v})
response = self._dispatch('patch', '/api/clusters/{}'.format(cluster),
json.dumps(body))
if response.status_code == requests.codes.ok: # @UndefinedVariable
self._logger.info(json.dumps(response.json(), indent=2))
else:
raise ResponseError(response)

def config(self, args):
"""
Valid commands for config:
Expand Down Expand Up @@ -1899,13 +1698,12 @@ def perms(self, args):
"""
Valid commands for perms:
perms:list list permissions granted on an app or cluster
perms:list list permissions granted on an app
perms:create create a new permission for a user
perms:delete delete a permission for a user
Use `deis help perms:[command]` to learn more.
"""
# perms:transfer transfer ownership of an app or cluster
sys.argv[1] = 'perms:list'
args = docopt(self.perms_list.__doc__)
return self.perms_list(args)
Expand Down Expand Up @@ -2132,7 +1930,6 @@ def shortcuts(self, args):
('create', 'apps:create'),
('destroy', 'apps:destroy'),
('info', 'apps:info'),
('init', 'clusters:create'),
('login', 'auth:login'),
('logout', 'auth:logout'),
('logs', 'apps:logs'),
Expand Down
15 changes: 15 additions & 0 deletions contrib/bare-metal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ $ export DEISCTL_TUNNEL=your.server.name.here
$ deisctl install platform && deisctl start platform
```

## Configure Deis
Set the default domain used to anchor your applications:

```console
$ deisctl config platform set domain=mycluster.local
```

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.

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:

```console
$ deisctl config platform set sshPrivateKey=<path-to-private-key>
```

## Use Deis!
After that, register with Deis!
```console
Expand Down
16 changes: 14 additions & 2 deletions contrib/digitalocean/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,20 @@ $ deisctl install platform && deisctl start platform
```
Deisctl will deploy Deis and make sure the services are started properly. Grab a coffee.

### Configure DNS
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.
## Configure Deis
Set the default domain used to anchor your applications:

```console
$ deisctl config platform set domain=mycluster.local
```

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.

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:

```console
$ deisctl config platform set sshPrivateKey=<path-to-private-key>
```

### Use Deis!
After that, register with Deis!
Expand Down
15 changes: 12 additions & 3 deletions contrib/ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,19 @@ $ deisctl install platform && deisctl start platform
```
Deisctl will deploy Deis and make sure the services start properly.

## Choose number of routers
By default, deisctl will provision 1 router. You can override this by scaling up:
## Configure Deis
Set the default domain used to anchor your applications:

```console
$ deisctl config platform set domain=mycluster.local
```

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.

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:

```console
$ deisctl scale router=3
$ deisctl config platform set sshPrivateKey=<path-to-private-key>
```

## Configure load balancer
Expand Down
Loading

0 comments on commit bda1c9c

Please sign in to comment.