drie documentation

Welcome to the drie documentation. You'll find comprehensive guides and documentation to help you start working with drie as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Support

Creating an app

To get started on drie you need to create an app and commit it to a GitHub repository. drie works by taking your source code from your account on GitHub.com and building it in your AWS account.

We will use Ruby on Rails to demonstrate the process. Start by creating a new rails app; you can see this app on drie's demo account on GitHub.

If you don't have rails installed or would like to skip a few steps you can do the following:

git clone https://github.com/drie-demo-1/drie-rails-starter-app.git
cd drie-rails-starter-app

Create a rails app from scratch

Follow these steps if you'd like the full experience of creating an app from scratch. The following command will create a rails app that uses postgres as the backing database:

$ rails new my-rails-app -d postgresql
$ cd my-rails-app

Now we need to make this a git repo:

$ git init
Initialized empty Git repository in /Users/drie/demo-rails-app/.git/

drie works by building your code from a repo the GitHub account you installed the drie integration on. To create a repo on GitHub follow these instructions: github.
Then add that repo as a remote for your app:

git remote add origin git@github.com:example/demo-rails-app.git

From rails 5.x you need to add in routes to your application for new pages. We can use the rails generate command.

rails generate controller Hello drie

Adding a buildpack

drie apps need a buildpack in a repo before they can be deployed. This tell drie how to build your application. They’re in an industry standard format and you can make your own, but here are some examples of buildpacks for common programming languages:

To add a buildpack to your application, in the top level of your repo create a .buildpacks file and paste the link to the buildpack as the first line. For the demo app we'll be adding the ruby buildpack:


Then push this new file to the remote repo:

git add .buildpacks
git commit -m "Adding a buildpack"
git push origin master

Adding a Procfile

You can also add a Procfile; this tells drie how to run your app. Some buildpacks (including the ruby one) will add one of these files automatically, others need one to get the app running.

For the demo app we will add the following Procfile showing that we'll use the default webrick server to run our app

web: bin/rails server -p $PORT -e $RAILS_ENV

The Procfile defines a process (web) and tells it the command it needs to run. This also demonstrates a couple of defaults. The first is the convention that all processes called “web” are added to the load balancer and can receive traffic from ${YOUR_APP_NAME}.app.drie.co. The second is that we automatically create an environment variable called $PORT which tells your app which port it should run on so that it receives the load balanced traffic.

For the demo app we've also added an envrionment variable $RAILS_ENV that we will set to tell rails which environment config we want to run with. You can see how to set this value in the Adding application config guide.

Once you have created a Procfile you need to push that to your remote repo as well:

git add Procfile
git commit -m "Adding a Procfile"
git push origin master

Apps don’t have to be limited to one process in their Procfile. You can add further processes to perform background tasks by just adding a similar line to your Procfile but giving it a different name to web. These can be scaled independently as required. Note that these other processes do not receive load balanced traffic.

Create your app on drie

Now you can add your app to the drie platform using:

$ drie app add
Question: drie needs to associate this app with a remote Git repository from
          which we can build your app.
          Would you like to use git@github.com:drie/demo-rails-app.git [Y/n]: y
Question: Are you happy to call your app demo-rails-app [Y/n]: y
Info:     Creating new app 'demo-rails-app' with remote repo
          'git@github.com:drie/demo-rails-app.git'.  This will take a
          few minutes.
Creating app |#############################################################|Time: 0:09:24
Info:     Your next step is probably to add some environment variables for
          your app using `drie app config --help` or, if your app doesn't use
          environment variables, you could jump straight to building and
          deploying your app using `drie app deploy --help`.

This command creates an isolated AWS environment for your application to be deployed in. It creates users, security keys, security groups and a load balancer, as well as booting a new VM in line with AWS security best practices.

Next step: Deploying to drie

Creating an app