github.com/greenboxal/deis@v1.12.1/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 Running `ls -l`... 50 51 total 28 52 -rw-r--r-- 1 root root 553 Dec 2 23:59 LICENSE 53 -rw-r--r-- 1 root root 60 Dec 2 23:59 Procfile 54 -rw-r--r-- 1 root root 33 Dec 2 23:59 README.md 55 -rw-r--r-- 1 root root 1622 Dec 2 23:59 pom.xml 56 drwxr-xr-x 3 root root 4096 Dec 2 23:59 src 57 -rw-r--r-- 1 root root 25 Dec 2 23:59 system.properties 58 drwxr-xr-x 6 root root 4096 Dec 3 00:00 target 59 60 Share the Application 61 --------------------- 62 Use ``deis perms:create`` to allow another Deis user to collaborate on your application. 63 64 .. code-block:: console 65 66 $ deis perms:create otheruser 67 Adding otheruser to peachy-waxworks collaborators... done 68 69 Use ``deis perms`` to see who an application is currently shared with, and 70 ``deis perms:remove`` to remove a collaborator. 71 72 .. note:: 73 Collaborators can do anything with an application that its owner can do, 74 except delete the application itself. 75 76 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. 77 78 .. code-block:: console 79 80 $ git clone https://github.com/deis/example-java-jetty.git 81 Cloning into 'example-java-jetty'... done 82 $ cd example-java-jetty 83 $ git remote add -f deis ssh://git@local3.deisapp.com:2222/peachy-waxworks.git 84 Updating deis 85 From deis-controller.local:peachy-waxworks 86 * [new branch] master -> deis/master 87 88 Troubleshoot the Application 89 ---------------------------- 90 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. 91 92 Use ``deis logs`` to view the log output from your deployed application. 93 94 .. code-block:: console 95 96 $ deis logs | tail 97 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.5]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 98 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejs.Server:jetty-7.6.0.v20120127 99 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.5]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10005 100 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.6]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 101 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.7]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 102 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.6]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10006 103 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 104 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.7]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10007 105 Dec 3 00:30:31 ip-10-250-15-201 peachy-waxworks[web.8]: INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:10008 106 107 Limit the Application 108 --------------------- 109 Deis supports restricting memory and CPU shares of each :ref:`Container`. 110 111 Use ``deis limits:set`` to restrict memory by process type: 112 113 .. code-block:: console 114 115 $ deis limits:set web=512M 116 Applying limits... done, v3 117 118 === peachy-waxworks Limits 119 120 --- Memory 121 web 512M 122 123 --- CPU 124 Unlimited 125 126 You can also use ``deis limits:set -c`` to restrict CPU shares. 127 CPU shares are on a scale of 0 to 1024, with 1024 being all CPU resources on the host. 128 129 .. important:: 130 131 If you restrict resources to the point where containers do not start, 132 the limits:set command will hang. If this happens, use CTRL-C 133 to break out of limits:set and use limits:unset to revert. 134 135 Isolate the Application 136 ----------------------- 137 Deis supports isolating applications onto a set of hosts using ``tags``. 138 139 .. note:: 140 141 In order to use tags, you must first launch your hosts with 142 the proper key/value tag information. If you do not, tag commands will fail. 143 Learn more by reading the `machine metadata`_ section of Fleet documentation. 144 145 Once your hosts are configured with appropriate key/value metadata, use 146 ``deis tags:set`` to restrict the application to those hosts: 147 148 .. code-block:: console 149 150 $ deis tags:set environ=prod 151 Applying tags... done, v4 152 153 environ prod 154 155 .. _`store config in environment variables`: http://12factor.net/config 156 .. _`decoupled from the application`: http://12factor.net/backing-services 157 .. _`scale out via the process model`: http://12factor.net/concurrency 158 .. _`treat logs as event streams`: http://12factor.net/logs 159 .. _`use one-off processes for admin tasks`: http://12factor.net/admin-processes 160 .. _`Procfile`: http://ddollar.github.io/foreman/#PROCFILE 161 .. _`machine metadata`: https://coreos.com/docs/launching-containers/launching/fleet-unit-files/#user-defined-requirements