Hi everyone, today we'll learn about how to deploy Deis using Heroku Buildpacks. Deis supports deploying applications via Heroku Buildpacks. Buildpacks are useful if one is interested in following Heroku’s best practices for building applications or if we are deploying an application that already runs on Heroku. It maintains a collection of buildpacks that are available by default to all Heroku apps during slug compilation.
Here are some quick and easy steps to deploy Deis using Heroku Buildpacks. Before we start the below steps, we need to make sure that deis and git are preinstalled and configured in our machine.
1. Clonning Heroku Buildpacks
We can clone an example application that demonstrates the Heroku Buildpack workflow if we don't have an existing one. Here are some list of Buildpacks one can choose from.
- Ruby Buildpack
- Nodejs Buildpack
- Java Buildpack
- Gradle Buildpack
- Grails Buildpack
- Play Buildpack
- Python Buildpack
- PHP Buildpack
- Clojure Buildpack
- Scala Buildpack
- Go Buildpack
- Multi Buildpack
We'll go with Python Buildpack to use python on top of Deis.
$ git clone https://github.com/heroku/heroku-buildpack-python
$ cd heroku-buildpack-python
2. Creating an Application
We'll use deis create to create an application on the controller which manages applications and their containers. Controller acts as a brain of the Deis Platform.
$ deis create
3. Pushing to Deploy
After creating the application, we'll use git push deis master to deploy our application.
$ git push deis master
$ curl -s http://mydomain.com
Because a Heroku-style application is detected, the web process type is automatically scaled to 1 on first deploy.
Using a Custom Buildpack
To use a custom buildpack, we'll have to set the BUILDPACK_URL environment variable as the url for the required heroku buildpack repository. To set the variable, we'll need to run the following command.
$ deis config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python.git
Note: If we're unable to deploy using the latest version of the buildpack, we can set an exact version of a buildpack by using a git revision in the BUILDPACK_URL. Here, below is the command to set the version 57.
$ deis config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python#57
Then, on our next git push, the custom buildpack will be used.
If everything went cool, you have successfully deployed Deis using Heroku Buildpacks. To build the Buildpacks we should make sure that that the application follows Heroku's practices. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)
You might also like