cd /var/discourse git pull ./launcher rebuild app
cd /var/discourse git pull ./launcher rebuild app
Tried, still getting errors… Following is the stuff copied from the command line that opens while updating from the admin panel.
*** Please be patient, next steps might take a while *** ******************************************************** $ bundle install --deployment --without test --without development Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Fetching gem metadata from https://rubygems.org/ Fetching version metadata from https://rubygems.org/ Fetching dependency metadata from https://rubygems.org/ Using rake 10.5.0 Using i18n 0.7.0 Using json 1.8.3 Using minitest 5.8.4 Using thread_safe 0.3.5 Using builder 3.2.2 Using erubis 2.7.0 Installing mini_portile2 2.1.0 Installing pkg-config 1.1.7 Using rack 1.6.4 Using mime-types 2.99.1 Using arel 6.0.3 Using jmespath 1.1.3 Using babel-source 5.8.34 Using execjs 2.6.0 Using ember-source 1.12.2 Using byebug 8.2.1 Using certified 1.0.0 Using coderay 1.1.0 Using concurrent-ruby 1.0.2 Using connection_pool 2.2.0 Using crass 1.0.2 Using daemons 1.2.3 Using diff-lcs 1.2.5 Using thor 0.19.1 Using discourse_fastimage 2.0.0 Using docile 1.1.5 Using unf_ext 0.0.7.1 Using email_reply_trimmer 0.1.3 Installing eventmachine 18.104.22.168 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/eventmachine-22.214.171.124/ext /usr/local/bin/ruby -r ./siteconf20160522-8243-1yibai4.rb extconf.rb Cannot allocate memory - /usr/local/bin/ruby -r ./siteconf20160522-8243-1yibai4.rb extconf.rb 2>&1 Gem files will remain installed in /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/eventmachine-126.96.36.199 for inspection. Results logged to /var/www/discourse/vendor/bundle/ruby/2.0.0/extensions/x86_64-linux/2.0.0-static/eventmachine-188.8.131.52/gem_make.out Using excon 0.45.4 Using exifr 1.2.4 Using fabrication 2.9.8 Using fakeweb 1.3.0 Using multipart-post 2.0.0 Using fast_blank 1.0.0 Installing fast_stack 0.2.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/fast_stack-0.2.0/ext/fast_stack /usr/local/bin/ruby -r ./siteconf20160522-8243-b66lhp.rb extconf.rb Cannot allocate memory - /usr/local/bin/ruby -r ./siteconf20160522-8243-b66lhp.rb extconf.rb 2>&1 Gem files will remain installed in /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/fast_stack-0.2.0 for inspection. Results logged to /var/www/discourse/vendor/bundle/ruby/2.0.0/extensions/x86_64-linux/2.0.0-static/fast_stack-0.2.0/gem_make.out Using fast_xs 0.8.0 Using ffi 1.9.10 Using flamegraph 0.9.5 Using fspath 2.1.1 Using sorcerer 1.0.2 Using guess_html_encoding 0.0.11 Using hashie 3.4.3 Using highline 1.7.8 Using hiredis 0.6.1 Using htmlentities 4.3.4 Using http_accept_language 2.0.5 Using image_size 1.4.1 Using in_threads 1.3.1 Using progress 3.1.1 Using jwt 1.5.2 Using kgio 2.10.0 Using libv8 184.108.40.206 Using listen 0.7.3 Using logster 1.2.3 Using lru_redux 1.1.0 Using metaclass 0.0.4 Using method_source 0.8.2 Using mock_redis 0.15.4 Using moneta 0.8.0 Using msgpack 0.7.4 Using multi_json 1.11.2 Using multi_xml 0.5.5 Using mustache 1.0.3 Using netrc 0.11.0 Using oauth 0.4.7 Using oj 2.14.3 Using ruby-openid 2.7.0 Using redis 3.3.0 Using pg 0.18.4 Using slop 3.6.0 Using puma 3.2.0 Using r2 0.2.6 Using bundler 1.12.0 Using rails_multisite 1.0.4 Using raindrops 0.15.0 Using rb-fsevent 0.9.7 Using trollop 2.1.2 Using ref 2.0.0 Using rinku 1.7.3 Using rmmseg-cpp 0.2.9 Using rspec-support 3.2.2 Using rtlit 0.0.5 Using sass 3.2.19 Using tilt 2.0.2 Using shoulda-context 1.2.1 Using simple-rss 1.3.1 Using simplecov-html 0.10.0 Using spork 1.0.0rc4 Using timecop 0.8.0 Using rake-compiler 0.9.9 Using tzinfo 1.2.2 Installing nokogiri 1.6.8.rc3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.8.rc3/ext/nokogiri /usr/local/bin/ruby -r ./siteconf20160522-8243-7ly6nb.rb extconf.rb Cannot allocate memory - /usr/local/bin/ruby -r ./siteconf20160522-8243-7ly6nb.rb extconf.rb 2>&1 Gem files will remain installed in /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.8.rc3 for inspection. Results logged to /var/www/discourse/vendor/bundle/ruby/2.0.0/extensions/x86_64-linux/2.0.0-static/nokogiri-1.6.8.rc3/gem_make.out Using rack-test 0.6.3 Using message_bus 2.0.0.beta.11 Installing rack-mini-profiler 0.10.1 Using rack-protection 1.5.3 Using mail 2.6.4 Using aws-sdk-core 2.2.9 Using babel-transpiler 0.7.0 Using uglifier 2.7.2 Using barber 0.11.1 Using ember-data-source 1.0.0.beta.16.1 Using sprockets 3.6.0 Using unf 0.1.4 An error occurred while installing eventmachine (220.127.116.11), and Bundler cannot continue. Make sure that `gem install eventmachine -v '18.104.22.168'` succeeds before bundling.
I tried “gem install bundler” as suggested by the logs, but that doesn’t work either.
It looks like this is your problem:
“Cannot allocate memory”
The solution here is to stop apache, stop mysql, stop all the services you can, temporarily, such that you have free RAM and can build the gems. Then post-build you can restart them.
Failing that if you’re on a virtual machine pay for more RAM.
Or add a swap file or increase the size of your swap file.
Good point. I guess take a look at this recent discussion:
i use a 2 GB RAM server…and i have almost 1 GB free… pretty sure that is free enough.
Any other ideas?
If you read the link above, then visit the swap-file page you’ll see this:
We recommend a 2GB swap file for Discourse, unless your server has 4GB or more of memory.
I think that means that you should add the swap file and/or upgrade your RAM.
i see… i’ll check that now. Thanks
I had this exact issue - Discourse on DO with 2GB RAM and no swap worked fine, except for updating from the Discourse dashboard. So I would always rebuild the app via SSH instead.
Adding 1GB swap file fixed it for me; updating from the dashboard now works.
I have some basic questions about creating a swap file -
1.) since i run a 2GB ram server, what should be the size of the swap that i create, and why?
2.) How will creating a swap file affect my server? If i create a 1 GB swap, will 1 GB be reserved just for the system processes for Discourse?
3.) As the forum grows, will i need to increase the size of the swap? What will determine how much should it be increased? And will the method to increase the swap be the same?
Just 2gb swap file is needed, it will mostly be used only during upgrades. If you have 4gb or more ram you may not need the swapfile.
sorry for the dumb queston, but will the swap file take 2 gb from the ram or from the storage drive?
From the disk only, that is the purpose of swap.
Done. Created a 2 GB swap file and the upgrade works like a charm.
Here is the process - Create a swapfile for your Linux server
Just want to add in - making the swap takes an additional around 300 MB of RAM. My total RAM usage for a starting forum is like 1700 MB now.
Discourse does take a toll on the RAM, but i guess it’s worth it.
Swap does not “take” RAM. Swap adds fake RAM from disk. When apps are out of memory, rather than failing due to being unable to allocate memory, they can use disk as a very slow alternative to memory.
It is the difference between failing completely with
out of memory and slowing down for a little bit.
actually, i do see an additional RAM usage on my new relic server monitor. Here is a screenshot. (swap memory is in pink)
OK, but that’s totally unrelated to the swapfile change. Please read the above links I cited. Thanks.
No, it is related - as there’s more space to work with, the OS can keep more files cached in RAM with sleeping applications swapped out. Which probably improved performance.
Yes, but this is only true on a technicality – the total physical amount of RAM in the system is the same.