Skip to content

ECHOInternational/petit

Repository files navigation

Petit: Ruby Url Shortening Service Based on AWS

Build Status

Code Climate

Installation

Add this line to your application's Gemfile:

gem 'petit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install petit

Environment Variables

Petit is designed to be a Twelve Factor app and therefore all configuration should be done using environment variables.

Amazon Web Services:

To use the default DynamoDB you'll need all of the AWS credentials.

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION

These variables set the configuration for the Petit app.

  • DB_TABLE_NAME (Name of the database to create/use)
  • API_BASE_URL (Ususally a HTTPS address with some security applied)
  • SERVICE_BASE_URL (Public base URL like 'http://bit.ly' )
  • NOT_FOUND_DESTINATION (Optional Address where public requests that result in 404 will be sent.)

Database Setup

The default installation of petit relies on DynamoDB. (This can be replaced if you have the need.) In order to bootstrap the application you will need to ensure that the database has been created in your AWS account. An idempotent rake task exists in the rakefile under db:setup. After the environment variables have been set, you can run rake db:setup to set up the requisite DynamoDB database on your AWS account.

Since DynamoDB doesn't require fields to be explicitly created or destroyed migrations are not currently needed or supported.

About The Author(s)

ECHO Inc.

This is an open-source project built by ECHO, an international nonprofit working to help those who are teaching farmers around the world know how to be more effective in producing enough to meet the needs of their families and their communities. ECHO is an information hub for international development practitioners specifically focused on sustainable, small-scale, agriculture. Through educational programs, publications, and networking ECHO is sharing solutions from around the world that are solving hunger problems.

Charity Navigator ranks ECHO as the #1 International Charity in the state of Florida (where their US operations are based) and among the top 100 in the US.

Thanks to grants and donations from people like you, ECHO is able to connect trainers and farmers with valuable (and often hard-to-find) resources. One of ECHO's greatest resources is the network of development practitioners, around the globe, that share help and specialized knowledge with each other. ECHO uses the YourMembership product to help facilitate these connections.

To find out more about ECHO, or to help with the work that is being done worldwide please visit http://www.echonet.org

Contributing

If you find a problem with this code or would like to contribute an improvement please fork and submit a pull request.

If you're a developer that would like to help solve world hunger problems with some of your spare time, we are always looking for talented volunteers. Contact Nate Flood by email: nate [at] echonet [dot] org

  1. Fork it ( https://github.com/ECHOInternational/petit/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

URL Shortener written in Ruby for use on AWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages