-
Notifications
You must be signed in to change notification settings - Fork 2
Hosting Your Own Ohai on Heroku
"Ohai it's me" runs on Heroku. For free!
- From terminal, navigate to the directory where you store your webapp projects and clone the repo:
cd /my/projects
git clone [email protected]:giffc/ohai_its_me.git
(Or you could fork the project first and clone that repo instead.)
You can put in your name and a new header image by editing app/views/shared/_about_header.html.erb. The default header image is 440px x 150px. There are two examples in public/images: temp_img.jpg (taken by Chris Carella) and temp_img2.jpg (taken by Giff Constable).
On fonts: the current repo points to Typekit, which will break on your version. You can switch to font-face if you want to host your own fonts, replace the Typekit javascript with your own, or switch to google webfonts. The typekit javascript is in app/views/shared/_webfont_script.html.erb. You will also want to update screen.css.scss with your new font choices.
- Sign up if you haven't yet: http://www.heroku.com/
- Install the heroku toolbelt: https://toolbelt.herokuapp.com/
- Create a new app. From the terminal:
heroku login
cd /my/projects/ohai_its_me
heroku create --stack cedar
- Point your custom domain to your heroku app: https://devcenter.heroku.com/articles/custom-domains
You don't have to use all the apps. Just set up the apps you want. If you have an app already registered to use on localhost or another domain, you'll have to register a new app for heroku b/c it's on a new domain.
- Twitter (https://dev.twitter.com/apps)
- Set the callback url:
http://yourdomain.com/auth/twitter/callback
- Save on Heroku:
heroku config:add TWITTER_KEY="Consumer key value"
heroku config:add TWITTER_SECRET="Consumer secret value"
- Instagram (http://instagr.am/developer/clients/manage/)
- Set the redirect_uri:
http://yourdomain.com/auth/instagram/callback
- Save on Heroku:
heroku config:add INSTAGRAM_KEY="Client id value"
heroku config:add INSTAGRAM_SECRET="Client secret value"
- Tumblr (http://www.tumblr.com/oauth/apps)
- Set the callback url:
http://yourdomain.com/auth/tumblr/callback
- Save on Heroku:
heroku config:add TUMBLR_KEY="OAuth Consumer Key value"
heroku config:add TUMBLR_SECRET="Secret Key value"
- Foursquare (https://foursquare.com/oauth/)
- Set the callback url:
http://yourdomain.com/auth/foursquare/callback
- Save on Heroku:
heroku config:add FOURSQUARE_KEY="Client ID value"
heroku config:add FOURSQUARE_SECRET="Client ID value"
- Last.fm (http://www.last.fm/api/account)
- Set the callback url:
http://yourdomain.com/auth/lastfm/callback
- Save on Heroku:
heroku config:add LASTFM_KEY="API Key value"
heroku config:add LASTFM_SECRET="secret value"
Unlike apps above, you can use the same embed.ly key on multiple sites. Just watch out b/c you have to pay once you're over 10,000 requests/month.
- Create a free embed.ly account if you don't have one https://app.embed.ly/pricing/free
- Save your key on Heroku:
heroku config:add EMBEDLY_KEY="your embedly key"
git push heroku master
heroku run rake db:setup
heroku run console
>> u = User.create(:username => 'yourusername', :email => '[email protected]', :name => 'yourname', :password => 'yourpassword', :password_confirmation => 'yourpassword')
>> u.description = "/images/temp_img.jpg" # Or put a new image in public/images and change to that filename
>> u.save
- Visit http://yourdomain.com/signin
- Signin with the username and password you chose above
- Go to http://yourdomain.com/accounts
- You should see all the services you registered earlier. If you don't see them, make sure you saved the keys on heroku!
- Click the buttons to add and authorize accounts
Adding an account doesn't import any data for you. To get data on the site, run:
$ heroku run console
>> User.first.linked_accounts.each{|a| a.import}
To get the full backlog (this can take a while!!!), run:
$ heroku run console
>> User.first.linked_accounts.each{|a| begin a.import_backlog; rescue; end}
Heroku Scheduler will fire up a worker to import data. It works a lot like cron, but counts toward your dyno-hours so keep an eye on it. Running once an hour should be fine for most people.
- Install the addon:
heroku addons:add scheduler:standard
- Open the scheduler:
heroku addons:open scheduler
- On the dashboard, click add job. Set the job to run once an hour. The job is:
rake import_data
- Run it from the web to confirm it works.
Check out your site!
Want to change your profile image? Here's how!
- Add a new file to public/images
- Push it to heroku
git commit -am "new image"
git push heroku master
- Update your user record in the db:
u = User.first
u.description = "/images/new_file_name.png"
u.save
- Check it out!