

How I migrated from Heroku to Digital Ocean with Chef and Capistrano - matteodepalo
http://matteodepalo.github.com/blog/2013/03/07/how-i-migrated-from-heroku-to-digital-ocean-with-chef-and-capistrano/

======
evaneykelen
I'm planning to move away from Heroku too, partly because of the routing
system issues you mention in your article, but also because I want to sharpen
my sysadmin fu. Have you considered <https://www.cloud66.com/> because it
seems like a nice tradeoff between going "bare metal all the way" and Heroku's
comfy environment.

~~~
zagi
DigitalOcean recently became fully integrated with Cloud66.com just last week.
It's a great way to easily spin up a new server, and echo's our mantra of
simple cloud hosting.

------
fomb
So how does this resolve the Heroku routing problem for you? You have one
server that internally routes efficiently - but what happens when you scale
past one server?

If you're not scaling past one server, why does Heroku's routing cause you
issues?

~~~
matteodepalo
On Heroku I was using thin that forced me to scale horizontally to handle more
than one request at the same time. With this setup I can set a number of
unicorn workers bigger than 1 and I'm done. I can scale vertically until I can
and then set up more machines with the same methodology and use a load
balancer like HAProxy to manage requests.

~~~
neilmiddleton
Why not use Unicorn on Heroku?

~~~
matteodepalo
There is a limited amount of workers you can run with 512mb of memory (max 3
for my application) and the random routing can overload one dyno while the
others are doing nothing. Basically you have to scale and pay more when with
Digital Ocean I can buy a 2gb machine and run 10 workers spending 20$ per
month.

------
thibaut_barrere
Interesting article I think (as someone who already uses Chef).

That said like I commented on your post, create a proper user instead of
running as root, really.

~~~
matteodepalo
I totally agree and it's next in the list of improvements I want to do. I just
wanted to share this asap until it's fresh in my mind.

Edit

Done! :-)

~~~
thibaut_barrere
Sure :-) I will definitely forward this to people new to this, I would have
loved to have such a tutorial a couple years back!

------
aglosson
Every time I see someone doing something cool with Chef, I think of this:
<http://progopedia.com/language/chef/>

And then I think, "Wow. This person must be a mad genius."

------
JacobJans
I would be very leery of hosting any serious business on Digital Ocean. Their
terms of service are simply too strict.

For example, you can't send email to your users without double opt-in.

Yikes!

Not to mention the ambiguous language banning 'offensive' and 'inappropriate'
content.

~~~
mitchwainer
Hi - It's Mitch from DigitalOcean. We are still ironing out our TOS. Given
that we are still a startup we are always constantly looking to improve the
language.

We don't consider ourselves too strict. As long as you are not trying to run
an attack or spam/flood our network, we are totally cool. :)

~~~
JacobJans
Mitch,

I appreciate the sentiment, but I can't stake my livelihood on promises made
on an internet forum.

I want to be a Digital Ocean user, but I'm going to base that decision on the
legal agreements first.

I do hope this will encourage you guys to remove some of the ambiguity in your
TOS, and to remove that double opt-in requirement.

Best,

Jacob

~~~
mitchwainer
I totally hear you Jacob. Know exactly where you're coming from.

And yes, we will continue to work on our TOS. :)

Best of luck! Mitch

------
rmoriz
With <https://github.com/rmoriz/knife-digital_ocean> you can launch and
bootstrap an instance using knife in a single command.

Works with knife-solo and traditional chef-server environments.

------
genericsteele
This is great. Two weekends ago I did the same type of migration using Linode
and Capistrano. Heroku taught us what we should expect from a platform, and it
seems like, as a community, we're moving towards getting those great features
ourselves.

~~~
zagi
This is one of the fundamental differences between a platform and an
infrastructure provider. As a platform you build a single tool that is used by
everyone and with it come inherent limitations. If an infrastructure provider
can give you the building blocks to create a platform service on your own, you
maintain full control. So long as your time investment into growing the
infrastructure doesn't outweigh the cost savings of a platform you get much
more predictable growth, better pricing and maintain full control allowing you
to develop a product that's customized to your needs exclusively.

------
purephase
This is great. Thanks for sharing. I've been toying around with mina, but I
may give Capistrano another shot. Right now I have a bunch of build scripts
that would be much better suited for Chef and your setup closely mirrors my
own.

------
pw7
Did the same thing 2 days ago! And cannot stress enough how rewarding the
experience was. Although I never heard of Digital Ocean so I chose linode, but
I'm also very happy with them so far.

~~~
kawsper
Linode have stackscripts, so you actually could do without Chef with a well
structured bash script.

I have asked Digital Ocean about the possibility for Stackscripts, and I don't
think they have planned for it, sadly.

It is nice to order a server, choose a stackscript, and have a server to
deploy to without even logging in on the instance.

------
jeromewilson
Anyone who's interested in migrating from Heroku go do a lot worse than giving
Cloud 66 a try. All the lovely deployment goodness without the lock in.

------
matteodepalo
Author here, I updated the article; now a user called "deployer" runs the app.
Turns out it was easier now than when I started with the migration.

------
danso
This was a very helpful and practical tutorial. I don't know why sysops is a
source of perpetual confusion for me but it's good to have as many examples as
possible. Could you elaborate on the actual hoops that creating a non-root
user was creating for you?

~~~
matteodepalo
First of all I didn't know whether to provision my machine with root or not.
Scraping through sysadmin resources I found people installing Ruby with the
"deployer" user and people using root for that task. When I tried installing
Ruby with deployer I got many permission errors, but I realize that was caused
in large part by my lack of experience with sysadministration.

Also, running processes with runit as non-root requires extra [care][1] and I
just wanted to get everything up and improve my scripts AFTER I knew that my
setup was viable.

Edit

One more thing: I couldn't install ruby-shadow, which is needed to handle
passwords with chef, due to some errors with the version of ruby I had.

[1]: <http://smarden.org/runit/faq.html#user>

~~~
rschmitty
With rbenv you can install ruby directly to your deploy user, no sudo required
as it installs to your home directory

[https://github.com/sstephenson/rbenv/wiki/Deploying-with-
rbe...](https://github.com/sstephenson/rbenv/wiki/Deploying-with-rbenv)

~~~
matteodepalo
Thanks, I'll try it as soon as I can :-)

------
humanspecies
I hate the term cloud computing and all the stupid hype that comes with it.

It's called mainframe computing, the exact same clusterfuck your grandfather
used in 1970. With bigger hard drives.

