github.com/deis/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/docs/using_deis/using-buildpacks.rst (about) 1 :title: Deploying with Heroku Buildpacks on Deis 2 :description: How to deploy applications on Deis using Heroku Buildpacks 3 4 .. _using-buildpacks: 5 6 Using Buildpacks 7 ================ 8 Deis supports deploying applications via `Heroku Buildpacks`_. 9 Buildpacks are useful if you're interested in following Heroku's best practices for building applications or if you are deploying an application that already runs on Heroku. 10 11 Prepare an Application 12 ---------------------- 13 If you do not have an existing application, you can clone an example application that demonstrates the Heroku Buildpack workflow. 14 15 .. code-block:: console 16 17 $ git clone https://github.com/deis/example-ruby-sinatra.git 18 $ cd example-ruby-sinatra 19 20 Create an Application 21 --------------------- 22 Use ``deis create`` to create an application on the :ref:`controller`. 23 24 .. code-block:: console 25 26 $ deis create 27 Creating application... done, created unisex-huntress 28 Git remote deis added 29 30 Push to Deploy 31 -------------- 32 Use ``git push deis master`` to deploy your application. 33 34 .. code-block:: console 35 36 $ git push deis master 37 Counting objects: 95, done. 38 Delta compression using up to 8 threads. 39 Compressing objects: 100% (52/52), done. 40 Writing objects: 100% (95/95), 20.24 KiB | 0 bytes/s, done. 41 Total 95 (delta 41), reused 85 (delta 37) 42 -----> Ruby app detected 43 -----> Compiling Ruby/Rack 44 -----> Using Ruby version: ruby-1.9.3 45 -----> Installing dependencies using 1.5.2 46 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 47 Fetching gem metadata from http://rubygems.org/.......... 48 Fetching additional metadata from http://rubygems.org/.. 49 Using bundler (1.5.2) 50 Installing tilt (1.3.6) 51 Installing rack (1.5.2) 52 Installing rack-protection (1.5.0) 53 Installing sinatra (1.4.2) 54 Your bundle is complete! 55 Gems in the groups development and test were not installed. 56 It was installed into ./vendor/bundle 57 Bundle completed (8.81s) 58 Cleaning up the bundler cache. 59 -----> Discovering process types 60 Procfile declares types -> web 61 Default process types for Ruby -> rake, console, web 62 -----> Compiled slug size is 12M 63 -----> Building Docker image 64 Uploading context 11.81 MB 65 Uploading context 66 Step 0 : FROM deis/slugrunner 67 ---> 5567a808891d 68 Step 1 : RUN mkdir -p /app 69 ---> Running in a4f8e66a79c1 70 ---> 5c07e1778b9e 71 Removing intermediate container a4f8e66a79c1 72 Step 2 : ADD slug.tgz /app 73 ---> 52d48b1692e5 74 Removing intermediate container e9dfce920e26 75 Step 3 : ENTRYPOINT ["/runner/init"] 76 ---> Running in 7a8416bce1f2 77 ---> 4a18f93f1779 78 Removing intermediate container 7a8416bce1f2 79 Successfully built 4a18f93f1779 80 -----> Pushing image to private registry 81 82 Launching... done, v2 83 84 -----> unisex-huntress deployed to Deis 85 http://unisex-huntress.local3.deisapp.com 86 87 To learn more, use `deis help` or visit http://deis.io 88 89 To ssh://git@local3.deisapp.com:2222/unisex-huntress.git 90 * [new branch] master -> master 91 92 $ curl -s http://unisex-huntress.local3.deisapp.com 93 Powered by Deis! 94 95 Because a Heroku-style application is detected, the ``web`` process type is automatically scaled to 1 on first deploy. 96 97 Use ``deis scale web=3`` to increase ``web`` processes to 3, for example. Scaling a 98 process type directly changes the number of :ref:`Containers <container>` 99 running that process. 100 101 Included Buildpacks 102 ------------------- 103 For convenience, a number of buildpacks come bundled with Deis: 104 105 * `Ruby Buildpack`_ 106 * `Nodejs Buildpack`_ 107 * `Java Buildpack`_ 108 * `Gradle Buildpack`_ 109 * `Grails Buildpack`_ 110 * `Play Buildpack`_ 111 * `Python Buildpack`_ 112 * `PHP Buildpack`_ 113 * `Clojure Buildpack`_ 114 * `Scala Buildpack`_ 115 * `Go Buildpack`_ 116 * `Multi Buildpack`_ 117 118 Deis will cycle through the ``bin/detect`` script of each buildpack to match the code you 119 are pushing. 120 121 .. note:: 122 123 If you're testing against the `Scala Buildpack`_, the :ref:`Builder` requires at least 124 512MB of free memory to execute the Scala Build Tool. 125 126 Using a Custom Buildpack 127 ------------------------ 128 To use a custom buildpack, set the ``BUILDPACK_URL`` environment variable. 129 130 .. code-block:: console 131 132 $ deis config:set BUILDPACK_URL=https://github.com/dpiddy/heroku-buildpack-ruby-minimal 133 Creating config... done, v2 134 135 === humble-autoharp 136 BUILDPACK_URL: https://github.com/dpiddy/heroku-buildpack-ruby-minimal 137 138 .. note:: 139 140 If, however, you're unable to deploy using the latest version of the buildpack, 141 You can set 142 an exact version of a buildpack by using a git revision in your 143 ``BUILDPACK_URL``. 144 For example: ``BUILDPACK_URL=https://github.com/dpiddy/heroku-buildpack-ruby-minimal#v13`` 145 146 On your next ``git push``, the custom buildpack will be used. 147 148 Using Private Repositories 149 -------------------------- 150 To pull code from private repositories, set the ``SSH_KEY`` environment variable to a private key 151 which has access. Use either the path of a private key file or the raw key material: 152 153 .. code-block:: console 154 155 $ deis config:set SSH_KEY=/home/user/.ssh/id_rsa 156 $ deis config:set SSH_KEY="""-----BEGIN RSA PRIVATE KEY----- 157 (...) 158 -----END RSA PRIVATE KEY-----""" 159 160 For example, to use a custom buildpack hosted at a private GitHub URL, ensure that an SSH public 161 key exists in your `GitHub settings`_. Then set ``SSH_KEY`` to the corresponding SSH private key 162 and set ``BUILDPACK_URL`` to the URL: 163 164 .. code-block:: console 165 166 $ deis config:set SSH_KEY=/home/user/.ssh/github_id_rsa 167 $ deis config:set BUILDPACK_URL=git@github.com:user/private_buildpack.git 168 $ git push deis master 169 170 171 .. _`Ruby Buildpack`: https://github.com/heroku/heroku-buildpack-ruby 172 .. _`Nodejs Buildpack`: https://github.com/heroku/heroku-buildpack-nodejs 173 .. _`Java Buildpack`: https://github.com/heroku/heroku-buildpack-java 174 .. _`Gradle Buildpack`: https://github.com/heroku/heroku-buildpack-gradle 175 .. _`Grails Buildpack`: https://github.com/heroku/heroku-buildpack-grails 176 .. _`Play Buildpack`: https://github.com/heroku/heroku-buildpack-play 177 .. _`Python Buildpack`: https://github.com/heroku/heroku-buildpack-python 178 .. _`PHP Buildpack`: https://github.com/heroku/heroku-buildpack-php 179 .. _`Clojure Buildpack`: https://github.com/heroku/heroku-buildpack-clojure 180 .. _`Scala Buildpack`: https://github.com/heroku/heroku-buildpack-scala 181 .. _`Go Buildpack`: https://github.com/kr/heroku-buildpack-go 182 .. _`Multi Buildpack`: https://github.com/heroku/heroku-buildpack-multi 183 .. _`Heroku Buildpacks`: https://devcenter.heroku.com/articles/buildpacks 184 .. _`GitHub settings`: https://github.com/settings/ssh