Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !172

Improve heroku deploy workflow

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge gw-subdir into master Nov 06, 2015
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 11

Created by: gracewashere

Problem:

With the git subtree strategy adopted in #144, there are several unconventional things surrounding the heroku deploy process:

  • Pushing to heroku requires a git subtree command
  • We need special logic in the Gemfile in order to run the demo app locally with our local version of Administrate.
  • rake and rails commands need to be run from the spec/example_app subdirectory.

In addition, there is a dependency problem between the example app and the master branch of administrate on github. The example app needs to pull the master branch as a dependency on heroku, but the Gemfile.lock locks it in to a specific version.

It is impossible to point the Gemfile.lock at the repo's current commit, because that would require a new commit before we could deploy to Heroku.

The result would be that the branch on Heroku would always differ from the branch on GitHub by at least one commit, and we would need to develop special tooling around pushing to heroku.

Solution:

Make the rails, rake, and bundle exec commands work from the root directory of the repository. This involved:

  • Move the config.ru script to the root of the repo
  • Update rake and rails binstubs to reference nested rails app
  • Move unicorn.rb (required by Procfile) to top-level config dir
  • Combine both Gemfiles into a single one, at the root of the repo
  • Remove spring for simplicity

I tested the following tasks. All work from the root directory of the repo:

  • deploy to heroku: git push heroku master
  • run server locally: rails server or foreman start
  • seed demo database: rake db:seed
  • migrate demo database: rake db:migrate
  • reset demo database: rake db:drop db:create
  • run rails generators:
    • rails generate administrate:field FooBar
    • I was pleasantly surprised that this placed the files in the correct spec/example_app subdirectory
  • access demo app console:: rails console
  • view demo app routes: rake routes
  • appraisal test suite: bundle exec appraisal rake

References:

http://stackoverflow.com/questions/3081699/deploy-a-subdirectory-to-heroku

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gw-subdir