質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

2回答

1304閲覧

容量不足でbundle updateができない。

moonlight4_6_17

総合スコア12

unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

1クリップ

投稿2021/05/06 17:08

やりたいこと

railsで作ったアプリをunicorn+nginx+MySQLでAWSでデプロイしようとしたい。

起きている問題

bundle updateができない。

エラーの流れ

$ bundle update

[ryoji@ip-10-0-0-225 tempo]$ bundle update Ignoring bootsnap-1.7.2 because its extensions are not built. Try: gem pristine bootsnap --version 1.7.2 ・・・(略) Using ffi 1.15.0 Fetching sassc 2.4.0 Installing sassc 2.4.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext /home/ryoji/.rbenv/versions/2.6.2/bin/ruby -I /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20210506-4298-1jp1qyu.rb extconf.rb creating Makefile current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext make "DESTDIR=" clean current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/ext make "DESTDIR=" compiling ./libsass/src/ast.cpp ・・・(略) compiling ./libsass/src/extender.cpp virtual memory exhausted: Cannot allocate memory make: *** [extender.o] Error 1 make failed, exit code 2 Gem files will remain installed in /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0 for inspection. Results logged to /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.4.0/gem_make.out An error occurred while installing sassc (2.4.0), and Bundler cannot continue. Make sure that `gem install sassc -v '2.4.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: bootstrap was resolved to 5.0.0, which depends on sassc-rails was resolved to 2.1.2, which depends on sassc

virtual memory exhausted: Cannot allocate memory
make: *** [color_maps.o] Error 1
とある。
これ、もしやメモリー不足?と思い、

https://qiita.com/HrsUed/items/c156ed69e927b6165717
の記事を参考に

[ryoji@ip-10-0-0-225 tempo]$ sudo dd if=/dev/zero of=/swap bs=1M count=2048 dd: error writing ‘/swap’: No space left on device 1396+0 records in 1395+0 records out 1462829056 bytes (1.5 GB) copied, 21.8857 s, 66.8 MB/s

No space left on deviceとあって、
そもそも、容量不足。

EC2インスタンスをt2.microからt2.smallに変更。
で、

[ryoji@ip-10-0-0-225 ~]$ sudo dd if=/dev/zero of=/swap bs=1M count=1024 [sudo] password for ryoji: 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB) copied, 11.3893 s, 94.3 MB/s [ryoji@ip-10-0-0-225 ~]$ sudo mkswap /swap mkswap: /swap: insecure permissions 0644, 0600 suggested. Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) no label, UUID=715e25e0-06a3-4fd3-8142-8eb6183955ea [ryoji@ip-10-0-0-225 ~]$ sudo swapon /swap swapon: /swap: insecure permissions 0644, 0600 suggested. [ryoji@ip-10-0-0-225 ~]$ sudo chmod 600 /swap [ryoji@ip-10-0-0-225 ~]$ sudo swapon -s Filename Type Size Used Priority /swap file 1048572 0 -2 [ryoji@ip-10-0-0-225 ~]$ sudo vi /etc/fstab で /swap swap swap defaults 0 0 を追記

bundle updateしてみる

・・・ Bundler cannot continue installing libv8-node (15.14.0.1). The checksum for the downloaded `libv8-node-15.14.0.1-x86_64-linux.gem` does not match the checksum given by the server. This means the contents of the downloaded gem is different from what was uploaded to the server, and could be a potential security issue. To resolve this issue: 1. delete the downloaded gem located at: `/var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/libv8-node-15.14.0.1-x86_64-linux/libv8-node-15.14.0.1-x86_64-linux.gem` 2. run `bundle install` If you wish to continue installing the downloaded gem, and are certain it does not pose a security issue despite the mismatching checksum, do the following: 1. run `bundle config set --local disable_checksum_validation true` to turn off checksum verification 2. run `bundle install` (More info: The expected SHA256 checksum was "0c60592e11f23daaa9d0aa2f1ea9b94201e7d79216b0be6de9fc6d098cc18e13", but the checksum for the downloaded gem was "b7a1df689493cfbaf85aa716dd5a2b57d7bc92ab848eb059e25d23fda48cd1e2".)

またしてもエラー
書いてある/var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/libv8-node-15.14.0.1-x86_64-linux/libv8-node-15.14.0.1-x86_64-linux.gemを消そうとしても、その場所に存在しない。。
ので、
$ bundle config set --local disable_checksum_validation true
$ bundle install

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/mini_racer-0.4.0/ext/mini_racer_extension /home/ryoji/.rbenv/versions/2.6.2/bin/ruby -I /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20210506-4214-hxjszz.rb extconf.rb Ignoring bootsnap-1.7.2 because its extensions are not built. Try: gem pristine bootsnap --version 1.7.2 ・・・(略) Ignoring unicorn-5.4.1 because its extensions are not built. Try: gem pristine unicorn --version 5.4.1 checking for -lpthread... yes creating Makefile current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/mini_racer-0.4.0/ext/mini_racer_extension make "DESTDIR=" clean current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/mini_racer-0.4.0/ext/mini_racer_extension make "DESTDIR=" compiling mini_racer_extension.cc cc1plus: warning: command line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++ ・・・(略) ^ In file included from mini_racer_extension.cc:5:0: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/libv8-node-15.14.0.1-x86_64-linux/vendor/v8/include/v8.h:3719:37: note: declared here V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index, mini_racer_extension.cc:556:78: warning: ignoring return value of ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’, declared with attribute warn_unused_result [-Wunused-result] convert_ruby_to_v8(isolate, context, rb_ary_entry(pair, 1))); ^ ・・・(略) In file included from mini_racer_extension.cc:5:0: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/libv8-node-15.14.0.1-x86_64-linux/vendor/v8/include/v8.h:3716:37: note: declared here V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, ^~~ At global scope: cc1plus: warning: unrecognized command line option ‘-Wno-self-assign’ cc1plus: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1plus: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1plus: warning: unrecognized command line option ‘-Wno-cast-function-type’ linking shared-object mini_racer_extension.so current directory: /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/mini_racer-0.4.0/ext/mini_racer_extension make "DESTDIR=" install /usr/bin/install -c -m 0755 mini_racer_extension.so ./.gem.20210506-4214-12d0wd6 /usr/bin/install: error writing ‘./.gem.20210506-4214-12d0wd6/mini_racer_extension.so’: No space left on device /usr/bin/install: failed to extend ‘./.gem.20210506-4214-12d0wd6/mini_racer_extension.so’: No space left on device make: *** [install-so] Error 1 make install failed, exit code 2 Gem files will remain installed in /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/gems/mini_racer-0.4.0 for inspection. Results logged to /var/www/rails/tempo/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/mini_racer-0.4.0/gem_make.out An error occurred while installing mini_racer (0.4.0), and Bundler cannot continue. Make sure that `gem install mini_racer -v '0.4.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mini_racer [ryoji@ip-10-0-0-225 node]$ gem install mini_racer -v '0.4.0' --source 'https://rubygems.org/' Fetching libv8-node-15.14.0.1-x86_64-linux.gem Fetching mini_racer-0.4.0.gem #<Thread:0x0000000001a430c0@/home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/request_set.rb:168 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 8: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/request_set.rb:174:in `block (2 levels) in install' 7: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/resolver/specification.rb:101:in `download' 6: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/source.rb:206:in `download' 5: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/remote_fetcher.rb:158:in `download' 4: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/remote_fetcher.rb:305:in `cache_update_path' 3: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems.rb:876:in `write_binary' 2: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems.rb:876:in `open' 1: from /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems.rb:881:in `block in write_binary' /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems.rb:881:in `write': No space left on device @ io_write - /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/cache/libv8-node-15.14.0.1-x86_64-linux.gem (Errno::ENOSPC) ERROR: While executing gem ... (Errno::ENOSPC) No space left on device @ io_write - /home/ryoji/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/cache/libv8-node-15.14.0.1-x86_64-linux.gem

