Groundskeeper

The goal of this gem is to manage the workflow related to releasing and deploying Rails applications.

Installation

Install this gem globally via:

gem install groundskeeper-bitcore

Note: if you have multiple versions of Ruby installed (via RVM e.g.), you will need to install this gem for each of them.

Additionally, to integrate with Jira you will need to set some environment variables. One standard place to do this is in the ~/.bash_profile:

export JIRA_USERNAME="my-username"
export JIRA_API_TOKEN="my-token"
export JIRA_SITE="https://cbit123.atlassian.net"

For integration with Bitbucket, create an app password with permissions of Pull requests: Read Write:

export BITBUCKET_USERNAME="bitbucket_username"
export BITBUCKET_APP_PASSWORD="app_password"

For integration with Sentry, find or create your auth token from here with the scopes event:admin, event:read, member:read, org:read, project:read, project:releases, team:read:

export SENTRY_AUTH_TOKEN="auth-token"
export SENTRY_ORG=cbits

Then you will need to install/update the Sentry CLI.

Jira integration also depends on a repository that contains metadata for projects. Clone it as follows:

git clone git@github.com:NU-CBITS/project_details.git ~/.project_details

To integrate with Slack, set the following environment variables:

SLACK_WORKSPACE
SLACK_CHANNEL
SLACK_TOKEN

Usage

To display tag/release information about a Rails project, use the info command within a Rails application directory:

ground info

To create a new release tag, use the release command within a Rails application directory:

ground release

To prepare the server (only required the first time) for deployment, add nginx flag if deploying to nginx server:

tag=0.0.0 stage=production ground predeploy [--nginx]

To deploy the release (note that stage is optional and will be set to staging by default):

tag=0.0.0 stage=production ground deploy

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

To release a new version, update the version number in version.rb, and then run bundle exec rake release. You will then need to create a version branch release/x.x.x and push to version control. After merge checks pass merge the branch and pull changes into local master branch. Create and push the new tag git tag x.x.x and git push origin master --tags. Then if you have permissions, push the .gem file to rubygems.org with gem push <name of .gem file that is generated. The file will typically be in the format groundskeeper-bitcore-x.x.x.gem.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/NU-CBITS/groundskeeper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Groundskeeper project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Troubleshooting

If ssh connection to github requires a passphrase, this will cause issues with deployment. Add ssh-add -K ~/.ssh/id_rsa to the ~/.bash_profile to solve.