Skip to content

Latest commit

 

History

History
101 lines (74 loc) · 2.5 KB

README.md

File metadata and controls

101 lines (74 loc) · 2.5 KB

CutePetsCologne

Post an random pet from shelters Zollstock and Dellbrück on Twitter @CutePetsCologne

About

Originated as a project of Team Denver during the 2014 fellowship at Code for America. Originally specific to Denver, it's been redeployed by a few cities. Check out this twitter list to see where. CutePetsCologne is mainly based on CutePetsChemnitz

Links to Bot

Setup & Deployment

e.g. on a server running Ubuntu

Using root user

iojs

npm

  • Install npm
sudo apt-get install npm

ruby

sudo apt-get install ruby ruby-dev rake
sudo gem install bundler

Repo

  • Clone the repo to some $path
cd $path
git clone https://github.com/karen-sch/CutePetsCologne.git
cd CutePetsCologne

API

The API is available via http://127.0.0.1:3000/

Install

cd API
npm install
npm run build

Run

node lib/scraper.js

Deploy

sudo ln -s /$path/CutePetsCologne/API/petscologne /etc/init.d
sudo update-rc.d petscologne defaults
sudo mkdir /var/cache/petscologne
sudo service petscologne start

Twitter

  1. Create a new twitter app.
  2. On the API key tab for the Twitter app, modify permissions so the app can Read and Write.
  3. Create an access token. On the API Key tab in Twitter for the app, click Create my access token
  4. Take note of the values for environment set up below. Note: It's important to change permissions to Read/Write before generating the access token. The access token is keyed for the specific access level and will not be updated when changing permissions.

Environmental variables

  1. Create a local .env file: cp template.env .env
  2. Fill in the twitter keys created above.

Install

bundler install

Run

rake

Deploy

Adding a cronjob:

5 9-22/2 * * * root cd /$path/CutePetsCologne && rake

Hat tips