From cbfa615d60d9294a7e3b24d4899004342949d1d2 Mon Sep 17 00:00:00 2001 From: Stephen Crosby Date: Mon, 5 Jan 2015 13:42:36 -0800 Subject: [PATCH] create docs section for deployment info --- README.md | 90 ++---------------------------------------------------------------------------------------- docs/deployment.md | 12 ++++++++++++ docs/deployment/capistrano.md | 19 +++++++++++++++++++ docs/deployment/heroku.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 88 deletions(-) create mode 100644 docs/deployment.md create mode 100644 docs/deployment/capistrano.md create mode 100644 docs/deployment/heroku.md diff --git a/README.md b/README.md index 9457372..8ef681e 100644 --- a/README.md +++ b/README.md @@ -135,95 +135,9 @@ rake errbit:bootstrap script/rails server ``` -Deploying: +Deployment: ---------- - - * Copy `config/deploy.example.rb` to `config/deploy.rb` - * Update the `deploy.rb` or `config.yml` file with information about your server - * Setup server and deploy - -```bash -cap deploy:setup deploy db:create_mongoid_indexes -``` - -(Note: The capistrano deploy script will automatically generate a unique secret token.) - -**Deploying to Heroku:** - - * Clone the repository - -```bash -git clone http://github.com/errbit/errbit.git -``` - * Update `db/seeds.rb` with admin credentials for your initial login. - - * Run `bundle` - - * Create & configure for Heroku - -```bash -gem install heroku -heroku create example-errbit -# If you really want, you can define your stack and your buildpack. the default is good to us : -# heroku create example-errbit --stack cedar --buildpack https://github.com/heroku/heroku-buildpack-ruby.git -heroku addons:add mongolab:sandbox -heroku addons:add sendgrid:starter -heroku config:add HEROKU=true -heroku config:add SECRET_TOKEN="$(bundle exec rake secret)" -heroku config:add ERRBIT_HOST=some-hostname.example.com -heroku config:add ERRBIT_EMAIL_FROM=example@example.com -git push heroku master -``` - - * Seed the DB (_NOTE_: No bootstrap task is used on Heroku!) and - create index - -```bash -heroku run rake db:seed -heroku run rake db:mongoid:create_indexes -``` - - * If you are using a free database on Heroku, you may want to periodically clear resolved errors to free up space. - - * With the heroku-scheduler add-on (replacement for cron): - - ```bash - # Install the heroku scheduler add-on - heroku addons:add scheduler:standard - - # Go open the dashboard to schedule the job. You should use - # 'rake errbit:db:clear_resolved' as the task command, and schedule it - # at whatever frequency you like (once/day should work great). - heroku addons:open scheduler - ``` - - * With the cron add-on: - - ```bash - # Install the heroku cron addon, to clear resolved errors daily: - heroku addons:add cron:daily - ``` - - * Or clear resolved errors manually: - - ```bash - heroku run rake errbit:db:clear_resolved - ``` - - * You may want to enable the deployment hook for heroku : - -```bash -heroku addons:add deployhooks:http --url="http://YOUR_ERRBIT_HOST/deploys.txt?api_key=YOUR_API_KEY" -``` - - * You may also want to configure a different secret token for each deploy: - -```bash -heroku config:add SECRET_TOKEN=some-secret-token -``` - - * Enjoy! - +See [notes on deployment](docs/deployment.md) Authentication -------------- diff --git a/docs/deployment.md b/docs/deployment.md new file mode 100644 index 0000000..880a592 --- /dev/null +++ b/docs/deployment.md @@ -0,0 +1,12 @@ +# Deployment Notes +There are any number of ways to deploy Errbit, but official support is limited +to heroku and capistrano. + +See specific notes on deployment via: +- [heroku](docs/deployment/heroku.md) +- [capistrano](docs/deployment/capistrano.md) + +You can use a process manager to deploy Errbit, but Errbit doesn't maintain +support for any specific process manager. But if you use systemd, @nofxx has +been kind enough to share: +- [systemd config](https://gist.github.com/nofxx/f01dcfe3e9d504181d76) diff --git a/docs/deployment/capistrano.md b/docs/deployment/capistrano.md new file mode 100644 index 0000000..e97ab0e --- /dev/null +++ b/docs/deployment/capistrano.md @@ -0,0 +1,19 @@ +# Deploy with Capistrano +These instructions should be good enough to get you started deploying +capistrano with Errbit. More than likely, you'll have to adjust some things to +suit your needs, so you should understand how to use capistrano before you +continue. + +## Clone and prepare the source code repository +```bash +git clone git@github.com:errbit/errbit.git +cd errbit +``` + +- Copy `config/deploy.example.rb` to `config/deploy.rb` +- Update the `deploy.rb` or `config.yml` file with information about your server +- Setup server and deploy + +## Schedule recurring tasks +You may want to periodically clear resolved errors to free up space. Schedule +the ```rake errbit:db:clear_resolved``` rake task to run every day or so. diff --git a/docs/deployment/heroku.md b/docs/deployment/heroku.md new file mode 100644 index 0000000..466bc0c --- /dev/null +++ b/docs/deployment/heroku.md @@ -0,0 +1,73 @@ +# Deploy to Heroku +We designed Errbit to work well with Heroku. These instructions should result +in a working deploy, but you should modify them to suit your needs: + +## Clone and prepare the source code repository +```bash +git clone git@github.com:errbit/errbit.git +cd errbit +``` + +- Update `db/seeds.rb` with admin credentials for your initial login + +Commit the results: +```bash +git commit -m "Update db/seeds.rb with initial login" +``` + +## Install the heroku toolbelt +[toolbelt.heroku.com](https://toolbelt.heroku.com/) + +## Create an app on Heroku and push the source code +```bash +heroku apps:create +heroku addons:add mongolab:sandbox +heroku addons:add sendgrid:starter +heroku config:add HEROKU=true +heroku config:add SECRET_TOKEN="$(bundle exec rake secret)" +heroku config:add ERRBIT_HOST=some-hostname.example.com +heroku config:add ERRBIT_EMAIL_FROM=example@example.com +git push heroku master +``` + +## Prepare the DB +No bootstrap task is used on Heroku! + +```bash +heroku run rake db:seed +heroku run rake db:mongoid:create_indexes +``` + +## Schedule recurring tasks +You may want to periodically clear resolved errors to free up space. For that +you have a few options: + +Option 1. With the heroku-scheduler add-on (replacement for cron): + +```bash +# Install the heroku scheduler add-on +heroku addons:add scheduler:standard + +# Go open the dashboard to schedule the job. You should use +# 'rake errbit:db:clear_resolved' as the task command, and schedule it +# at whatever frequency you like (once/day should work great). +heroku addons:open scheduler +``` + +Option 2. With the cron add-on: + +```bash +# Install the heroku cron addon, to clear resolved errors daily: +heroku addons:add cron:daily +``` + +Option 3. Clear resolved errors manually: + +```bash +heroku run rake errbit:db:clear_resolved +``` + +## Add the deployment hook +```bash +heroku addons:add deployhooks:http --url="http://YOUR_ERRBIT_HOST/deploys.txt?api_key=YOUR_API_KEY" +``` -- libgit2 0.21.2