Project

sqs_web

0.0
No commit activity in last 3 years
No release in over 3 years
Web interface for SQS inspired by delayed_job_web
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 1.4.4
 Project Readme

sqs_web

Build Status Code Climate Test Coverage

A delayed_job_web inspired (read: stolen) interface for SQS. This gem was written to work anchored within rails 3 and 4 applications.

Some features:

  • Easily view messages visible and in-flight in your configured SQS queues
  • Move any single enqueued message, or all enqueued messages, from a DLQ to the corresponding active queue
  • Remove an enqueued message, or easily remove all enqueued messages from a DLQ
  • View overview stats for the queues

The interface:

Screen shot

Quick Start For Rails 3 and 4 Applications

Add the dependency to your Gemfile

gem "sqs_web"

Install it...

bundle

Add the following route to your application for accessing the interface, and actions related to the messages.

match "/sqs" => SqsWeb, :anchor => false, via: [:get, :post]

You probably want to password protect the interface, an easy way is to add something like this your config.ru file

if Rails.env.production?
  SqsWeb.use Rack::Auth::Basic do |username, password|
    username == 'username' && password == 'password'
  end
end

sqs_web runs as a Sinatra application within the rails application. Visit it at /sqs.

Supported SqsWeb configuration options

The aws section is used to configure the Aws objects used by sqs_web internally. The sqs_web-specific keys are listed below, and you can expect any other key defined in that block to be passed on untouched to Aws::SQS::Client#initialize:

  • access_key_id : AWS Access Key. If not set will default to environment variable AWS_ACCESS_KEY_ID or instance profile credentials
  • secret_access_key : AWS Secret Access Key. If not set will default to environment variable AWS_SECRET_ACCESS_KEY or instance profile credentials.
  • region: AWS region for the SQS queue. If not set will default to environment variable AWS_REGION or else to us-east-1.
  • sqs_endpoint can be used to explicitly override the SQS endpoint. If not set will default to environment variable AWS_SQS_ENDPOINT or default SQS endpoint.

SqsWeb.options[:queues] supports an array of strings for the SQS queue names.

SqsWeb.options[:queues] =  ["TestSourceQueue", "TestSourceQueueDLQ"]

Notes

Currently, this was written in mind for being only used for DLQ management. The AWS SQS Management Console should have most of the functionality that you would want out of the box, this plugin is not meant as a replacement for the AWS SQS Management Console, but rather as a supplement. There are some features that are not implemented yet (e.g. moving a message from a DLQ back to the source queue) in the AWS Console, and there are some additional benefits for the management screen to live within the application.

This is not to say there are some features that may be duplicated or added to this plugin as it advances. In addition, our internal applications are using Shoryuken which uses message attributes (e.g. ApproximateReceiveCount) that become "invalid" once you pick up the message from an active queue. There is greater freedom when managing a DLQ, since this plugin is assuming that the management console (or the AWS SQS Management Console) are the only consumers of the DLQ, which solves the complexity of these message attributes.

Serving static assets

If you mount the app on another route, you may encounter the CSS not working anymore. To work around this you can leverage a special HTTP header. Install it, activate it and configure it -- see below.

Apache

XSendFile On
XSendFilePath /path/to/shared/bundle

XSendFilePath white-lists a directory from which static files are allowed to be served. This should be at least the path to where delayed_job_web is installed.

Using Rails you'll have to set config.action_dispatch.x_sendfile_header = "X-Sendfile".

Nginx

Nginx uses an equivalent that's called X-Accel-Redirect, further instructions can be found in their wiki.

Rails' will need to be configured to config.action_dispatch.x_sendfile_header = "X-Accel-Redirect".

Lighttpd

Lighty is more X-Sendfile, like outlined in their wiki.

Contributing

  • To bootstrap a fake_sqs environment for development purposes, run the following:
bundle exec ruby scripts/bootstrap_queues.rb
  1. Fork
  2. Hack
  3. rake test
  4. Send a pull request

Releasing a new version

  1. Update the version in sqs_web.gemspec

  2. bundle install

  3. git commit sqs_web.gemspec with the following message format:

     Version x.x.x
    
     Changelog:
     * Some new feature
     * Some new bug fix
    
  4. rake release