A Machine for Gifs
- Need an excuse to show a gif to your coworkers?
- Need a use for that Raspberry Pi that isn't doing anything useful?
- Need a web-scale solution to your animated gif needs?
Presenting the newest GMaaS (Gif Machine as a Service) solution for your tech company with a startup culture: gifmachine
- gifmachine is a Ruby Sinatra app that provides a dirty interface for enjoying gifs with your coworkers. gifmachine provides a HTTP API for posting gifs and meme text to overlay.
- gifmachine allows your coworkers to complain about
company_x
's broken API when it goes down and laugh as the internet catches fire. - gifmachine is designed to be run in kiosk mode on an unused computer and monitor, it's just a webpage that puts the gif meme in fullscreen.
It mostly does! When it is working well...
- gifmachine uses WebSockets to send out updates to connected clients.
- gifmachine stores everything in a database (developed with Postgres, but it shouldn't be too hard to change that).
- gifmachine uses ActiveRecord to save the developer time and calories.
- Get RVM
- Using RVM, install Ruby 2.6.5
rvm install 2.6.5
- Run
bundle install
- Get Postgres 9.6 or newer
- Create a database locally called
gifmachine
(you can run:bundle exec rake db:create
) - Set your RACK_ENV (e.g.
export RACK_ENV='development'
) bundle exec rake db:migrate
to load the database schema into the database- Set an API password with
export GIFMACHINE_PASSWORD=foo
- Run
ruby app.rb
to start the server - Browse to
http://localhost:4567
Using curl
you can post a gif and some text to register it in the gifmachine
curl --data 'url=http://www.example.com/somegif.gif&who=thatAmazingPerson&meme_top=herp&meme_bottom=derp&secret=yourSuperSecretPasswordFromAppRb' 'http://yourGifMachineUrl/gif'
To run in production, you will need the following:
- Pass the environment variable
RACK_ENV=production
- You will want to setup a Postgres database, and then run
bundle exec rake db:create && bundle exec rake db:migrate
against it before running the app. - You will pass in an environment variable
DATABASE_URL
of the formatpostgres://username:password@database-url:5432/database-name
- Lastly, you will also want to set a password for the API, via the environment variable
GIFMACHINE_PASSWORD
.