WestMichiganRubyTraining / discussion

Create issues on this repository to open discussion threads in the Issue Tracker!
2 stars 0 forks source link

Intermediate Ruby Challenge #65

Open matthew-p opened 10 years ago

matthew-p commented 10 years ago

I put some time into the intermediate challenge: http://billgathen.com/ruby_challenges.html

result: http://arcane-forest-3130.herokuapp.com/ https://github.com/matthew-p/artii-hello

heroku isn't really the best host for this, as the ephemeral file system winds up clearing the Yaml file, but the price recommends it.

issues: the tests should probably be done in capybara, but I was having trouble getting it working on my system & just did it in regular rspec.

/kill-yaml 'works', but it's not a very good solution.

atkolkma commented 10 years ago

I'm not sure I understand what you mean by Heroku 'clearing the yaml file'. Sorry, I'm a bit new here.

matthew-p commented 10 years ago

Heroku uses an 'ephemeral file system', where you can write to & read files that are stored in a temporary file system that will be discarded when Heroku winds down that particular dyno instance. https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem

Retaining data past the wind down would require the use of a database. However, I believe the pedagogical point of the intermediate exercise was to introduce the concept of storing & retrieving information, without the added complication of introducing a database package (which appears to be reserved for the 'advanced' section). Hence, the requirement to use Yaml::Store, as a Yaml file is basically a text file, making persisting data to it relatively straightforward in ruby. See: http://robm.me.uk/ruby/2014/01/25/pstore.html

because deploying to heroku is so easy (and free), I used it here to show that the code works as intended, even though the ephemeral nature of the file system means that every time the dyno winds down, the content stored in the yaml file will be discarded.

billgathen commented 10 years ago

I think you've certainly proven the concept! I originally imagined it as a locally-hosted app, but then you can't exactly show it off between meetings. :smile:

I'd be interested in the simplest free data store option you can find. I know Heroku offers free Postgres DBs, but that does add complexity and it's really overkill for the use case. We use databases so often that it's often the first and only thing we think of for storing data, but a better fit might be a key-value store like Redis with timestamps as keys and the supplied strings as values.

atkolkma commented 10 years ago

Heroku also offers a free Redis option. Limited, of course. https://addons.heroku.com/marketplace/redistogo

@billgathen I really would like to learn more about storage options, including Redis. Storage might be a cool module to add on to the tutorials, as well.