github.com/inflatablewoman/deis@v1.0.1-0.20141111034523-a4511c46a6ce/docs/using_deis/manage-application.rst (about) 1 :title: Manage an Application on Deis 2 :description: First steps for developers using Deis to deploy and scale applications. 3 4 .. _manage-application: 5 6 Manage an Application 7 ===================== 8 Deis includes many tools for managing deployed :ref:`Applications <application>`. 9 10 Scale the Application 11 --------------------- 12 Applications deployed on Deis `scale out via the process model`_. 13 Use ``deis scale`` to control the number of :ref:`Containers <container>` that power your app. 14 15 .. code-block:: console 16 17 $ deis scale web=8 18 Scaling processes... but first, coffee! 19 done in 20s 20 21 === peachy-waxworks Processes 22 23 --- web: 24 web.1 up (v2) 25 web.2 up (v2) 26 web.3 up (v2) 27 web.4 up (v2) 28 web.5 up (v2) 29 web.6 up (v2) 30 web.7 up (v2) 31 web.8 up (v2) 32 33 Scaling is managed by process types like ``web`` or ``worker`` defined in a 34 `Procfile`_ in the root of your application repository. 35 36 .. note:: 37 38 Docker applications can use the ``cmd`` process type to scale the default container command. 39 40 Administer the Application 41 -------------------------- 42 Deis applications `use one-off processes for admin tasks`_ like database migrations and other commands that must run against the live application. 43 44 Use ``deis run`` to execute commands on the deployed application. 45 46 .. code-block:: console 47 48 $ deis run ls -l 49 total 28 50 -rw-r--r-- 1 root root 553 Dec 2 23:59 LICENSE 51 -rw-r--r-- 1 root root 60 Dec 2 23:59 Procfile 52 -rw-r--r-- 1 root root 33 Dec 2 23:59 README.md 53 -rw-r--r-- 1 root root 1622 Dec 2 23:59 pom.xml 54 drwxr-xr-x 3 root root 4096 Dec 2 23:59 src 55 -rw-r--r-- 1 root root 25 Dec 2 23:59 system.properties 56 drwxr-xr-x 6 root root 4096 Dec 3 00:00 target 57 58 Share the Application 59 --------------------- 60 Use ``deis sharing:add`` to allow another Deis user to collaborate on your application. 61 62 .. code-block:: console 63 64 $ deis sharing:add otheruser 65 Adding otheruser to peachy-waxworks collaborators... done 66 67 Use ``deis sharing`` to see who an application is currently shared with, and 68 ``deis sharing:remove`` to remove a collaborator. 69 70 .. note:: 71 Collaborators can do anything with an application that its owner can do, 72 except delete the application itself. 73 74 When working with an application that has been shared with you, clone the original repository and add Deis' git remote entry before attempting to ``git push`` any changes to Deis. 75 76 .. code-block:: console 77 78 $ git clone https://github.com/deis/example-java-jetty.git 79 Cloning into 'example-java-jetty'... done 80 $ cd example-java-jetty 81 $ git remote add -f deis ssh://git@local.deisapp.com:2222/peachy-waxworks.git 82 Updating deis 83 From deis-controller.local:peachy-waxworks 84 * [new branch] master -> deis/master 85 86 Troubleshoot the Application 87 ---------------------------- 88 Applications deployed on Deis `treat logs as event streams`_. Deis aggregates ``stdout`` and ``stderr`` from every :ref:`Container` making it easy to troubleshoot problems with your application. 89 90 Use ``deis logs`` to view the log output from your deployed application. 91 92 .. code-block:: console 93 94 $ deis logs | tail 95 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.5]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 96 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejs.Server:jetty-7.6.0.v20120127 97 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.5]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10005 98 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.6]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 99 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.7]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 100 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.6]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10006 101 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 102 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.7]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10007 103 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10008 104 105 Limit the Application 106 --------------------- 107 Deis supports restricting memory and CPU shares of each :ref:`Container`. 108 109 Use ``deis limits:set`` to restrict memory by process type: 110 111 .. code-block:: console 112 113 $ deis limits:set web=512M 114 Applying limits... done, v3 115 116 === peachy-waxworks Limits 117 118 --- Memory 119 web 512M 120 121 --- CPU 122 Unlimited 123 124 You can also use ``deis limits:set -c`` to restrict CPU shares. 125 CPU shares are on a scale of 0 to 1024, with 1024 being all CPU resources on the host. 126 127 .. important:: 128 129 If you restrict resources to the point where containers do not start, 130 the limits:set command will hang. If this happens, use CTRL-C 131 to break out of limits:set and use limits:unset to revert. 132 133 Isolate the Application 134 ----------------------- 135 Deis supports isolating applications onto a set of hosts using ``tags``. 136 137 .. note:: 138 139 In order to use tags, you must first launch your hosts with 140 the proper key/value tag information. If you do not, tag commands will fail. 141 Learn more by reading the `machine metadata`_ section of Fleet documentation. 142 143 Once your hosts are configured with appropriate key/value metadata, use 144 ``deis tags:set`` to restrict the application to those hosts: 145 146 .. code-block:: console 147 148 $ deis tags:set environ=prod 149 Applying tags... done, v4 150 151 environ prod 152 153 .. _`store config in environment variables`: http://12factor.net/config 154 .. _`decoupled from the application`: http://12factor.net/backing-services 155 .. _`scale out via the process model`: http://12factor.net/concurrency 156 .. _`treat logs as event streams`: http://12factor.net/logs 157 .. _`use one-off processes for admin tasks`: http://12factor.net/admin-processes 158 .. _`Procfile`: http://ddollar.github.io/foreman/#PROCFILE 159 .. _`machine metadata`: https://coreos.com/docs/launching-containers/launching/fleet-unit-files/#user-defined-requirements