Latest version of Building Cloud Castles, given at LRUG in April 2011.
A year ago, I was a committed VPS and dedicated-machine deployer. I thought the cloud imposed silly restrictions - how dare you take away my shell account! Whaddya mean I can't save files locally?
Since then, I've had some interesting experiences. I've worked on big cloud-deployed systems, and certain large traditionally-deployed systems, and I've seen how a lot of the decisions that you're ... encouraged to make when designing an app to run in the cloud. Most interestingly, I've discovered how those same decisions can make for a much better app regardless of where it'll end up. In this talk, I'll share those architectural patterns with you, and show why they work. Hopefully, I'll convince all of you to build cloud castles -- even if you've got your foundation firmly on the ground.
7. LOCAL
$ ssh deploy@production.server.com
Linux production.server #1 SMP Sat Dec 5 16:04:55 UTC 2009 i686
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
Last login: Fri Jan 28 16:33:49 2011 from local.host
deploy@production:~$ cd /var/log/apache2
deploy@production:/var/log/apache2$ tail error.log
[Sun Jan 23 06:25:02 2011] [notice] Apache/2.2.12 (Ubuntu) Phusion_Passenger...
[Tue Jan 25 15:21:42 2011] [error] [client 118.129.166.97] Invalid URI in ...
[Fri Jan 28 12:01:50 2011] [error] [client 85.132.70.133] client sent HTTP/1...
[Sun Jan 30 06:25:06 2011] [notice] SIGUSR1 received. Doing graceful restart
9. CLOUD
$ heroku logs --remote production
2011-04-11T01:34:22-07:00 app[web.1]: Rendered text template within layout...
2011-04-11T01:34:22-07:00 app[web.1]: Completed 200 OK in 54ms
2011-04-11T01:34:30-07:00 app[web.3]: Rendered text template within layout...
2011-04-11T01:34:30-07:00 app[web.3]: Completed 200 OK in 111ms (Views:57....
2011-04-11T08:34:42+00:00 heroku[router]: GET devcenter.heroku.com/article...
2011-04-11T01:34:42-07:00 heroku[nginx]: GET /articles/facebook HTTP/1.0 |...
2011-04-11T01:34:42-07:00 app[worker.1]: [Worker(host:railgun64.53370 pid:...
2011-04-11T01:34:42-07:00 app[worker.1]: [Worker(host:railgun64.53370 pid:...
14. LOCAL
$ ssh deploy@production.server.com
Linux production.server #1 SMP Sat Dec 5 16:04:55 UTC 2009 i686
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
Last login: Fri Jan 28 16:33:49 2011 from local.host
deploy@production:~$ cd /var/www/app/current/
deploy@production:/var/www/app/current$ rails console production
Loading production environment (Rails 3.0.3)
>> Article.count
=> 112
>> Article.where(:problem => true).update_attributes(:problem => false)
15. CLOUD
require 'test_helper'
class ArticleTest < ActiveSupport::TestCase
context 'Broken articles' do
setup do
5.times.do { Factory :broken_article }
end
should 'be fixable' do
assert_equal 5, Article.where(:problem => true).count
Article.fix_problem_articles
assert_equal 0, Article.where(:problem => true).count
end
end
end
class Article
def self.fix_problem_articles
where(:problem => true).update_attributes(:problem => false)
end
end