となり、再び容量が足りない問題に?

どなたかわかる方いたらご教授ください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

cateye

2021/05/06 17:56

dfの結果はどうなっていますか?
moonlight4_6_17

2021/05/07 03:56

cateyeさん コメントありがとうございます! $ df [ryoji@ip-10-0-0-225 ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 1008776 0 1008776 0% /dev tmpfs 1019544 0 1019544 0% /dev/shm tmpfs 1019544 412 1019132 1% /run tmpfs 1019544 0 1019544 0% /sys/fs/cgroup /dev/xvda1 8376300 8374968 1332 100% / tmpfs 203912 0 203912 0% /run/user/1000 となっております。
guest

回答2

0

自己解決

いったん、AWSのコンソールで
インスタンス停止→ディスクの拡張
で解決しました。

投稿2021/05/09 04:32

moonlight4_6_17

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ディスクを拡張してください。
OS別EBSオンライン拡張方法

感覚的にですが、t2.microのメモリ容量だとたいていbundle insallはうまくいきません。
なのでインスタンスを大きくするかswap領域を作るかが必要になりますが、デフォルト設定だとインスタンス作成時にディスク容量を8GBとかにしてるはずなのでswap領域を作った上でbundle installをするには厳しいです。

投稿2021/05/07 00:53

yu_1985

総合スコア7447

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

moonlight4_6_17

2021/05/07 03:59

yu_1985さん コメントありがとうございます! 一応、t2.smallにアップしてスワップ領域の作成してみたのですが、やはりbundle updateしようとすると No space left on device となってしまいます????
yu_1985

2021/05/07 05:36

もう一度同じことをいいます。 「ディスクを拡張してください」 インスタンスタイプを変えてもディスクは拡張されません。
moonlight4_6_17

2021/05/09 04:31

いったん、インスタンス停止後→ディスクの拡張 で解決しました。 ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問