{"id":1137,"date":"2020-04-17T00:00:48","date_gmt":"2020-04-16T15:00:48","guid":{"rendered":"http:\/\/ji-develop.com\/blog\/?p=1137"},"modified":"2022-05-05T09:39:26","modified_gmt":"2022-05-05T00:39:26","slug":"aws-cloud9%e3%81%a7rails%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","status":"publish","type":"post","link":"https:\/\/ji-develop.com\/blog\/aws-cloud9%e3%81%a7rails%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","title":{"rendered":"AWS cloud9\u3067Rails\u3092\u52d5\u304b\u3059"},"content":{"rendered":"<p><span style=\"font-size: 14pt;\">\u4f5c\u6210\u74b0\u5883\uff1aAmazon Linux<\/span><\/p>\n<h2>Rails6\u3067\u52d5\u304b\u3059<\/h2>\n<p><span style=\"color: #ff6600;\">\u203b\u5148\u306b\u8a00\u3063\u3066\u304a\u304d\u307e\u3059\u304c\u3001Rails6\u3067\u306f\u52d5\u304b\u305b\u307e\u305b\u3093\u3067\u3057\u305f\u3002Rails5\u3067\u52d5\u304b\u3057\u305f\u3044\u65b9\u306f\u4e0b\u3078\u3069\u3046\u305e\u3002<\/span><\/p>\n<p>\u2460ruby\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ ruby -v\r\nruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]<\/pre>\n<p>2.6.3\u304c\u5165\u3063\u3066\u307e\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u2461rails\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ rails -v\r\nRails 5.0.0<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2462\u30d0\u30fc\u30b8\u30e7\u30f35\u304c\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u6700\u65b0\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ gem install rails<\/pre>\n<p>\u6700\u65b0\u306b\u306a\u308a\u307e\u3057\u305f\u3002\uff082020\/04\/16\u73fe\u5728\uff09<\/p>\n<pre>ec2-user:~\/environment $ rails -v\r\nRails 6.0.2.2<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2463\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u306f\u9069\u5f53\u306bRailsApp\u3068\u3057\u307e\u3059\u3002<br \/>\n\u6642\u9593\u304c\u5c11\u3057\u304b\u304b\u308b\u306e\u3067\u5f85\u3061\u307e\u3059\u2026\u3002<\/p>\n<pre>ec2-user:~\/environment $ rails new RailsApp<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2464\u4f5c\u6210\u304c\u7d42\u308f\u3063\u305f\u3089Rails\u3092\u8d77\u52d5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ cd RailsApp\r\nec2-user:~\/environment\/RailsApp (master) $ rails s<\/pre>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u3067\u307e\u3057\u305f\u3002<br \/>\nWebpacker\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre>\/home\/ec2-user\/.rvm\/gems\/ruby-2.6.3\/gems\/webpacker-4.2.2\/lib\/webpacker\/configuration.rb:95:in `rescue in load': Webpacker configuration file not found \/home\/ec2-user\/environment\/RailsApp\/config\/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - \/home\/ec2-user\/environment\/RailsApp\/config\/webpacker.yml (RuntimeError)<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2465\u306a\u306e\u3067Webpacker\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n\u304c\u3001Yarn\u304c\u306a\u3044\u3068\u8a00\u308f\u308c\u307e\u3057\u305f\u3002<\/p>\n<pre>ec2-user:~\/environment\/RailsApp (master) $ rails webpacker:install\r\nYarn not installed. Please download and install Yarn from https:\/\/yarnpkg.com\/lang\/en\/docs\/install\/<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2466Yarn\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment\/RailsApp (master) $ npm install -g yarn<\/pre>\n<p>Yarn\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre>\/home\/ec2-user\/.nvm\/versions\/node\/v10.19.0\/bin\/yarn -&gt; \/home\/ec2-user\/.nvm\/versions\/node\/v10.19.0\/lib\/node_modules\/yarn\/bin\/yarn.js\r\n\/home\/ec2-user\/.nvm\/versions\/node\/v10.19.0\/bin\/yarnpkg -&gt; \/home\/ec2-user\/.nvm\/versions\/node\/v10.19.0\/lib\/node_modules\/yarn\/bin\/yarn.js\r\n+ yarn@1.22.4\r\nadded 1 package in 0.444s<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2467\u518d\u5ea6\u3001Webpacker\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment\/RailsApp (master) $ rails webpacker:install<\/pre>\n<p>Webpacker\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre>\uff08\u7701\u7565\uff09\r\n\u30fb\r\n\u30fb\r\nWebpacker successfully installed<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2468rails\u3092\u8d77\u52d5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment\/RailsApp (master) $ rails s<\/pre>\n<p>\u4eca\u5ea6\u306f\u4e0a\u624b\u304f\u3044\u3063\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre>=&gt; Booting Puma\r\n=&gt; Rails 6.0.2.2 application starting in development \r\n=&gt; Run `rails server --help` for more startup options\r\nPuma starting in single mode...\r\n* Version 4.3.3 (ruby 2.6.3-p62), codename: Mysterious Traveller\r\n* Min threads: 5, max threads: 5\r\n* Environment: development\r\n* Listening on tcp:\/\/127.0.0.1:8080\r\n* Listening on tcp:\/\/[::1]:8080\r\nUse Ctrl-C to stop<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2469\u30d6\u30e9\u30a6\u30b6\u3067\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002\u753b\u9762\u4e0a\u90e8\u306b\u3042\u308b\u300cPreview\u300d\u2192\u300cPreview Running Application\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3057\u305f\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1143\" src=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/BlockHost\u30a8\u30e9\u30fc.png\" alt=\"\u30d6\u30ed\u30c3\u30af\u30db\u30b9\u30c8\u30a8\u30e9\u30fc\" width=\"495\" height=\"266\" srcset=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/BlockHost\u30a8\u30e9\u30fc.png 495w, https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/BlockHost\u30a8\u30e9\u30fc-300x161.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/>\n<p>&nbsp;<\/p>\n<p>\u246a\u3053\u308c\u3092\u89e3\u6c7a\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u30db\u30b9\u30c8\u3092\u6307\u5b9a\u3057\u3066\u3042\u3052\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\uff1a\/RailsApp\/config\/application.rb<\/p>\n<pre>module RailsApp\r\n  class Application &lt; Rails::Application\r\n    # Initialize configuration defaults for originally generated Rails version.\r\n    config.load_defaults 6.0\r\n\r\n    # Settings in config\/environments\/* take precedence over those specified here.\r\n    # Application configuration can go into files in config\/initializers\r\n    # -- all .rb files in that directory are automatically loaded after loading\r\n    # the framework and any gems in your application.\r\n\r\n    config.hosts &lt;&lt; \"cfd5be313ae648ceaf0b2094042dd3f6.vfs.cloud9.ap-northeast-1.amazonaws.com\" #\u2190\u8ffd\u52a0\r\n  end\r\nend\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u246b\u4e00\u5ea6rails\u3092\u505c\u6b62\u3057\u3066\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u5ea6\u306f\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1144\" src=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/SQLite\u30a8\u30e9\u30fc.png\" alt=\"SQLite\u30a8\u30e9\u30fc\" width=\"511\" height=\"202\" srcset=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/SQLite\u30a8\u30e9\u30fc.png 511w, https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/SQLite\u30a8\u30e9\u30fc-300x119.png 300w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/>\n<p>SQLite\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304cRails6\u306b\u5bfe\u3057\u3066\u53e4\u904e\u304e\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u304c\u3001\u3069\u3046\u3082\u73fe\u5728\u306eAmazon Linux\u3067\u306f\u3053\u306e\u73fe\u8c61\u3092\u56de\u907f\u3067\u304d\u306a\u3044\u3088\u3046\u306a\u306e\u3067\u3001Rails\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u4e0a\u3052\u305a\u306b\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>Rails5\u3067\u52d5\u304b\u3059<\/h2>\n<p>\u203bRails6\u3067\u74b0\u5883\u3092\u4f5c\u3063\u3066\u3057\u307e\u3063\u305f\u65b9\u306f\u3001\u4e00\u5ea6\u74b0\u5883\u3092\u524a\u9664\u3057\u3066\u65b0\u3057\u304f\u74b0\u5883\u3092\u4f5c\u308a\u76f4\u3057\u305f\u307b\u3046\u304c\u65e9\u3044\u3067\u3059\u3002<\/p>\n<p>\u2460ruby\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ ruby -v\r\nruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]<\/pre>\n<p>2.6.3\u304c\u5165\u3063\u3066\u307e\u3059\u306d\u3002<\/p>\n<pre>ec2-user:~\/environment $gem install rails<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2461rails\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f35\u3067\u3059\u306d\u3002<\/p>\n<pre>ec2-user:~\/environment $ rails -v\r\nRails 5.0.0<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2462\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u306f\u9069\u5f53\u306bRailsApp\u3068\u3057\u307e\u3059\u3002<br \/>\n\u6642\u9593\u304c\u5c11\u3057\u304b\u304b\u308b\u306e\u3067\u5f85\u3061\u307e\u3059\u2026\u3002<\/p>\n<pre>ec2-user:~\/environment $ rails new RailsApp<\/pre>\n<p>\u4f5c\u6210\u5f8c\u3001rails\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3059\u308b\u3068\u306a\u305c\u304b\u3061\u3087\u3063\u3068\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ rails -v\r\nRails 5.0.7.2<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2463gemfile\u306esqlite3\u306e\u90e8\u5206\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<pre>gem 'sqlite3','~&gt; 1.3.6'<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2464bundle install\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment $ bundle install<\/pre>\n<p>&nbsp;<\/p>\n<p>\u2465rails\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre>ec2-user:~\/environment\/RailsApp (master) $ rails s<\/pre>\n<p>\u3088\u3046\u3084\u304f\u5b9f\u884c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1148\" src=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/Rails\u5b9f\u884c\u753b\u9762.png\" alt=\"Rails\u5b9f\u884c\u753b\u9762\" width=\"514\" height=\"492\" srcset=\"https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/Rails\u5b9f\u884c\u753b\u9762.png 514w, https:\/\/ji-develop.com\/blog\/wp-content\/uploads\/2020\/04\/Rails\u5b9f\u884c\u753b\u9762-300x287.png 300w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u6210\u74b0\u5883\uff1aAmazon Linux Rails6\u3067\u52d5\u304b\u3059 \u203b\u5148\u306b\u8a00\u3063\u3066\u304a\u304d\u307e\u3059\u304c\u3001Rails6\u3067\u306f\u52d5\u304b\u305b\u307e\u305b\u3093\u3067\u3057\u305f\u3002Rails5\u3067\u52d5\u304b\u3057\u305f\u3044\u65b9\u306f\u4e0b\u3078\u3069\u3046\u305e\u3002 \u2460ruby\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002 ec2-user:~\/&#8230;<\/p>\n","protected":false},"author":1,"featured_media":426,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[20,19],"tags":[],"class_list":{"0":"post-1137","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws-cloud9","8":"category-rails","9":"article cf"},"_links":{"self":[{"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/posts\/1137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/comments?post=1137"}],"version-history":[{"count":14,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/posts\/1137\/revisions"}],"predecessor-version":[{"id":1154,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/posts\/1137\/revisions\/1154"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/media\/426"}],"wp:attachment":[{"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/media?parent=1137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/categories?post=1137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ji-develop.com\/blog\/wp-json\/wp\/v2\/tags?post=1137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}