diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 74ea48ffa..62edc6672 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -34,6 +34,7 @@ Contributors * Nick Fagerlund * Nick Lewis * Nigel Kersten +* Pascal Vibet * Patrick Carlisle * Paul Berry * Peter Meier diff --git a/README.markdown b/README.markdown index 5b85bb698..981135081 100644 --- a/README.markdown +++ b/README.markdown @@ -73,7 +73,7 @@ bundle install --deployment ```` * You need to create a secret for production and either set it via environment variable: `export SECRET_KEY_BASE=$(bundle exec rails secret)` - or follow the instructions in config/secrets.yml to setup an encrypted secret. + or follow the instructions in config/secrets.yml to setup an encrypted secret. * Setup database and pre-compile assets ```` RAILS_ENV=production bundle exec rake db:setup && \ @@ -96,9 +96,17 @@ precompile assets for production using: * `SECRET_KEY_BASE=none RAILS_ENV=production bundle exec rails assets:precompile` +Dashboard will keep all reports in the database. If your infrastructure is big the database will +eventually become very large (more than 50GB). To periodically purge old reports (~ once per day) +and optimize the database tables (~ once per month) it is recommended to run the following tasks +periodically: + + * `SECRET_KEY_BASE=none RAILS_ENV=production bundle exec rails reports:prune upto=20 unit=day` + * `SECRET_KEY_BASE=none RAILS_ENV=production bundle exec rails db:raw:optimize` + Contributing ------------ -To contribute to this project, please read [CONTRIBUTING](CONTRIBUTING.md). -A list of contributors is found in [CONTRIBUTORS](CONTRIBUTORS.md). Thanks! +To contribute to this project, please read [CONTRIBUTING](CONTRIBUTING.md). +A list of contributors is found in [CONTRIBUTORS](CONTRIBUTORS.md). Thanks! This project uses the [Silk icons](http://www.famfamfam.com/lab/icons/silk/) by Mark James. Thank you! diff --git a/lib/tasks/db_raw.rake b/lib/tasks/db_raw.rake index 3b65df55b..9daa16393 100644 --- a/lib/tasks/db_raw.rake +++ b/lib/tasks/db_raw.rake @@ -57,10 +57,16 @@ namespace :db do case adapter when 'mysql', 'mysql2' puts "Optimizing tables, this may take a while:" - for table in ActiveRecord::Base.connection.select_values('SHOW TABLES').sort + for table in ActiveRecord::Base.connection.tables.sort puts "* #{table}" ActiveRecord::Base.connection.execute("OPTIMIZE TABLE #{table}") end + when 'postgresql' + puts "Optimizing tables, this may take a while:" + for table in ActiveRecord::Base.connection.tables.sort + puts "* #{table}" + ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table}") + end else raise "Don't know how to optimize for database engine: #{adapter}" end