From ced7a34afad07f1d446bed24e37844a8ce964708 Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Mon, 17 Oct 2016 15:53:37 -0700 Subject: [PATCH] additional fixes for install script --- Gemfile | 1 + Gemfile.lock | 2 ++ INSTALL.debian | 4 +++- config/danbooru_default_config.rb | 2 +- config/initializers/z_dalli.rb | 15 +++++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 77aba0a84..290b83686 100644 --- a/Gemfile +++ b/Gemfile @@ -57,6 +57,7 @@ gem 'dtext_rb', :git => "https://github.com/r888888888/dtext_rb.git", :require = gem 'google-api-client' gem 'cityhash' gem 'bigquery', :git => "https://github.com/abronte/BigQuery.git", :ref => "b92b4e0b54574e3fde7ad910f39a67538ed387ad" +gem 'memcache_mock' # needed for looser jpeg header compat gem 'ruby-imagespec', :require => "image_spec", :git => "https://github.com/r888888888/ruby-imagespec.git", :branch => "exif-fixes" diff --git a/Gemfile.lock b/Gemfile.lock index dd3fa0ae5..b3bfbf37d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -210,6 +210,7 @@ GEM ntlm-http (~> 0.1, >= 0.1.1) webrobots (>= 0.0.9, < 0.2) memcache-client (1.8.5) + memcache_mock (0.0.14) memoist (0.14.0) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) @@ -439,6 +440,7 @@ DEPENDENCIES kgio mechanize memcache-client + memcache_mock mocha net-sftp net-ssh diff --git a/INSTALL.debian b/INSTALL.debian index 22faf48d7..14ba3937a 100644 --- a/INSTALL.debian +++ b/INSTALL.debian @@ -34,7 +34,7 @@ export GITHUB_INSTALL_SCRIPTS=https://raw.githubusercontent.com/r888888888/danbo # Install packages echo "* Installing packages..." apt-get update -apt-get -y install build-essential automake libssl-dev libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev imagemagick libmagickcore-dev libmagickwand-dev sendmail-bin sendmail postgresql postgresql-contrib libpq-dev postgresql-server-dev-all nginx ssh coreutils +apt-get -y install build-essential automake libssl-dev libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev imagemagick libmagickcore-dev libmagickwand-dev sendmail-bin sendmail postgresql postgresql-contrib libpq-dev postgresql-server-dev-all nginx ssh coreutils ffmpeg mkvtoolnix if [ $? -ne 0 ]; then echo "* Error installing packages; aborting" @@ -132,6 +132,8 @@ echo "*" echo "* You can also run a server locally without having to deal with deploys" echo "* by running the following command:" echo "*" +echo "* bundle install" +echo "* bundle exec rake db:create db:migrate" echo "* bundle exec rails server" echo "*" echo "* This will start a web process running on port 3000 that you can" diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 1067c75a9..5796af6c2 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -98,7 +98,7 @@ module Danbooru # List of memcached servers def memcached_servers - %w(localhost:11211) + %w(127.0.0.1:11211) end # After a post receives this many comments, new comments will no longer bump the post in comment/index. diff --git a/config/initializers/z_dalli.rb b/config/initializers/z_dalli.rb index 13da0f479..c1ceafb80 100644 --- a/config/initializers/z_dalli.rb +++ b/config/initializers/z_dalli.rb @@ -2,6 +2,21 @@ unless defined?(MEMCACHE) MEMCACHE = Dalli::Client.new(Danbooru.config.memcached_servers, :namespace => Danbooru.config.app_name.gsub(/[^A-Za-z0-9]/, "_")) end +begin + MEMCACHE.get("x") +rescue Dalli::RingError => e + puts "-" * 40 + puts "WARNING! MEMCACHE SERVER NOT FOUND! You will experience performance degradation." + puts e.to_s + puts "-- BEGIN STACKTRACE --" + e.backtrace.each do |line| + puts line + end + puts "-- END STACKTRACE --" + puts "-" * 40 + MEMCACHE = MemcacheMock.new +end + if Rails.env.production? Rails.application.configure do config.cache_store = :dalli_store, Danbooru.config.memcached_servers