Use Gollum for article storage #52

Closed
semmons99 opened this Issue Jun 13, 2012 · 7 comments

2 participants

@semmons99
Elm City Craftworks member

@sandal: I've been playing around with Gollum today and wanted to clarify some assumptions before starting implementation. Here's the requirements I have.

  1. Spawn a new Gollum wiki on the VPS.
  2. Replicate the articles in the PR database in the wiki
  3. Update the PR codebase to use the wiki as a database, pulling articles from it instead of the db.

Please correct or expand on any of these assumptions.

@practicingruby
Elm City Craftworks member

That sounds right. It's okay for the application to just point to an exisiting repository by just having something like GOLLUM_PATH="path/to/repository", it does not need to automatically generate the git repository for us.

Also, what we are really replicating is the articles in http://github.com/elm-city-craftworks/practicing-ruby | Aside from a few missing stub articles (and guest articles), that is the canonical source for our content.

@semmons99
Elm City Craftworks member

Also, what we are really replicating is the articles in http://github.com/elm-city-craftworks/practicing-ruby | Aside from a few missing stub articles (and guest articles), that is the canonical source for our content.

So in theory, we set gollum_path = "path/to/repository" than set :base_path => "posts/" and we'll be pretty well set. Do you want OmniAuth so that contributors can be authenticated to the wiki?

@semmons99
Elm City Craftworks member

I guess the bottom line question from above is, should we be hosting a gollum wiki for creation/editing or just give contributors access to the practicing-ruby repo? If it's the later, we'd only need to use gollum's API to fetch articles and wouldn't have to worry about running http://contrib.practicingruby.com or however we'd go about presenting the wiki to the public.

@practicingruby
Elm City Craftworks member

Oh sorry, I got confused there. We definitely do not need an instance of gollum running. We don't need the UI, just the git repository. You'll use the Gollum Ruby API to pull the raw text and format it within Practicing Ruby's web app.

@semmons99
Elm City Craftworks member

@sandal: I've discovered a potential limitation of Gollum; it can only access local git repos. So, anytime someone pushed a change to elm-city-craftworks/practicing-ruby you'd have to pull that commit down to the local copy. Is that acceptable?

Another option would be to use the Github API (via ocotokit) to access the content. The following code gets the job done.

require "octokit"

client = Octokit::Client.new(login: "bond", password: "007")
blob   = client.get("repos/elm-city-craftworks/practicing-ruby-web/contents/README.md")
data   = Base64.decode64(blob.content)

#=> "# Practicing Ruby\n\nSorry for how bad this README is, we will surely improve it in time. Right now\nthis app is publicly available primarily for the sake of transparency, but\nthere is very little code in here specific to practicingruby.com, so we\ndefinitely want to generalize it eventually. Do feel free to email\n**gregory@mendicantuniversity.org** with any questions you have about this app.\n\nThis project is licensed under the [GNU Affero General Public License 3.0](http://www.gnu.org/licenses/agpl-3.0.html).\nContributors retain copyright to their own code, but must agree to license any\ncode submitted to us under the same license as the project itself.\n\n\n[![Build Status](https://secure.travis-ci.org/elm-city-craftworks/practicing-ruby-web.png?branch=master)](http://travis-ci.org/elm-city-craftworks/practicing-ruby-web)\n\n1. create config/database.yml\n1. create config/initializers/mailchimp_settings.rb\n1. create config/initializers/secret_token.rb\n1. create config/initializers/omniauth.rb\n1. create config/initializers/cache_cooker_settings.rb\n1. run rake db:create\n1. run rake db:migrate\n1. install pygments easy_install Pygments\n"
@practicingruby
Elm City Craftworks member

I don't really want to be even more dependent on github that we already are. We'll be able to make a capistrano task like cap articles:sync, so I'm not worried about the local github repository limitation.

@semmons99
Elm City Craftworks member

Sounds good. I'll move forward with Gollum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment