-
Notifications
You must be signed in to change notification settings - Fork 9
trackman
Trackman is an add-on that lets you keep your error and maintenance pages within your Ruby on Rails project and hosts them for you when you deploy to Heroku.
Trackmanは、Ruby on Railsのプロジェクト内に、エラーとメンテナンスの画面を提供し、Herokuへのデプロイ時にこれらの画面をホストするアドオンです。
Don't spend time manually uploading and managing those pages separately: これらの画面を手動でアップロードしたり、分けて管理することに時間を使わないで下さい。:
-
They are part of your project and should be handled as such.
-
Keep them versioned and modify them within your project.
-
Deploy your app those pages will be synced to S3.
-
Reference the assets you already created (images/js/css) in your app.
-
これらの画面は、プロジェクトの一部です。そして、そのように扱われるべきものなのです。
-
プロジェクト内で、バージョン管理と修正を行って下さい。
-
アプリケーションをデプロイすることで、これらの画面がS3と同期されます。
-
アプリケーションで既に作成済みのアセット(images/js/css)を参照して下さい。
Trackman can be attached to a Heroku application via the CLI: TrackmanはCLIを経由してHeroku上のアプリケーションへアタッチされます。:
:::term
$ heroku addons:add trackman
-----> Adding trackman to sharp-mountain-4005... done, v18 (free)
Once Trackman has been added a TRACKMAN_URL
, TRACKMAN_ERROR_PAGE_URL
and a TRACKMAN_MAINTENANCE_PAGE_URL
settings will be available in the app configuration and will contain the provisioning information needed to serve and modify all the assets related to your maintenance and error pages. This can be confirmed using the heroku config
command.
一度、Trackmanを追加さえしてしまえば、アプリケーションの設定でTRACKMAN_URL
、TRACKMAN_ERROR_PAGE_URL
、TRACKMAN_MAINTENANCE_PAGE_URL
が利用可能となり、またメンテナンスとエラーページに関連した全てのアセットを提供、修正する際に必要となる設定情報が含まれることとなります。
:::term
$ heroku config | grep TRACKMAN
TRACKMAN_URL => https://user:pass@trackman-server/resourceid
TRACKMAN_ERROR_PAGE_URL => http://s3.amazon.com/trackman-bucket/app-id/path/to/your/page.html
TRACKMAN_MAINTENANCE_PAGE_URL => http://s3.amazon.com/trackman-bucket/app-id/path/to/your/page.
Ruby on Rails applications will need to add the following entry into their Gemfile
specifying the Trackman client library.
Ruby on Railsのアプリケーションでは、Trackmanのクライアントライブラリを明示するために、Gemfile
に下記のエントリを追加する必要があります。
:::ruby
gem 'trackman'
Update application dependencies with bundler. アプリケーションの依存関係をbundlerで更新して下さい。
:::term
$ bundle install
And setup Heroku's error and maintenance page config vars with rake trackman:setup
.
そして、Herokuのエラーとメンテナンスの画面の設定変数をrake trackman:setup
コマンドでセットアップして下さい。
:::term
$ bundle exec rake trackman:setup
overriding the required heroku configs MAINTENANCE_PAGE_URL and ERROR_PAGE_URL
done! Thank you for using Trackman!
もし、既にMAINTENANCE_PAGE_URL
やERROR_PAGE_URL
内に、カスタムのメンテナンスやエラーページを設定済みでしたら、_bkp
と接尾辞の付いた同名の設定変数にコピーが行われます。例えば、ERROR_PAGE_URL
は、ERROR_PAGE_URL_bkp
へバックアップされます。
:::term
$ rails generate trackman:controller [name]
This will generate a special controller that, when on development, will create your maintenance pages for you when you execute its actions. Because Rails 3 can handle 500 and 404 pages dynamically, the generator also adds the required route to handle them. On Rails 2, it generates the 4 different static pages instead.
このコマンドは、特別なコントローラーを生成します。開発環境で、アクションを実行時メンテナンスページを生成します。 Rails 3は、500と404のページを直にハンドルするため、これらをハンドルするためのルートをジェネレーターが追加します。 Rails 2では、4つの異なる静的なページが代わりに生成されます。
The controller has class methods to filter the response output.
You can find examples on how to use them within the controller itself.
コントローラは、レスポンスのアウトプットをフィルターするクラスメソッドを管理しています。 コントローラ自身を参照すれば、それらを使う方法の例を見つけることができるでしょう。
Deploy the maintenance and error pages: メンテナンスとエラーページのデプロイ:
:::term
$ git add public/503.html
$ git add public/503-error.html
$ git commit -a -m "Adding maintenance and error pages"
$ heroku maintenance:on
$ git push heroku master
...
-----> Heroku receiving push
-----> Launching... done, v3
http://warm-frost-1289.herokuapp.com deployed to Heroku
To [email protected]:warm-frost-1289.git
* [new branch] master -> master
Trackman will sync on the boot of your application. Trackmanは、アプリケーションの起動時に同期します。
To verify the new maintenance pages, you can query it from your browser.
When you are done you can set maintenance back to off
:::term
$ heroku maintenance:off
If you'd like to explicitly sync your error and maintenance pages you can manually invoke the sync task and see additional details as well.
:::term
$ heroku run rake trackman:sync
Confirm that it all worked by doing:
:::term
$ heroku maintenance:on
And checking your website to see your custom maintenance page. After verifying be sure to take the website off maintenance mode:
:::term
$ heroku maintenance:off
Use the heroku addons:upgrade
command to migrate to a new plan.
:::term
$ heroku addons:upgrade trackman:newplan
-----> Upgrading trackman:newplan to sharp-mountain-4005... done, v18 ($49/mo)
Your plan has been updated to: trackman:newplan
Trackman can be removed via the CLI.
:::term
$ heroku addons:remove trackman
-----> Removing trackman from sharp-mountain-4005... done, v20 (free)
You will need to manually restore any custom MAINTENANCE_PAGE_URL
or ERROR_PAGE_URL
config vars after removing the add-on.
All Trackman support and runtime issues should be submitted via on of the Heroku Support channels. Any non-support related issues or product feedback is welcome here.
Additional resources are available at: