Running Fastlane Boarding on Dokku


#1

Boarding is a Ruby on Rails app for setting up a TestFlight sign-up page for your app. It’s part of the excellent set of Fastlane tools created by Felix Krause

While Boarding is set up for easy deployment to Heroku, you can also deploy it to any Dokku instance as Dokku supports Heroku buildpacks:

  1. Make sure you have Dokku installed (e.g., on a regular OpenStack server from CloudScale)

  2. Clone Boarding:
    git clone https://github.com/fastlane/boarding.git

  3. Add your Dokku remote to your working copy:
    git remote add live dokku@<your-doma.in>:<name-of-app>
    (Where <name-of-app> is the subdomain you want to access Boarding from (e.g., dokku@ind.ie:boarding if you want to access it from boarding.ind.ie)

  4. Push to live:
    git push live master

That will deploy the app on your server.

However, if you simply hit the URL (e.g., boarding.ind.ie) in your browser, you will see the following error in the HTML:

We’re sorry, but something went wrong. If you are the application owner check the logs for more information.

That’s because Boarding relies on certain environment variables to be set and you haven’t configured it yet. (This is the additional bit of work you need to do that the Heroku web installer handles conveniently via a Web UI.)

To fix this, ssh into your server and add the environment variables using Dokku:

dokku config:set <name-of-your-app> FASTLANE_USER=<your-itunes-connect-username> FASTLANE_PASSWORD=<your-iTunes-Connect-password> ITC_APP_ID=<the-Apple-ID-from-iTunes-Connect-for-your-app>

And that’s it!

Dokku will re-deploy your app and you should see the beta sign-up page when you hit it in the browser.

To serve Boarding from a non-root URL

To serve Boarding from a non-root URL(e.g., using an nginx reverse-proxy via a URL like https://ind.ie/betas/boarding, you have to make a tiny change to the source to make the submit route on the ‘Get Beta Access’ button relative. Until my pull request is merged, the easiest way to do this is to clone my fork of Boarding.

Then, add the following environment variable to your app:

dokku config:set <name-of-your-app> RAILS_RELATIVE_URL_ROOT=<base-url-your-app-will-be-served-from-if-not-served-from-root>

Possible errors

Here are a couple of things that could go wrong. Documented here so search engines can spider the errors to make it easier for people to find this article who may have run into them:

Buildpack error.

-----> Compiling Ruby/Rails
!
! Command: ‘set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 5 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/ruby-2.2.3.tgz -s -o - | tar zxf -’ failed unexpectedly:
!
! gzip: stdin: unexpected end of file
! tar: Child returned status 1
! tar: Error is not recoverable: exiting now
!

(Source)

Fix

Upgrade your buildpack:

git clone https://github.com/progrium/buildstep.git
cd buildstep
git pull origin master
sudo make build

(Source)

Unspecified credentials error

Processing by InviteController#index as HTML


The login information you enter will be stored in your Mac OS Keychain
You can also pass the password using the FASTLANE_PASSWORD env variable
More information about it on GitHub: https://github.com/fastlane/credentials_manager


Username: Completed 500 Internal Server Error in 10ms

EOFError (The input stream is exhausted.):
app/controllers/invite_controller.rb:140:in login' app/controllers/invite_controller.rb:120:inapp’
app/controllers/invite_controller.rb:132:in block in app_metadata' app/controllers/invite_controller.rb:130:inapp_metadata’
app/controllers/invite_controller.rb:145:in `set_app_details’

Fix

dokku config:set <name-of-your-app> FASTLANE_USER=<username> FASTLANE_PASSWORD=<password>

No ITC_APP_ID Error

Processing by InviteController#index as HTML
No app to add this tester to provided, use the ITC_APP_ID environment variable
Completed 500 Internal Server Error in 2356ms

NoMethodError (undefined method include?' for nil:NilClass): app/controllers/invite_controller.rb:109:inblock in apple_id’
app/controllers/invite_controller.rb:108:in apple_id' app/controllers/invite_controller.rb:124:inapp’
app/controllers/invite_controller.rb:132:in block in app_metadata' app/controllers/invite_controller.rb:130:inapp_metadata’
app/controllers/invite_controller.rb:145:in `set_app_details’

Fix

dokku config:set <name-of-your-app> ITC_APP_ID=<the-Apple-ID-from-iTunes-Connect-for-your-app>