|
1 | 1 | # Stairstep |
2 | 2 |
|
3 | | -Deploying |
| 3 | +📶 Stairstep is a Ruby gem that simplifies the process of deploying Rails applications to Heroku. It provides a streamlined workflow for deploying and promoting applications across different Heroku environments. |
4 | 4 |
|
5 | | -## License |
| 5 | +### Table of Contents |
6 | 6 |
|
7 | | -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). |
| 7 | +- [Setup](#setup) |
| 8 | + - [Prerequisites](#prerequisites) |
| 9 | + - [Installation](#installation) |
| 10 | + - [Configuration](#configuration) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Code of Conduct](#code-of-conduct) |
| 13 | +- [License](#license) |
| 14 | + |
| 15 | +## Setup |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +Before installing Stairstep, ensure you have: |
| 20 | + |
| 21 | +1. Ruby 3.2.0 or higher installed |
| 22 | +2. Git installed and configured |
| 23 | +3. Heroku CLI installed and authenticated (`heroku login`) |
| 24 | +4. Heroku Builds plugin* installed: `heroku plugins:install @heroku-cli/heroku-builds` |
| 25 | +5. A Rails application with a Git repository |
| 26 | +6. Heroku applications and pipeline set up |
| 27 | + |
| 28 | +### Installation |
| 29 | + |
| 30 | +Add this line to your application's Gemfile: |
| 31 | + |
| 32 | +```ruby |
| 33 | +gem 'stairstep' |
| 34 | +``` |
| 35 | + |
| 36 | +And then execute: |
| 37 | + |
| 38 | +```bash |
| 39 | +$ bundle install |
| 40 | +``` |
| 41 | + |
| 42 | +Or install it yourself as: |
| 43 | + |
| 44 | +```bash |
| 45 | +$ gem install stairstep |
| 46 | +``` |
| 47 | + |
| 48 | +### Configuration |
| 49 | + |
| 50 | +You may add an **optional** `stairstep.yml` file in the application's `config/` directory to customize Stairstep's behavior. |
| 51 | + |
| 52 | +#### Pipeline name |
8 | 53 |
|
9 | | -## Configuration |
| 54 | +You may optionally specify the name of the pipeline for deploys. By default, this is the name of the GitHub repository. |
10 | 55 |
|
11 | | -You may add an optional `stairstep.yml` file in the application's config directory. |
| 56 | +#### App names |
12 | 57 |
|
13 | | -### Pipeline name |
14 | | -You may optionally specify the name of the pipeline for deploys (see example). This will default to the name of the GitHub repository. |
| 58 | +You may optionally specify app names per remote. This will default to the hyphenated combination of the pipeline name and the remote name (e.g. syrup-demo). |
15 | 59 |
|
16 | | -### App names |
17 | | -You may optionally specify app names per remote (see example). This will default to the hyphenated combination of the pipeline name and the remote name (e.g. syrup-demo). |
| 60 | +#### Hooks |
18 | 61 |
|
19 | | -### Hooks |
20 | 62 | Top level config keys may be the name of a Heroku deploy hook. Each key within a hook is a Heroku CLI command. Each value is an array of parameters for that command. |
21 | 63 |
|
22 | 64 | - `before_deploy` Runs right before the deploy (during maintenance mode) |
23 | 65 | - `after_deploy` Runs at the very end (after maintenance mode) |
24 | 66 |
|
25 | | -### Example |
| 67 | +#### Example Configuration |
26 | 68 |
|
27 | 69 | ```yaml |
28 | 70 | --- |
29 | 71 | pipeline: wibble-wobble |
30 | 72 |
|
31 | 73 | demo: |
32 | 74 | app: wib-wob-demo |
| 75 | +staging: |
| 76 | + app: wib-wob-staging |
33 | 77 | production: |
34 | 78 | app: wibble-wobble-prod |
35 | 79 | before_deploy: |
36 | 80 | config:unset: |
37 | 81 | - MINOR_VERSION |
| 82 | + config:set: |
| 83 | + - DEPLOY_TIME=`date +%s` |
38 | 84 | after_deploy: |
39 | 85 | run: |
40 | 86 | - rails pusher:new_release rollbar:source_maps |
| 87 | + - rails db:seed:static |
41 | 88 | ``` |
42 | 89 |
|
| 90 | +## Usage |
| 91 | +
|
| 92 | +Stairstep provides two main commands: `deploy` and `promote`. |
| 93 | + |
| 94 | +For information on available commands and options, use: |
| 95 | + |
| 96 | +```bash |
| 97 | +$ stairstep --help |
| 98 | +$ stairstep deploy --help |
| 99 | +$ stairstep promote --help |
| 100 | +``` |
| 101 | + |
| 102 | +### Deploying to an Environment |
| 103 | + |
| 104 | +To deploy your application to a specific Heroku environment: |
| 105 | + |
| 106 | +```bash |
| 107 | +$ stairstep deploy ENVIRONMENT [options] |
| 108 | +``` |
| 109 | + |
| 110 | +For detailed `deploy` documentation, [see here](https://srpatx.atlassian.net/wiki/external/YjgzYzU0N2Q3OWYwNDMwNzgyODVlZTVmNjRmNDM1Zjk#deploy). |
| 111 | + |
| 112 | +### Promoting Between Environments |
| 113 | + |
| 114 | +To promote your application from one environment to another: |
| 115 | + |
| 116 | +```bash |
| 117 | +$ stairstep promote ENVIRONMENT [options] |
| 118 | +``` |
| 119 | + |
| 120 | +For detailed `promote` documentation, [see here](https://srpatx.atlassian.net/wiki/external/YjgzYzU0N2Q3OWYwNDMwNzgyODVlZTVmNjRmNDM1Zjk#promote). |
43 | 121 |
|
44 | 122 | ## Code of Conduct |
45 | 123 |
|
46 | 124 | Everyone interacting in the Stairstep project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](./CODE_OF_CONDUCT.md). |
47 | 125 |
|
| 126 | +## License |
| 127 | + |
| 128 | +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). |
| 129 | + |
0 commit comments