Open Week -- Deploying Web Applications in the Cloud -- DustinKirkland -- Wed, Oct 13

   1 [18:01] <ClassBot> Logs for this session will be available at following the conclusion of the session.
   2 [18:01] <kirkland> howdy howdy howdy!
   3 [18:01] <kirkland> alright
   4 [18:01] <kirkland> so continuing on with the cloud theme, i'll invite you to join me for a real live demo
   5 [18:02] <kirkland> if you would be so kind as to:
   6 [18:02] <kirkland>   ssh -C
   7 [18:02] <kirkland> the password is 'guest'
   8 [18:02] <kirkland> i'll wait just a minute for people to log in
   9 [18:03] <kirkland> when you get in, you should see a shared Byobu session
  10 [18:03] <kirkland> with the matrix screen saver running
  11 [18:03] <kirkland> i have write access
  12 [18:03] <kirkland> everyone else should have read only access
  13 [18:03] <kirkland> now, i'm going to go through a few examples in that window, that everyone will be able to see
  14 [18:03] <kirkland> however, you're welcome to do the same things on your own system
  15 [18:04] <kirkland> all of what i'm going to do will work on your Ubuntu desktop, server, or virtual machine
  16 [18:04] <kirkland> and if you haven't already, go to for your free hour of Ubuntu in the Cloud :-)
  17 [18:04] <kirkland> okay, so yeah, a free hour in the cloud ... as many people have asked
  18 [18:04] <kirkland> "so I logged in, and that's cool, but .... now what?" :-)
  19 [18:05] <kirkland> well, i find cloud instances great places for writing and deploying web applications
  20 [18:05] <kirkland> many web apps are small, and lightweight, and can work very well in a virtualized cloud environment
  21 [18:05] <kirkland> i'm going to go through a few examples of some sample web apps
  22 [18:05] <kirkland> you may or may not be interested in the particular applications that i demo
  23 [18:05] <kirkland> but hopefully they'll give you a good idea
  24 [18:06] <kirkland> alrighty, any questions before we get started?
  25 [18:06] <kirkland> great ...
  26 [18:07] <kirkland> alright, so first, we're going to deploy a web app in this cloud instance that will allow us to share pictures over the web
  27 [18:07] <kirkland> there are lots of public ones available, like Flickr, Picasa, etc.
  28 [18:07] <kirkland> and those are certainly great for what they are
  29 [18:07] <kirkland> but sometimes, perhaps, you want to run the server yourself
  30 [18:08] <kirkland> or, you don't want to upload your pictures to a 3rd party
  31 [18:08] <kirkland> or perhaps you just want to tinker with the source code, like me :-)
  32 [18:08] <kirkland> Ubuntu includes a number of such web apps
  33 [18:08] <kirkland> i'm going to show you how to deploy, configure, and install one such
  34 [18:08] <kirkland> and I picked it because I wrote it as a college student in 1999 :-)
  35 [18:09] <kirkland> sudo apt-get install pictor
  36 [18:09] <kirkland> i'm doing that in the shared screen session now
  37 [18:09] <kirkland> now i've got a stack of dependencies that are going to be installed
  38 [18:09] <kirkland>
  39 [18:09] <kirkland> ^ if you're not following in screen
  40 [18:10] <kirkland> notice how fast these download and install in the cloud :-)
  41 [18:10] <kirkland> this is because Canonical provides a mirror of the ubuntu archive in EC2 itself
  42 [18:10] <kirkland> note that you're not charged for network bandwidth inside of EC2
  43 [18:10] <kirkland> okay, cool, so now pictor is installed
  44 [18:10] <kirkland> let's point our web browser to it
  45 [18:12] <kirkland> um, i see i have an error message :-)  one second ...
  46 [18:12] <kirkland> Your apache2 configuration is broken, so we're not restarting it for you.
  47 [18:13] <kirkland> (sorry, i just set this up before the session, purged it uncleanly)
  48 [18:14] <kirkland> okay, sorry
  49 [18:14] <kirkland>
  50 [18:14] <kirkland> now it's up
  51 [18:14] <kirkland> so that's the default landing page of pictor
  52 [18:14] <kirkland> to review ...
  53 [18:15] <kirkland> sudo apt-get install pictor
  54 [18:15] <kirkland> i had to sudo service apache2 restart
  55 [18:15] <kirkland> then point a browser to
  56 [18:15] <kirkland> there, i see an error message
  57 [18:15] <kirkland> ERROR
  58 [18:15] <kirkland> No pictures found.
  59 [18:15] <kirkland> Create a symlink to your pictures folder at
  60 [18:15] <kirkland> /usr/share/pictor/pictures
  61 [18:15] <kirkland> so i've seeded this instance with a few pictures
  62 [18:16] <kirkland> in ubuntu's home directory, we should see a Pictures dir
  63 [18:16] <kirkland> which you also have on your Ubuntu desktop
  64 [18:16] <kirkland> inside of the Pictures dir there can be a list of sub dirs
  65 [18:16] <kirkland> and subdirs can have subdirs, etc. etc. etc.
  66 [18:16] <kirkland> and so on
  67 [18:17] <kirkland> our error message at says that we need a symlink
  68 [18:17] <kirkland> to tell pictor where our pictures are located
  69 [18:17] <kirkland> which is /home/ubuntu/Pictures
  70 [18:17] <kirkland> let's do this...
  71 [18:17] <kirkland> sudo ln -s /home/ubuntu/Pictures /usr/share/pictor/pictures
  72 [18:17] <kirkland> now refresh
  73 [18:18] <kirkland> and you should see a list of the available albums
  74 [18:18] <kirkland> click on one of them, and you should either see more subdirs, or thumbnails of pictures
  75 [18:19] <kirkland> looks like my upload did not complete
  76 [18:19] <kirkland> anyway, you get the 'picture' ;-)
  77 [18:19]  * kirkland finishes syncing
  78 [18:20] <kirkland> click on a given picture, and you get meta data details about the photo
  79 [18:20] <kirkland> you can dynamically resize, rotate it, etc.
  80 [18:20] <kirkland> let's take a quick look where this is happening ...
  81 [18:20] <kirkland> cd /var/cache/pictor
  82 [18:20] <kirkland> ls
  83 [18:21] <kirkland> resize  thumbnails
  84 [18:21] <kirkland> there's a set of thumbnails cached here, which are taken out of the JPEG headers (if available), and if not, it uses ImageMagik to create and cache a thumbnail
  85 [18:21] <kirkland> we can clear this cache at any time, and it just gets rebuilt
  86 [18:21] <kirkland> ubuntu@ip-10-202-194-3:/var/cache/pictor/thumbnails$ sudo rm -rf *
  87 [18:22] <kirkland> now, just refresh
  88 [18:22] <kirkland> note that it's easy to drop an .htaccess file in here and make this password protected
  89 [18:23] <kirkland> if you wanted to make these somewhat more "private"
  90 [18:23] <kirkland> and there's no database at all
  91 [18:23] <kirkland> all of pictor is driven from the filesystem and metadata included in the JPG
  92 [18:23] <kirkland> so it's trivial to move pictures around
  93 [18:23] <kirkland> upload more, etc.
  94 [18:24] <kirkland> also, it comes with a handy little utility called "pictor-unload"
  95 [18:24] <kirkland> which you can use to keep pictures from multiple cameras in sync
  96 [18:24] <kirkland> so if i'm shooting with one camera, and my wife is shooting with another
  97 [18:24] <kirkland> and their two clocks are in sync
  98 [18:25] <kirkland> we can unload the two flash cards, and name the pics accordingly
  99 [18:25] <kirkland> let me try to fake a demo of that ...
 100 [18:25] <kirkland> since clouds don't have flash media :-)
 101 [18:26] <kirkland> okay, let's pretend that /media/flash is my flash disk
 102 [18:26] <kirkland> and in there, there's a subdir of some pictures
 103 [18:26] <kirkland> and i want to "unload" those
 104 [18:27] <kirkland> let's make a new destination directory
 105 [18:27] <kirkland> pictor-unload /media/flash /home/ubuntu/Pictures/More\ Puppies
 106 [18:28] <kirkland> okay, now i have a copy of the pics in the current dir, renamed with their timestamp on the front
 107 [18:28] <kirkland> this helps keep things in order
 108 [18:28] <kirkland> and now, goto
 109 [18:29] <kirkland> and you see that the new pics are up already
 110 [18:29] <kirkland> okay ... so that a whirlwind tour of pictor
 111 [18:29] <kirkland> a fun little web app to deploy in the cloud (though you could just as easily do so on a server or a desktop)
 112 [18:29] <kirkland> let's now take a look at it's more musical cousin ...
 113 [18:29] <kirkland> musica
 114 [18:30] <kirkland> musica is a web app for streaming music
 115 [18:30] <kirkland> it's a nice way of accessing your entire music library remotely
 116 [18:30] <kirkland> (and another web app i wrote in college, back in 1998-1999)
 117 [18:30] <kirkland> sudo apt-get install musica
 118 [18:31] <kirkland> alrighty, just like that, musica is now installed
 119 [18:31] <kirkland> now, point your browser to
 120 [18:31] <kirkland> once again, we see that we need to put a symlink in place to tell musica where to find our tunes
 121 [18:32] <kirkland> and once again, i've preloaded this cloud instance with a few tunes from some of my musical friends
 122 [18:32] <kirkland> can everyone get to okay?
 123 [18:33] <kirkland> alright, now let's create that symlink
 124 [18:33] <kirkland> sudo ln -s /home/ubuntu/Music /usr/share/musica/music
 125 [18:33] <kirkland> and refresh
 126 [18:33] <kirkland> there's a couple of frames to this webpage
 127 [18:33] <kirkland> (yeah, i wrote most of this long before ajax existed)
 128 [18:34] <kirkland> the left most is a list of artists
 129 [18:34] <kirkland> which include my buddy "Jeff Luna" and his zaney comedic tunes
 130 [18:34] <kirkland> and Last Chance Dave -- a couple of guys with some nice soulful rock
 131 [18:34] <kirkland> clicking on either of them will show the albums that i have
 132 [18:34] <kirkland> for that artist
 133 [18:35] <kirkland> clicking on an album will then launch a flash based player
 134 [18:35] <kirkland> called jplayer, which is embedded
 135 [18:35] <kirkland> from there, you have the basic streaming functionality
 136 [18:35] <kirkland> play/pause, skip around, volume, etc.
 137 [18:36] <kirkland> you can also download an m3u playlist, or a tarball of the whole album
 138 [18:36] <kirkland> now, let's add some new tunes to our library
 139 [18:36] <kirkland> in case you missed it, jono's band, Severed Fifth released a new album this week-ish
 140 [18:37] <kirkland> it's freely downloadable from
 141 [18:37] <kirkland> wget
 142 [18:37] <kirkland> and we watch that download to our cloud instance
 143 [18:37] <kirkland> .... done
 144 [18:46] <kirkland> sorry , network connectivity issue
 145 [18:46] <kirkland> :-(
 146 [18:46] <kirkland> tethered through phone now
 147 [18:46] <kirkland> okay, let's get some new music
 148 [18:47] <kirkland> now try refreshing
 149 [18:48] <kirkland> okay, so that's pretty much musica
 150 [18:48] <kirkland> again, like pictor, it's easy to add an .htaccess
 151 [18:48] <kirkland> and authenticate through
 152 [18:49] <kirkland> to "protect" your pictures and music
 153 [18:49] <kirkland> it's also easy to add SSL to the apache configuration
 154 [18:49] <kirkland> this is where the embedded player is really nice
 155 [18:49] <kirkland> it doesn't even need to know about that at all
 156 [18:50] <ClassBot> There are 10 minutes remaining in the current session.
 157 [18:51] <kirkland> <IdleOne> QUESTION: why aren't the severed fifth tunes playing?
 158 [18:51] <kirkland> <kirkland> IdleOne: possibly a bug in ogg support in jplayer, i'll need to take a look at that one
 159 [18:51] <kirkland> let's try to get to some questions
 160 [18:51] <kirkland> i had hoped to deploy a wordpress instance and a moodle server
 161 [18:51] <kirkland> i can do those quickly, without much detail if you like
 162 [18:51] <kirkland> or i can field some questions
 163 [18:52] <kirkland> <sujiths80> Question:I loged into the cloud but I can see some letters scrolling , it the same expected
 164 [18:52] <kirkland> that was the program 'cmatrix'
 165 [18:52] <kirkland> :-)
 166 [18:52] <kirkland> supposed to look like the matrix
 167 [18:52] <kirkland> i think it's a fun screen saver for servers :-)
 168 [18:52] <kirkland> <sujiths80> Question:How long we cloud computing if try 10.ubuntu cloud page
 169 [18:53] <kirkland> those instances only last about ~1 hour
 170 [18:53] <kirkland> so it's really just for test driving
 171 [18:53] <kirkland> you can buy your own instance though, if you like
 172 [18:53] <kirkland> and keep it as long as you're willing to pay Amazon for it
 173 [18:53] <kirkland> (ubuntu is free though)
 174 [18:53] <kirkland> <kstailey_> is that the standard-issue byobu profile?
 175 [18:53] <kirkland> i've tweaked a couple of things
 176 [18:54] <kirkland> i wanted to see the ec2-cost, network traffic, and number of people logged in
 177 [18:54] <kirkland> <sebsebseb> QUESTION: So basically pictor is a photo gallery program, but what is needed on a web server for it?
 178 [18:55] <kirkland> yeah, that's it basically;  sudo apt-get install pictor will install all of its web server dependencies
 179 [18:55] <ClassBot> There are 5 minutes remaining in the current session.
 180 [18:59] <kirkland> <hermes> 17:56:32> QUESTION: How do these instances actually get created with CLOUD?
 181 [18:59] <kirkland> i created this instance using ec2-run-instance
 182 [18:59] <kirkland> and picked an image from
 183 [18:59] <kirkland> i used screenbin(1) to set it up for this classroom setting
 184 [18:59] <kirkland> where i have write access you have read access
 185 [19:00] <kirkland> <sujiths80> 17:56:29> Please proceed with wordpress then
 186 [19:00] <kirkland> installing now ...
 187 [19:01] <ClassBot> Logs for this session will be available at
 188 [19:01] <kirkland> <autif> QUESTION: so how is deploying an app to a cloud any different from applying to Ubuntu Server. I am guessing the answer is that it isn't. Just ssh  and sudo apt-get install -y. Is that correct?
 189 [19:01] <kirkland> autif: mostly the same

MeetingLogs/openweekMaverick/DeployingWebApplicationsintheCloud (last edited 2010-10-15 01:42:16 by nigelbabu)