{"id":265,"date":"2016-04-27T21:59:03","date_gmt":"2016-04-27T12:59:03","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2016\/04\/27\/deploy-rails-to-opsworks-chef12-2"},"modified":"2016-04-27T21:59:03","modified_gmt":"2016-04-27T12:59:03","slug":"deploy-rails-to-opsworks-chef12-2","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2016\/04\/27\/deploy-rails-to-opsworks-chef12-2\/","title":{"rendered":"Chef12\u306b\u5bfe\u5fdc\u3057\u305fAWS OpsWorks\u306bRails\u30a2\u30d7\u30ea\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u2461"},"content":{"rendered":"

\u6700\u8fd1\u3001Slack\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u7d75\u6587\u5b57\u3092\u3061\u3087\u304f\u3061\u3087\u304f\u8ffd\u52a0\u3057\u3066\u305f\u3089\u3001\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u8077\u4eba<\/strong>\u3068\u547c\u3070\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u524d\u7530\u3067\u3059\u3002
\n\u4eba\u9593\uff11\u3064\u304f\u3089\u3044\u306f\u5f97\u610f\u306a\u3053\u3068\u304c\u3042\u308b\u3082\u306e\u3067\u3059\u306d\u3002
\n\u81ea\u5206\u3067\u6b32\u3057\u3044\u3082\u306e\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u3042\u308b\u3068\u8ffd\u52a0\u3057\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5f0a\u793e\u306eSlack\u306f\u5c11\u3057\u30ab\u30aa\u30b9\u306a\u3053\u3068\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n

Slack\u306e\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u7d75\u6587\u5b57\u3067\u904a\u3076\u5f0a\u793e\u793e\u54e1<\/h3>\n

\"\"<\/p>\n

\"\"<\/p>\n

\u4ed6\u306b\u3082\u3053\u3093\u306a\u611f\u3058\"\"\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u304c\u3001\u6700\u8fd1\u306f \u30ba\u30c3<\/code> \u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u304cMMM Slack\u5185\u3067\u5927\u6d41\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n


\n

\u3055\u3066\u3001\u30d6\u30ed\u30b0\u306e\u5185\u5bb9\u306f\u524d\u56de\u306e\u7d9a\u304d\u3067\u3059\u3002
\n\u5f0a\u793e\u3067\u306fAWS\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u969b\u3001\u30a4\u30f3\u30d5\u30e9\u69cb\u7bc9\u306e\u81ea\u52d5\u5316&\u7701\u529b\u5316\u306e\u70ba\u306eDevOps\u30c4\u30fc\u30eb\u3068\u3057\u3066\u4e3b\u306bAWS\u306eOpsWorks\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/a>
\n\u6700\u8fd1\u306fDocker\u3067\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u306e\u304c\u6d41\u884c\u306e\u3088\u3046\u3067\u3059\u304c\u3001\u3057\u3064\u3053\u304fOpsWorks(Chef12)\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n

\u524d\u56de\u306e\u8a18\u4e8b\u306f\u30b3\u30c1\u30e9
\n->
Chef12\u306b\u5bfe\u5fdc\u3057\u305fAWS OpsWorks\u306bRails\u30a2\u30d7\u30ea\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u2460<\/a><\/p>\n

\u524d\u56de\u306fStack\u306e\u4f5c\u6210\u3068\u3001Cookbooks\u3092OpsWorks\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u307e\u3067\u3092\u66f8\u304d\u307e\u3057\u305f\u3002
\n\u4eca\u56de\u306f\u5168\u4f53\u8a2d\u8a08\u3084\u30ec\u30b7\u30d4\u3092\u66f8\u304f\u524d\u306b\u3084\u3063\u305f\u3053\u3068\u306a\u3069\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n

\u74b0\u5883\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3001\u5168\u4f53\u8a2d\u8a08\u56f3<\/h2>\n

OpsWorks\u306e\u30b9\u30bf\u30c3\u30af\u306f\u524d\u56de\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002
\n\u3042\u3068\u306f\u3001VPC\u3084\u30b5\u30d6\u30cd\u30c3\u30c8\u3084\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u3001ELB\u3084RDS\u306a\u3069\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002
\n\u5f0a\u793e\u3067\u306f\u3001VPC\u30fb\u30b5\u30d6\u30cd\u30c3\u30c8\u30fb\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u306a\u3069\u306f\u3001
AWS\u306eCloudFormation\u3092\u4f7f\u7528\u3057\u3066\u69cb\u7bc9\u3057\u3066\u3044\u307e\u3059\u3002<\/a>
\nELB\u3068RDS\u306f\u624b\u52d5\u3067\u3044\u3044\u611f\u3058\u306b\u69cb\u7bc9\u3057\u307e\u3059\u3002
\nRDS\u306f\u3001MySQL\u30d0\u30fc\u30b8\u30e7\u30f35.6.27<\/code>\u3067\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n

\u4e0b\u8a18\u304c\u5168\u4f53\u8a2d\u8a08\u56f3\u3067\u3059\u3002<\/p>\n

\"\"<\/p>\n

Web\u30b5\u30fc\u30d0\u30fc\u3001CMS\u30b5\u30fc\u30d0\u30fc\u306fRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002
\n\u30c7\u30d7\u30ed\u30a4\u3092\u3069\u3046\u3059\u308b\u304b\u3001\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u8272\u3005\u8b70\u8ad6\u3057\u307e\u3057\u305f\u304c\u3001\u30c7\u30d7\u30ed\u30a4\u30b5\u30fc\u30d0\u30fc\u3092\u7528\u610f\u3057\u3001\u305d\u306e\u30c7\u30d7\u30ed\u30a4\u30b5\u30fc\u30d0\u30fc\u304b\u3089Capistrano\u3067\u6307\u5b9a\u3057\u305f\u30ec\u30a4\u30e4\u30fc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u90e1\u306b\u30c7\u30d7\u30ed\u30a4\u3092\u5b9f\u884c\u3059\u308b\u3001\u3068\u3044\u3046\u8a2d\u8a08\u306b\u3057\u307e\u3057\u305f\u3002
\n\u30c7\u30d7\u30ed\u30a4\u30b5\u30fc\u30d0\u30fc\u306f\u8e0f\u307f\u53f0\u3082\u517c\u306d\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u30b9\u30bf\u30c3\u30af\u306b\u30ec\u30a4\u30e4\u30fc\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a<\/h3>\n

OpsWorks\u30b9\u30bf\u30c3\u30af\u306b\u30ec\u30a4\u30e4\u30fc\u3084\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30fbELB\u30fbRDS\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002<\/p>\n

\u30ec\u30a4\u30e4\u30fc<\/h4>\n

\"\"<\/p>\n

\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9<\/h4>\n

\u5404\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b9\u30da\u30c3\u30af\u306fUbuntu 14.04 LTS<\/code> t2.micro<\/code>\u3067\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u3066\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002
\n\u30ec\u30a4\u30e4\u30fc\u306e\u30ec\u30b7\u30d4\u304c\u7a7a\u306e\u72b6\u614b\u306a\u3089\u8d77\u52d5\u304c\u5931\u6557\u3059\u308b\u3053\u3068\u306f\u7121\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h4>\n

\u9069\u5f53\u306aRails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3066\u3001GitHub\u304bBitBucket\u306b\u30a2\u30c3\u30d7\u3057\u3066\u304a\u304d\u3001Apps<\/code>\u3067Rails\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u5177\u4f53\u7684\u306a\u30ec\u30b7\u30d4\u3092\u66f8\u304f\u524d\u306b\u3084\u3063\u305f\u3053\u3068<\/h2>\n

\u2460AWS\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u3080<\/h3>\n

AWS\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u500b\u4eba\u7684\u306b\u306f\u3044\u3064\u3082\u8aad\u307f\u3065\u3089\u3044\u306a\u3041\u3068\u611f\u3058\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u907f\u3051\u3066\u306f\u901a\u308c\u307e\u305b\u3093\u3002
\n\u6025\u304c\u3070\u56de\u308c\u3067\u3059\u304c\u3001\u3042\u308b\u7a0b\u5ea6\u98db\u3070\u3057\u3066\u91cd\u8981\u305d\u3046\u306a\u7b87\u6240\u3092\u8aad\u307f\u307e\u3057\u305f\u3002<\/p>\n

AWS OpsWorks \u30e6\u30fc\u30b6\u30fc\u30ac\u30a4\u30c9 (API Version 2013-02-18)<\/a><\/p>\n

\u2461\u30c7\u30fc\u30bf\u30d0\u30c3\u30b0\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n

\u524d\u56de\u306e\u8a18\u4e8b\u3067\u66f8\u304d\u307e\u3057\u305f\u3001\u300cOpsWorks\u5185\u3067\u306e\u30c7\u30fc\u30bf\u30d0\u30c3\u30b0\u306e\u53d6\u5f97\u65b9\u6cd5\u304c\u5909\u308f\u3063\u305f\u300d<\/strong>\u3053\u3068\u304c\u3001Chef12\u306b\u5bfe\u5fdc\u3057\u305fOpsWorks\u306e\u5927\u304d\u306a\u5909\u66f4\u70b9\u3067\u3001\u307e\u305a\u306f\u3069\u3046\u3044\u3063\u305f\u5024\u304cOpsWorks\u4e0a\u3067\u53d6\u5f97\u51fa\u6765\u308b\u306e\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002
\n
AWS OpsWorks \u30c7\u30fc\u30bf\u30d0\u30c3\u30b0\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a><\/p>\n

\u78ba\u8a8d\u65b9\u6cd5\u306f\u3001\u7c21\u5358\u306a\u30c7\u30fc\u30bf\u30d0\u30c3\u30b0\u5024\u8868\u793a\u7528\u306e\u30ec\u30b7\u30d4\u3092\u66f8\u304d\u3001OpsWorks\u4e0a\u3067\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002
\n\u30ec\u30b7\u30d4\u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n

\u30ec\u30b7\u30d4\u540d\u30fb\u30fb\u30fbdisplay_variables<\/strong><\/p>\n

\u69cb\u6210<\/h4>\n
\u251c\u2500\u2500 metadata.rb\n\u2514\u2500\u2500 recipes\n    \u2514\u2500\u2500 default.rb<\/code><\/pre>\n

metadata.rb<\/h4>\n
name        "display_variables"\ndescription "display variables for aws opsworks"\nmaintainer  "masaki maeda"\nversion     "1.0.0"<\/code><\/pre>\n

recipes\/default.rb<\/h4>\n
%w(aws_opsworks_app\n   aws_opsworks_command\n   aws_opsworks_ecs_cluster\n   aws_opsworks_elastic_load_balancer\n   aws_opsworks_instance\n   aws_opsworks_layer\n   aws_opsworks_rds_db_instance\n   aws_opsworks_stack\n   aws_opsworks_user).each do |data_bag|\n  puts '--------------------'\n  puts "### #{data_bag} ###"\n  search(data_bag).each_with_index do |app, i|\n    puts "===== #{i} ====="\n    app.each do |key, value|\n      puts "key = #{key}, value = #{value}"\n    end\n  end\n  puts '--------------------'\nend<\/code><\/pre>\n

\u3053\u306e\u30ec\u30b7\u30d4\u3092OpsWorks\u4e0a\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3001Execute Recipes \u306a\u3069\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u305d\u3046\u3059\u308b\u3068\u3001\u4e0b\u8a18\u306f\u4e00\u90e8\u3067\u3059\u304c\u3001\u8272\u3005\u5024\u304c\u53d6\u5f97\u51fa\u6765\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002
\n\u30b9\u30bf\u30c3\u30af\u5185\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u305d\u3046\u306a\u60c5\u5831\u306f\u307b\u307c\u3059\u3079\u3066\u53d6\u5f97\u51fa\u6765\u307e\u3059\u3002
\n\u57fa\u672c\u7684\u306b\u3001\u3053\u3053\u3067\u53d6\u5f97\u51fa\u6765\u308b\u5024\u3092\u5229\u7528\u3057\u3066\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u3066\u3044\u304f\u306e\u3067\u3001\u3053\u306e\u5024\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u30ec\u30b7\u30d4\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u3053\u3053\u304b\u3089\u5148\u306f\u307e\u3060\u9577\u3044\u306e\u3067\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u3053\u308c\u3067\u3044\u3051\u305d\u3046\u306a\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n

\u6b21\u56de<\/h2>\n

\u6b21\u56de\u306f\u5fc5\u8981\u306a\u30ec\u30b7\u30d4\u90e1\u3084\u30c7\u30d7\u30ed\u30a4\u307e\u3067\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n

AWS\u3092\u6d3b\u7528\u3057\u305f\u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u306a\u30b5\u30fc\u30d3\u30b9\u69cb\u7bc9\u3092\u304a\u8003\u3048\u306e\u969b\u306f\u3001\u662f\u975eMMM\u306b\u304a\u58f0\u304c\u3051\u4e0b\u3055\u3044\u307e\u305b\uff01<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

\u6700\u8fd1\u3001Slack\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u7d75\u6587\u5b57\u3092\u3061\u3087\u304f\u3061\u3087\u304f\u8ffd\u52a0\u3057\u3066\u305f\u3089\u3001\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u8077\u4eba\u3068\u547c\u3070\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u524d\u7530\u3067\u3059\u3002 \u4eba\u9593\uff11\u3064\u304f\u3089\u3044\u306f\u5f97\u610f\u306a\u3053\u3068\u304c\u3042\u308b\u3082\u306e\u3067\u3059\u306d\u3002 \u81ea\u5206\u3067\u6b32\u3057\u3044\u3082\u306e\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u3042\u308b\u3068\u8ffd\u52a0\u3057\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5f0a\u793e\u306eSlack\u306f\u5c11\u3057\u30ab\u30aa\u30b9\u306a\u3053\u3068\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 Slack\u306e\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u7d75\u6587\u5b57\u3067\u904a\u3076\u5f0a\u793e\u793e\u54e1 \u4ed6\u306b\u3082\u3053\u3093\u306a\u611f\u3058\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30a2 […]<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[84,42],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/265"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}