HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*
A little more about Stager¶
Stager の位置¶
Stager の仕事¶
- 概要
- デプロイ時にインストーラーを作成する
デプロイ時にインストーラーを作成する¶
- やり方
- Stagerは仕事をTaskとして受け取る
- NATSの'vcap.stager.#{qn}'(既定値は['staging'] )にTaskを受信すると,
VCAP::Stager::Server#add_task を経由して,- まず VCAP::Stager::Task#decode が呼ばれる
- Taskの内容はこんな感じ
VCAP::Stager::Task.new(dec_msg['app_id'], dec_msg['properties'], dec_msg['download_uri'], dec_msg['upload_uri'], dec_msg['notify_subj'])
# @param app_id Integer Globally unique id for app # @param props Hash App properties. Keys are # :runtime => Application runtime name # :framework => Application framework name # :environment => Applications environment variables. # Hash of NAME => VALUE # :services => Services bound to app # :resources => Resource limits # @param download_uri String Where the stager can fetch the zipped application from. # @param upload_uri String Where the stager should PUT the gzipped droplet # @param notify_subj String NATS subject that the stager will publish the result to. def initialize(app_id, props, download_uri, upload_uri, notify_subj, opts={}) ..
- Taskの内容はこんな感じ
- さらに VCAP::Stager::TaskManager#add_task を経由して以下が呼び出される
- まず VCAP::Stager::Task#decode が呼ばれる
- VCAP::Stager::Task#run_staging_plugin (再掲)
StagingPlugin::Config.to_file(plugin_config, plugin_config_path) cmd = "#{@ruby_path} #{@run_plugin_path} #{@app_props['framework']} #{plugin_config_path}" @vcap_logger.debug("Running staging command: '#{cmd}'") res = run_logged(cmd, 0, @max_staging_duration)
- VCAP::Stager::Task#run_logged
- VCAP::Stager::Util.run_command
- run_plugin スクリプト
plugin_name, config_path = ARGV klass = StagingPlugin.load_plugin_for(plugin_name) # <= plungin_name から対象プラグインのクラスを作成 plugin = klass.from_file(config_path) # <= 対象プラグインのクラスからインスタンスを作成 plugin.stage_application <= 対象プラグインのstage_applicationメソッドを実行
以下Rails3Pluginを例に- Rails3Plugin#stage_application
- create_app_directories <= StagingPlugin#create_app_directories
- copy_source_files <= StagingPlugin#copy_source_files
- stage_console
- compile_gems <= GemfileSupport#compile_gems
- configure_database <= RailsDatabaseSupport#configure_database
- install_autoconfig_gem <= RubyAutoConfig#install_autoconfig_gem
- setup_autoconfig_script <= ?
- create_asset_plugin <= ?
- create_startup_script <= StagingPlugin#create_startup_script
- Rails3Plugin#startup_script
- create_stop_script <= StagingPlugin#create_stop_script
- Rails3Plugin#stop_script
- Rails3Plugin#stage_application
- run_plugin スクリプト
- VCAP::Stager::Util.run_command
- VCAP::Stager::Task#run_logged
Interfaces¶
→ http://apidocs.cloudfoundry.com/
In(→Out)¶
In¶
Out¶
(参考)初期値一覧¶
- 設定ファイル
TBF - コンストラクター