Four Key Reasons to Learn Markdown
Back-End Leveling UpWriting documentation is fun—really, really fun. I know some engineers may disagree with me, but as a technical writer, creating quality documentation that will...
Sometimes our Ruby on Rails apps work perfectly with test data, but when they go to production, errors creep in. Debugging errors on a production server is a pain and a bit dangerous.
Here’s what we do to quickly and safely debug issues on our production servers:
1. Add the following capistrano task to create an SQL dump of your data. If it’s a large database, it may be worthwhile to compress the SQL dump as well.
desc "Exports the production db to the home directory of user" task :db_dump, :roles => [:app, :db] do run("mysqldump -u #{database_username} --password=#{database_password} #{application}_production > production.sql") end
2. Create the following rake tasks to grab database dump and import the data locally.
namespace :db do desc 'Grab a dump of the production database on the server and places it in db/production.sql.' task :get_production do `cap db_dump` `scp DEPLOY_USER@SERVER_NAME.slingshothosting.com:production.sql #{RAILS_ROOT}/db/production.sql` end desc 'Imports the database dump of file db/production.sql into development.' task :import do `mysql -u root app_name_development < db/production.sql` end desc 'Grabs a dump of the production database from the server and imports the data into the local development database.' task :get_import => [ :get_production, :import ] end
3. Install the Firefox plugin Server Switcher to make it easy to switch between the production and local server in your web browser.
4. Disable mail in your development box – it’s not a good feeling when you realize you’ve emailed several thousand users while testing out a newsletter script.
config.action_mailer.delivery_method = :test
Writing documentation is fun—really, really fun. I know some engineers may disagree with me, but as a technical writer, creating quality documentation that will...
Humanity has come a long way in its technological journey. We have reached the cusp of an age in which the concepts we have...
Go 1.18 has finally landed, and with it comes its own flavor of generics. In a previous post, we went over the accepted proposal and dove...