
Why the Usage of Instrumentation Within Monitoring Tools Should be Implemented in Your Next Web Project
Back-EndWhen designing a web application, a strategy that has often been used is to use a monitoring tool such as Grafana or Datadog. There...
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
When designing a web application, a strategy that has often been used is to use a monitoring tool such as Grafana or Datadog. There...
There are several design patterns used these days in the .NET ecosystem. What are they? What are the benefits and drawbacks of each pattern?...
As a full-stack web developer, I attended SRECon to expand my thinking about the reliability and observability of the services I develop. Here are...