Skip to content

Commit

Permalink
add : Dokku deployment environment + instructions
Browse files Browse the repository at this point in the history
This implements small and basic changes to deploy frab with Dokku.
  • Loading branch information
almereyda committed Oct 14, 2015
1 parent 038ce32 commit f03f6be
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'https://rubygems.org'
ruby '2.2.3'

gem 'rails', '~> 4.2'

Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec rails server -p $PORT -e $RACK_ENV
72 changes: 72 additions & 0 deletions README.dokku.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Deploying Frab with Dokku

Dokku is a Platform-as-a-Service (PaaS) engine which allows for simple `git push` deployments.
It builds on Heroku's `buildpack`s and is higly customizable.

To deploy a Frab application with `dokku`, please proceed as follows:

## 1. Setting up Dokku

Given you have access to your Dokku service via a simple alias (`alias dokku='ssh -t dokku@<DOKKU_HOST>'`) and `dokku version` works, do the following:

```
dokku create <APP_NAME>
```

The `.env` environment would then look similarily to

```
SECRET_KEY_BASE=<should_be_longer_than_32_chars, 'pwgen 32' suffices>
FRAB_HOST=<APP_FQDN=APP_NAME.DOKKU_HOST>
FRAB_PROTOCOL=<http|https>
FROM_EMAIL=<sender@host.tld>
SMTP_ADDRESS=<SMTP MX>
SMTP_PORT=25
SMTP_NOTLS=<true|false>
SMTP_USER_NAME=
SMTP_PASSWORD=
BUNDLE_WITHOUT=development:test:mysql:sqlite3
RAILS_SERVE_STATIC_FILES=true
```

Pipe this configuration to dokku with

dokku config:set frab `paste -d " " -s .env`

Make sure you are using a branch which provides Ruby 2.2.3 in the `Gemfile` and the `web` process (only) in the `Procfile`.

```
dokku postgresql:create <DB_NAME>
dokku postgresql:link <APP_NAME> <DB_NAME>
```

## 2. Setting up frab

Then use the output of the second command to set up your `production` database connection in `config/database.yml`:

```
production:
adapter: postgresql
encoding: unicode
database: <DB_NAME>
username: <DB_USER>
password: <DB_PASS>
host: postgresql
pool: 5
timeout: 5000
```

and force commit this file to your git tree, until the use of a `DATABASE_URL` environment variable is implemented.

## 3. Deploying Frab

git remote add dokku dokku@<DOKKU_HOST>:<APP_NAME>
git push dokku master

After this has completed successfully, you need to manually load the database schema with

dokku run frab bundle exec rake db:setup

---

That's it. Your application should be running at `<PROTO>://<APP_NAME>.<DOKKU_HOST>`.

0 comments on commit f03f6be

Please sign in to comment.