github.com/gust1n/deis@v0.13.1-0.20141009230754-43ff4d95947b/README.md (about)

     1  # Deis
     2  
     3  Deis (pronounced DAY-iss) is an open source PaaS that makes it easy to deploy and manage applications on your own servers. Deis builds upon [Docker](http://docker.io/) and [CoreOS](http://coreos.com) to provide a lightweight PaaS with a [Heroku-inspired](http://heroku.com) workflow.
     4  
     5  [![Current Release](http://img.shields.io/badge/release-v0.13.0-blue.svg)](https://github.com/deis/deis/releases/tag/v0.13.0)
     6  
     7  ![Deis Graphic](https://s3-us-west-2.amazonaws.com/deis-images/deis-graphic.png)
     8  
     9  Deis is pre-release software. The current release is [v0.13.0](https://github.com/deis/deis/tree/v0.13.0). Until there is a stable release, we recommend you check out the latest ["master" branch](https://github.com/deis/deis) code and refer to the [latest documentation](http://docs.deis.io/en/latest/).  Upgrading from a previous Deis release? See [Upgrading Deis](http://docs.deis.io/en/latest/installing_deis/upgrading-deis/) for additional information.
    10  
    11  # Deploying Deis
    12  
    13  Deis is a set of Docker containers that can be deployed anywhere including public cloud, private cloud, bare metal or your workstation. Decide where you'd like to deploy Deis, then follow the deployment-specific documentation for [Rackspace](contrib/rackspace/README.md), [EC2](contrib/ec2/README.md), [DigitalOcean](contrib/digitalocean/README.md), [Google Compute Engine](contrib/gce/README.md) or [bare-metal](contrib/bare-metal/README.md) provisioning. Want to see a particular platform supported? Please open an [issue](https://github.com/deis/deis/issues/new).
    14  
    15  Trying out Deis? Continue following these instructions for a local installation using Vagrant.
    16  
    17  ## Install prerequisites
    18  
    19   * Due to its nature as a distributed system, we strongly recommend using Deis with a minimum of 3 nodes even for local development and testing
    20   * The Deis "control plane" containers will consume approximately 2 GB of RAM across the cluster. Please be sure you have sufficient free memory before proceeding.
    21   * Install [Vagrant v1.6.5+](http://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
    22  
    23  Note for Ubuntu users: the VirtualBox package in Ubuntu (as of the last known release for 14.04) has some issues when running in RAM-constrained environments. Please install the latest version of VirtualBox from Oracle's website.
    24  
    25  ## Configure Discovery
    26  
    27  Each time you spin up a new CoreOS cluster, you **must** provide a new [discovery service URL](https://coreos.com/docs/cluster-management/setup/cluster-discovery/) in the [CoreOS user-data](https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/) file.  This URL allows hosts to find each other and perform leader election.
    28  
    29  Automatically generate a fresh discovery URL with:
    30  
    31  ```console
    32  $ make discovery-url
    33  ```
    34  
    35  or manually edit [contrib/coreos/user-data](contrib/coreos/user-data) and add a unique discovery URL generated from <https://discovery.etcd.io/new>.
    36  
    37  ## Boot CoreOS
    38  
    39  Start the CoreOS cluster on VirtualBox. From a command prompt, `cd` to the root of the Deis project code and type:
    40  
    41  ```console
    42  $ export DEIS_NUM_INSTANCES=3
    43  $ vagrant up
    44  ```
    45  
    46  This instructs Vagrant to spin up 3 VMs. To be able to connect to the VMs, you must add your Vagrant-generated SSH key to the ssh-agent (`deisctl` requires the agent to have this key):
    47  
    48  ```console
    49  $ ssh-add ~/.vagrant.d/insecure_private_key
    50  ```
    51  
    52  ## Provision Deis
    53  
    54  Install the [deisctl utility](deisctl#installation) used to provision and operate Deis.
    55  
    56  ```console
    57  $ curl -sSL http://deis.io/deisctl/install.sh | sh
    58  ```
    59  
    60  Export `DEISCTL_TUNNEL` so you can connect to one of the VMs using the `deisctl` client on your workstation.
    61  
    62  ```console
    63  $ export DEISCTL_TUNNEL=172.17.8.100
    64  ```
    65  
    66  Use `deisctl install platform` to install all Deis components across the cluster, then `deisctl start platform` to start them.
    67  
    68  ```console
    69  $ deisctl install platform
    70  $ deisctl start platform
    71  ```
    72  
    73  This can take some time - the **builder** and **registry** components must download and install the beefy Heroku cedar stack.  Grab some more coffee!
    74  
    75  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/).
    76  
    77  ## Install the Deis Client
    78  
    79  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).
    80  
    81  If you're working off master, precompiled binaries are likely out of date. You should either symlink the python file directly or build a local copy of the client:
    82  
    83  ```console
    84  $ sudo ln -fs $(pwd)/client/deis.py /usr/local/bin/deis
    85  ```
    86  or
    87  ```console
    88  $ cd client && python setup.py install
    89  ```
    90  
    91  ## Register a User
    92  
    93  Use the Deis Client to register a new user.
    94  
    95  ```console
    96  $ deis register http://deis.local3.deisapp.com
    97  $ deis keys:add
    98  ```
    99  
   100  Use `deis keys:add` to add your SSH public key for `git push` access -- normally `$HOME/.ssh/id_rsa.pub`.
   101  
   102  ## Initialize a Cluster
   103  
   104  Initialize a `dev` cluster with a list of CoreOS hosts and your CoreOS private key.
   105  
   106  ```console
   107  $ deis clusters:create dev local3.deisapp.com --hosts=172.17.8.100 --auth=~/.vagrant.d/insecure_private_key
   108  ```
   109  
   110  The parameters to `deis clusters:create` are:
   111  * cluster name (`dev`) - the name used by Deis to reference the cluster
   112  * cluster hostname (`local.3deisapp.com`) - the hostname under which apps are created, like `balancing-giraffe.local3.deisapp.com`
   113  * 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`)
   114  * 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`)
   115  
   116  The `dev` cluster will be used as the default cluster for future `deis` commands.
   117  
   118  # Usage
   119  
   120  Deis supports 3 deployment workflows:
   121  
   122   * Heroku Buildpacks via `git push` -- Learn more about [Using Buildpacks](http://docs.deis.io/en/latest/using_deis/using-buildpacks/)
   123   * Dockerfiles via `git push` -- Learn more about [Using Dockerfiles](http://docs.deis.io/en/latest/using_deis/using-dockerfiles/)
   124   * Docker Images via `deis pull` -- Learn more about [Using Docker Images](http://docs.deis.io/en/latest/using_deis/using-docker-images/)
   125  
   126  As an example, we will walk through deploying a Ruby application using the Heroku Buildpack workflow.
   127  
   128  ## Prepare an Application
   129  Clone an example Ruby application:
   130  
   131  ```console
   132  $ git clone https://github.com/deis/example-ruby-sinatra.git
   133  $ cd example-ruby-sinatra
   134  ```
   135  
   136  ## Create an Application
   137  From within the application directory, create an application on Deis:
   138  
   139  ```console
   140  $ cd example-ruby-sinatra
   141  $ deis create
   142  ```
   143  
   144  Use `deis create --cluster=prod` to place the app on a different cluster.  Don't like our name-generator?  Use `deis create myappname`.
   145  
   146  ## Deploy
   147  When you created the application, a git remote for Deis was added automatically.  Deploy with `git push`.
   148  
   149  ```console
   150  $ git push deis master
   151  ```
   152  This will use the Deis builder to package your application as a Docker Image and automatically deploy it to the platform.
   153  Each build creates a new release, which can be rolled back.
   154  
   155  ## Configure
   156  Configure your application with environment variables.  Each config change also creates a new release.
   157  
   158  ```console
   159  $ deis config:set DATABASE_URL=postgres://
   160  ```
   161  
   162  ## Test
   163  Test the application by running your test suite inside an ephemeral Docker container.
   164  
   165  ```console
   166  $ deis run make test
   167  ```
   168  
   169  Use the return code to integrate with a CI system.
   170  
   171  ## Scale
   172  Scale containers horizontally with ease.
   173  
   174  ```console
   175  $ deis scale web=8
   176  ```
   177  
   178  ## Debug
   179  Access to aggregated logs makes it easy to troubleshoot problems with your application.
   180  
   181  ```console
   182  $ deis logs
   183  ```
   184  
   185  Use `deis run` to execute one-off commands and explore the deployed container.
   186  
   187  ## Testing the cluster
   188  
   189  Integration tests and corresponding documentation can be found under the [`tests/`](tests/) folder.
   190  
   191  ## Hacking on Deis
   192  
   193  Learn how to [hack on Deis](http://docs.deis.io/en/latest/contributing/hacking/) with a Docker-based development workflow.
   194  
   195  ## Troubleshooting
   196  
   197  Common issues that users have run into when provisioning Deis are detailed below.
   198  
   199  #### When running a `deisctl` command - 'Failed initializing SSH client: ssh: handshake failed: ssh: unable to authenticate'
   200  Did you remember to add your SSH key to the ssh-agent? `ssh-add -L` should list the key you used to provision the servers. If it's not there, `ssh-add -K /path/to/your/key`.
   201  
   202  #### When running a `deisctl` command - 'All the given peers are not reachable (Tried to connect to each peer twice and failed)'
   203  The most common cause of this issue is that a [new discovery URL](https://discovery.etcd.io/new) wasn't generated and updated in [contrib/coreos/user-data](contrib/coreos/user-data) before the cluster was launched. Each Deis cluster must have a unique discovery URL, else there will be entries for old hosts that etcd will try and fail to connect to. Try destroying and relaunching the cluster with a fresh discovery URL.
   204  
   205  #### Scaling an app doesn't work, and/or the app shows 'Welcome to nginx!'
   206  This usually means the controller failed to submit jobs to the scheduler. `deisctl journal controller` will show detailed error information, but the most common cause of this is that the cluster was created with the wrong SSH key for the `--auth` parameter. The key supplied with the `--auth` parameter must be the same key that was used to provision the Deis servers. If you suspect this to be the issue, you'll need to `clusters:destroy` the cluster and recreate it, along with the app.
   207  
   208  #### A Deis component fails to start
   209  Use `deisctl status <component>` to view the status of the component.  You can also use `deisctl journal <component>` to tail logs for a component, or `deisctl list` to list all components.
   210  
   211  The most common cause of services failing to start are sporadic issues with Docker Hub.  We are exploring workarounds and are working with the Docker team to improve Docker Hub reliability. In the meantime, try starting the service again with `deisctl restart <component>`.
   212  
   213  ### Any other issues
   214  Running into something not detailed here? Please [open an issue](https://github.com/deis/deis/issues/new) or hop into [#deis](https://botbot.me/freenode/deis/) and we'll help!
   215  
   216  ## License
   217  
   218  Copyright 2014, OpDemand LLC
   219  
   220  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
   221  
   222  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.