Commit cbfa615d60d9294a7e3b24d4899004342949d1d2
1 parent
f391c790
Exists in
master
and in
1 other branch
create docs section for deployment info
Showing
4 changed files
with
106 additions
and
88 deletions
Show diff stats
README.md
| @@ -135,95 +135,9 @@ rake errbit:bootstrap | @@ -135,95 +135,9 @@ rake errbit:bootstrap | ||
| 135 | script/rails server | 135 | script/rails server |
| 136 | ``` | 136 | ``` |
| 137 | 137 | ||
| 138 | -Deploying: | 138 | +Deployment: |
| 139 | ---------- | 139 | ---------- |
| 140 | - | ||
| 141 | - * Copy `config/deploy.example.rb` to `config/deploy.rb` | ||
| 142 | - * Update the `deploy.rb` or `config.yml` file with information about your server | ||
| 143 | - * Setup server and deploy | ||
| 144 | - | ||
| 145 | -```bash | ||
| 146 | -cap deploy:setup deploy db:create_mongoid_indexes | ||
| 147 | -``` | ||
| 148 | - | ||
| 149 | -(Note: The capistrano deploy script will automatically generate a unique secret token.) | ||
| 150 | - | ||
| 151 | -**Deploying to Heroku:** | ||
| 152 | - | ||
| 153 | - * Clone the repository | ||
| 154 | - | ||
| 155 | -```bash | ||
| 156 | -git clone http://github.com/errbit/errbit.git | ||
| 157 | -``` | ||
| 158 | - * Update `db/seeds.rb` with admin credentials for your initial login. | ||
| 159 | - | ||
| 160 | - * Run `bundle` | ||
| 161 | - | ||
| 162 | - * Create & configure for Heroku | ||
| 163 | - | ||
| 164 | -```bash | ||
| 165 | -gem install heroku | ||
| 166 | -heroku create example-errbit | ||
| 167 | -# If you really want, you can define your stack and your buildpack. the default is good to us : | ||
| 168 | -# heroku create example-errbit --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git | ||
| 169 | -heroku addons:add mongolab:sandbox | ||
| 170 | -heroku addons:add sendgrid:starter | ||
| 171 | -heroku config:add HEROKU=true | ||
| 172 | -heroku config:add SECRET_TOKEN="$(bundle exec rake secret)" | ||
| 173 | -heroku config:add ERRBIT_HOST=some-hostname.example.com | ||
| 174 | -heroku config:add ERRBIT_EMAIL_FROM=example@example.com | ||
| 175 | -git push heroku master | ||
| 176 | -``` | ||
| 177 | - | ||
| 178 | - * Seed the DB (_NOTE_: No bootstrap task is used on Heroku!) and | ||
| 179 | - create index | ||
| 180 | - | ||
| 181 | -```bash | ||
| 182 | -heroku run rake db:seed | ||
| 183 | -heroku run rake db:mongoid:create_indexes | ||
| 184 | -``` | ||
| 185 | - | ||
| 186 | - * If you are using a free database on Heroku, you may want to periodically clear resolved errors to free up space. | ||
| 187 | - | ||
| 188 | - * With the heroku-scheduler add-on (replacement for cron): | ||
| 189 | - | ||
| 190 | - ```bash | ||
| 191 | - # Install the heroku scheduler add-on | ||
| 192 | - heroku addons:add scheduler:standard | ||
| 193 | - | ||
| 194 | - # Go open the dashboard to schedule the job. You should use | ||
| 195 | - # 'rake errbit:db:clear_resolved' as the task command, and schedule it | ||
| 196 | - # at whatever frequency you like (once/day should work great). | ||
| 197 | - heroku addons:open scheduler | ||
| 198 | - ``` | ||
| 199 | - | ||
| 200 | - * With the cron add-on: | ||
| 201 | - | ||
| 202 | - ```bash | ||
| 203 | - # Install the heroku cron addon, to clear resolved errors daily: | ||
| 204 | - heroku addons:add cron:daily | ||
| 205 | - ``` | ||
| 206 | - | ||
| 207 | - * Or clear resolved errors manually: | ||
| 208 | - | ||
| 209 | - ```bash | ||
| 210 | - heroku run rake errbit:db:clear_resolved | ||
| 211 | - ``` | ||
| 212 | - | ||
| 213 | - * You may want to enable the deployment hook for heroku : | ||
| 214 | - | ||
| 215 | -```bash | ||
| 216 | -heroku addons:add deployhooks:http --url="http://YOUR_ERRBIT_HOST/deploys.txt?api_key=YOUR_API_KEY" | ||
| 217 | -``` | ||
| 218 | - | ||
| 219 | - * You may also want to configure a different secret token for each deploy: | ||
| 220 | - | ||
| 221 | -```bash | ||
| 222 | -heroku config:add SECRET_TOKEN=some-secret-token | ||
| 223 | -``` | ||
| 224 | - | ||
| 225 | - * Enjoy! | ||
| 226 | - | 140 | +See [notes on deployment](docs/deployment.md) |
| 227 | 141 | ||
| 228 | Authentication | 142 | Authentication |
| 229 | -------------- | 143 | -------------- |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +# Deployment Notes | ||
| 2 | +There are any number of ways to deploy Errbit, but official support is limited | ||
| 3 | +to heroku and capistrano. | ||
| 4 | + | ||
| 5 | +See specific notes on deployment via: | ||
| 6 | +- [heroku](docs/deployment/heroku.md) | ||
| 7 | +- [capistrano](docs/deployment/capistrano.md) | ||
| 8 | + | ||
| 9 | +You can use a process manager to deploy Errbit, but Errbit doesn't maintain | ||
| 10 | +support for any specific process manager. But if you use systemd, @nofxx has | ||
| 11 | +been kind enough to share: | ||
| 12 | +- [systemd config](https://gist.github.com/nofxx/f01dcfe3e9d504181d76) |
| @@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
| 1 | +# Deploy with Capistrano | ||
| 2 | +These instructions should be good enough to get you started deploying | ||
| 3 | +capistrano with Errbit. More than likely, you'll have to adjust some things to | ||
| 4 | +suit your needs, so you should understand how to use capistrano before you | ||
| 5 | +continue. | ||
| 6 | + | ||
| 7 | +## Clone and prepare the source code repository | ||
| 8 | +```bash | ||
| 9 | +git clone git@github.com:errbit/errbit.git | ||
| 10 | +cd errbit | ||
| 11 | +``` | ||
| 12 | + | ||
| 13 | +- Copy `config/deploy.example.rb` to `config/deploy.rb` | ||
| 14 | +- Update the `deploy.rb` or `config.yml` file with information about your server | ||
| 15 | +- Setup server and deploy | ||
| 16 | + | ||
| 17 | +## Schedule recurring tasks | ||
| 18 | +You may want to periodically clear resolved errors to free up space. Schedule | ||
| 19 | +the ```rake errbit:db:clear_resolved``` rake task to run every day or so. |
| @@ -0,0 +1,73 @@ | @@ -0,0 +1,73 @@ | ||
| 1 | +# Deploy to Heroku | ||
| 2 | +We designed Errbit to work well with Heroku. These instructions should result | ||
| 3 | +in a working deploy, but you should modify them to suit your needs: | ||
| 4 | + | ||
| 5 | +## Clone and prepare the source code repository | ||
| 6 | +```bash | ||
| 7 | +git clone git@github.com:errbit/errbit.git | ||
| 8 | +cd errbit | ||
| 9 | +``` | ||
| 10 | + | ||
| 11 | +- Update `db/seeds.rb` with admin credentials for your initial login | ||
| 12 | + | ||
| 13 | +Commit the results: | ||
| 14 | +```bash | ||
| 15 | +git commit -m "Update db/seeds.rb with initial login" | ||
| 16 | +``` | ||
| 17 | + | ||
| 18 | +## Install the heroku toolbelt | ||
| 19 | +[toolbelt.heroku.com](https://toolbelt.heroku.com/) | ||
| 20 | + | ||
| 21 | +## Create an app on Heroku and push the source code | ||
| 22 | +```bash | ||
| 23 | +heroku apps:create | ||
| 24 | +heroku addons:add mongolab:sandbox | ||
| 25 | +heroku addons:add sendgrid:starter | ||
| 26 | +heroku config:add HEROKU=true | ||
| 27 | +heroku config:add SECRET_TOKEN="$(bundle exec rake secret)" | ||
| 28 | +heroku config:add ERRBIT_HOST=some-hostname.example.com | ||
| 29 | +heroku config:add ERRBIT_EMAIL_FROM=example@example.com | ||
| 30 | +git push heroku master | ||
| 31 | +``` | ||
| 32 | + | ||
| 33 | +## Prepare the DB | ||
| 34 | +No bootstrap task is used on Heroku! | ||
| 35 | + | ||
| 36 | +```bash | ||
| 37 | +heroku run rake db:seed | ||
| 38 | +heroku run rake db:mongoid:create_indexes | ||
| 39 | +``` | ||
| 40 | + | ||
| 41 | +## Schedule recurring tasks | ||
| 42 | +You may want to periodically clear resolved errors to free up space. For that | ||
| 43 | +you have a few options: | ||
| 44 | + | ||
| 45 | +Option 1. With the heroku-scheduler add-on (replacement for cron): | ||
| 46 | + | ||
| 47 | +```bash | ||
| 48 | +# Install the heroku scheduler add-on | ||
| 49 | +heroku addons:add scheduler:standard | ||
| 50 | + | ||
| 51 | +# Go open the dashboard to schedule the job. You should use | ||
| 52 | +# 'rake errbit:db:clear_resolved' as the task command, and schedule it | ||
| 53 | +# at whatever frequency you like (once/day should work great). | ||
| 54 | +heroku addons:open scheduler | ||
| 55 | +``` | ||
| 56 | + | ||
| 57 | +Option 2. With the cron add-on: | ||
| 58 | + | ||
| 59 | +```bash | ||
| 60 | +# Install the heroku cron addon, to clear resolved errors daily: | ||
| 61 | +heroku addons:add cron:daily | ||
| 62 | +``` | ||
| 63 | + | ||
| 64 | +Option 3. Clear resolved errors manually: | ||
| 65 | + | ||
| 66 | +```bash | ||
| 67 | +heroku run rake errbit:db:clear_resolved | ||
| 68 | +``` | ||
| 69 | + | ||
| 70 | +## Add the deployment hook | ||
| 71 | +```bash | ||
| 72 | +heroku addons:add deployhooks:http --url="http://YOUR_ERRBIT_HOST/deploys.txt?api_key=YOUR_API_KEY" | ||
| 73 | +``` |