Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri May 27, 2011 7:35 pm 
Offline
Junior Member

Joined: Mon Apr 18, 2011 1:54 pm
Posts: 45
Website: http://www.rassoc.com/gregr/weblog
After having good experiences here with my personal sites, I'm thinking about deploying here for a new larger site I'm working on. Other alternatives are EC2, Rackspace cloud, or perhaps Heroku (plus a couple of EC2 servers for stuff I can't run on Heroku).

The new managed load balancing service here is music to my ears!

Anyway. I want the ability to spin up an extra node quickly when I need to, with a predetermined image (selected from a short list of images I would maintain - e.g. front-end web server, database mirror server, back-end job server etc).

In thinking about how to do this here at Linode, two thoughts came to mind:

1. Have some stackscripts for my different setups, and use those to spin up new nodes. Downside is I think these scripts could take a while to run - for example, installing LAMP + ruby + passenger + whatever else wouldn't all happen in a matter of minutes. Ideally I'd like the flexibility to have a new node up and running within 5 minutes or so, so I'm thinking this probably isn't the way to go.

2. Have a "clone server" node in the Linode manager that basically just holds disk images for each server type. I wouldn't be using this server; I'd just use it as a clone destination (when saving the clones) or a clone source (when spinning up new nodes). So this would have say 5 different disk images attached.

Any thoughts on that? Is there a better way to accomplish #2?


Top
   
 Post subject:
PostPosted: Fri May 27, 2011 7:46 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Actually, don't immediately discount option #1. It is faster than you'd think to install a bunch of packages and spray configuration templates across the filesystem. It is more work up front, since you not only have to have a working configuration but you also have to write code to reproduce it, but it requires a hell of a lot less space and leverages the existing Linode master images.

If you want to go this route, take a look at Chef or Puppet too.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Tue May 31, 2011 11:24 am 
Offline
Linode Staff
User avatar

Joined: Tue Jan 19, 2010 5:22 pm
Posts: 18
I have a "clean" image that I keep around that has a few things that I need to get started. I can clone the disk to another Linode relatively easily and be up and running in ~15 minutes. The only down side to this is that I can't use the full amount of disk space on one of my 'nodes :( For one image it works alright, but if you plan on having multiple images I'd seriously take a look at creating StackScripts or storing your images on your local machine and copying them over as you need them.

_________________
Image


Top
   
 Post subject:
PostPosted: Wed Jun 01, 2011 11:53 am 
Offline
Junior Member

Joined: Mon Apr 18, 2011 1:54 pm
Posts: 45
Website: http://www.rassoc.com/gregr/weblog
Thanks for the ideas, guys. I'll try some of these things and see how it goes...if I come to any interesting conclusions I'll post back here!


Top
   
 Post subject:
PostPosted: Fri Jun 03, 2011 8:26 pm 
Offline
Junior Member

Joined: Mon Apr 18, 2011 1:54 pm
Posts: 45
Website: http://www.rassoc.com/gregr/weblog
I've run some tests, and here is what I found.

The image I was building included starting with a fresh Ubuntu 10.10, installing updates, installing and configuring apache2, install build tools, building ruby from source, and installing and configuring bundler, passenger, and rails. Then deploying my app using capistrano.

I didn't use stackscripts yet, as it wasn't clear how to run those from a different user than root...so I basically just logged in, created a new user, logged in as that new user, and ran my scripts.

So for the script:

5:23 start boot, set up user
5:25 start main_setup.sh script
5:36 start capistrano deployment
5:38 app deployed and operational

So about 16 minutes start to finish. The bulk of the time is spent compiling ruby, pretty much pegged at 100% of one CPU.

I then saved the above image, and cloned it to a new node. The clone process:

6:06 start clone process for 4GB image
6:09 booted, hostname reconfigured, start capistrano deployment
6:11 app deployed and operational

So about 5 minutes start to finish to clone to a new node.

Note that I sized the disk image to only 4GB - if it was larger, as it might well need to be in production, the clone would take longer. Or I could clone a smaller image, then resize it larger prior to boot on the destination - I didn't try that.

Anyway, just wanted to post back here in case anyone else was wondering about this kind of thing!


Top
   
 Post subject:
PostPosted: Sat Jun 04, 2011 9:54 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
gregr wrote:
I didn't use stackscripts yet, as it wasn't clear how to run those from a different user than root...so I basically just logged in, created a new user, logged in as that new user, and ran my scripts.


Stack scripts are run automatically on the building of a linode as the root user, if you wanted to run them as another use you can use sudo inside a script to execute the commands. However you're probably going to want to run as root anyway since installing software etc requires it.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sun Jun 05, 2011 3:26 am 
Offline
Newbie

Joined: Sat May 21, 2011 11:14 am
Posts: 3
gregr wrote:
So about 16 minutes start to finish. The bulk of the time is spent compiling ruby, pretty much pegged at 100% of one CPU.

I then saved the above image, and cloned it to a new node. The clone process:

6:06 start clone process for 4GB image
6:09 booted, hostname reconfigured, start capistrano deployment
6:11 app deployed and operational

So about 5 minutes start to finish to clone to a new node.

Note that I sized the disk image to only 4GB - if it was larger, as it might well need to be in production, the clone would take longer. Or I could clone a smaller image, then resize it larger prior to boot on the destination - I didn't try that.


for the first option, you can try:

* speedup your ruby compile, with extra options for make like -j4 (4 compiles at the same time, ideal for the 4 cores linode)
* produce an already ruby binary install, try to produce a rpm/deb/tbz2/etc for your distro and deploy this

for the second option, maybe you can rsync your filesystem, instead of clone the disk, to rsync to a full disk.


Top
   
 Post subject:
PostPosted: Sun Jun 05, 2011 6:19 pm 
Offline
Junior Member

Joined: Mon Apr 18, 2011 1:54 pm
Posts: 45
Website: http://www.rassoc.com/gregr/weblog
gehena wrote:
for the first option, you can try:

* speedup your ruby compile, with extra options for make like -j4 (4 compiles at the same time, ideal for the 4 cores linode)
* produce an already ruby binary install, try to produce a rpm/deb/tbz2/etc for your distro and deploy this


Mmm...good thoughts; I'll have to look at what the makefile actually does and see if I can make something like -j4 work.

I've also thought about using rvm instead of building from source; somehow it just feels wrong to use rvm on a production server, but maybe I can get over that... :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group