Deploying RoR is HARD....from a beginner's perspective

So I’ve finally been seduced by the hype that is RoR and have now gone
hog-wild buying books and downloading as many resources as I can. I’m
a Lotus Notes/Domino professional and have always done all of my web
app development in Domino. I’ve stuck with Lotus because it offers a
fantastic RAD platform which allows me to throw together a totally
functional prototype in less than a day. Deployment is a non-
issue…I can either develop directly on the server or locally and
then just replicate to the server. Really, it’s that simple. There
are some drawbacks, however.

  1. It’s not free.
  2. Writing LotusScript and Java Agents is not the most elegant
    programming experience in the world.
  3. It just feels incredibly clumsy and “old school” at times and it
    can be a real pain to implement the latest and greatest whiz-bang
    interface elements for which I’m such a sucker.

I’m not planning on abandoning the platform altogether as that would
be impossible to do given that I work in the DC area and all of my
clients are DOD. It’s hard enough trying to keep them from ditching
IBM for M$ so I don’t think RoR would really go very far any time
soon. I would definitely love to start free-lancing and if all of
what the marketing says is true then RoR seems like something that
I’ve been dreaming of for some time. It’s something that I thought
I’d found in Java a while back but quickly found that it was
ridiculously bloated and complex. I don’t want to waste alot of time
dealing with complexity…I just want to build something functional in
a small amount of time.

I want a web development platform that is truly object-oriented and
will essentially allow me to better focus on the actual design of the
application instead of spending so much time trying to work my way
through the complexities of the “nuts and bolts” and logic. When I
say design, I’m not talking actual aesthetic design although that is
the part I most enjoy. I’m referring to how the application actually
works - being able to sit back and think the whole thing through and
basically identify all of the parts I’ll need to put together in order
to build my app. I want these parts to essentially be built already
for the most part and I simply want to be able to grab them out of a
“tool box” and put them into place within my application. I want to
be able to have the majority of the application “framework” ready for
me to customize and tailor to the needs of my project. RoR seems like
it can do all of this AND provide me with the tools I need out of the
box to satisfy my obsession with shiny, whiz-bang interfaces.

So I’ve downloaded InstantRails, RadRails and bought lots of books. I
went out and bought a hosting account at RailsPlayground and thought
this would be as simple as me grabbing an example application and
monkeying around with it until I got the basic idea of how to make
things work my way. Here is the obsticle I’m facing right now…

Deploying an application seems like a major PITA. I’ve got this
hosting account and I thought that putting my application on the web
would be as simple as FTPing the app folder over to my account…kindof
like it is with DreamWeaver. Wrong. It appears that I have to
actually know my way around Linux and I absolutely cringe at command
line interfaces. I’m hopelessly hooked on GUIs as they’re all I’ve
ever known and the thought of not having one is pretty spooky. It’s
alot like being told that I have to ditch electronic communication and
go back to pen and paper + snail mail. Not cool. Is this just
something that I’m going to have to get over if I hope to go deep into
RoR? Is there a dreamweaver-type IDE out there for RoR that allows me
to deploy my app to the server with the click of a mouse? Can someone
out there either point me in the direction of my GUI life-raft or
shatter my delusions and tell me I need to learn Linux in addition to
RoR?

I really want to just dig in and put something together, not spend
weeks learning my way around command-line interfaces and such. While
I know that there’s probably no WYSIWYG IDE for RoR out there, is
there something that will at least let me get my app on the web with
ease? Any help would be greatly appreciated. One of the things that
draws me to RoR is the community surrounding it. I look forward to
hopefully interacting with all of you and contributing as much as I
can.

Adam Keith B. wrote:

…I’ve stuck with Lotus because it offers a
fantastic RAD platform which allows me to throw together a totally
functional prototype in less than a day.

Fantastic, if you don’t mind (as I have heard) that Lotus Notes fiercely
resists automated tests. That is a major indicator of logical problems
with
the core of a development platform, however nice all the peripheral
items
may be…

Your post doesn’t contain the term “Capistrano”. Install that, learn to
use
it (that’s a little hard), and after it works then deployment becomes
once
again a non-issue…


Phlip
Redirecting... ← NOT a blog!!!

Thanks so much. I will try to get Capistrano working. I have installed
it
but get errors everytime I try to run the Cap command on my application.

C:\Instant13\InstantRails\rails_apps>cap --apply-to
~/rails-apps/typo-2.6.0
C:/Instant13/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
:21:in require__': couldn't find HOME environment -- expanding ~/rails-apps/ty
po-2.6.0/config/environment’ (ArgumentError)
from
C:/Instant13/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/cust
om_require.rb:21:in require' from C:/Instant13/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1. 4.0/lib/capistrano/generators/rails/loader.rb:5:in load!’
from
C:/Instant13/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.
4.0/lib/capistrano/cli.rb:276:in execute_apply_to!' from C:/Instant13/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1. 4.0/lib/capistrano/cli.rb:237:in execute!’
from
C:/Instant13/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.
4.0/lib/capistrano/cli.rb:12:in `execute!’
from
C:/Instant13/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.
4.0/bin/cap:11
from C:/Instant13/InstantRails/ruby/bin/cap:18

Do you see anything obvious here? I’m assuming that nothing is working
because I don’t see a deploy.rb file in the app config directory. I’m
not
quite sure what a SVR is and I’m pretty sure that I’ve never created in
my
RailsPlayground hosting environment. Is this something that is there by
default?

-Adam

On 2/10/07, Phlip [email protected] wrote:

with
Redirecting... ← NOT a blog!!!


Regards,

Adam Burrell
Software Engineer
VPC Solutions Inc.
(703 626-1787 (cell)

Hi Adam,

Adam Keith B. wrote

Deploying an application seems like a major PITA. I’ve got this
hosting account and I thought that putting my application on the web
would be as simple as FTPing the app folder over to my account.

Depends on what hosting service you’re using. There’s a lot of
variation.
My sys admin skills are nil, so I looked around and settled on an
account
with a2hosting.com. Deploying was pretty much just like what you’re
looking
for, as Rails is already installed. You have to create a database but
that
was easy using cPanel. Copied my code over, set up the db, entered a
ticket
to get them to put mongrel in front of it. Good to go. Their support
is
fantastic and I highly recommend them. If I can do it, I’d say anybody
can
:wink:

hth,
Bill

Adam Burrell wrote:

Thanks so much. I will try to get Capistrano working. I have installed
it
but get errors everytime I try to run the Cap command on my application.

What howto are you reading?

Does your ISP support Rails? If not, getting another ISP might be more
cost-effective than muddling forever installing Rails on the server. Cap
don’t do that.

If your ISP supports Rails, what’s their Howto for Capistrano?


Phlip
Redirecting... ← NOT a blog!!!

cap --apply-to ~/rails-apps/typo- 2.6.0

“~” represents a UNIX home folder. Given you are on windows, this
isn’t really around. Try using Windows conventions to refer to the
root folder of your application.

-Kyle

I think I’ll just head back to my Mac to dig into this. It’s just too
frustrating on Windows. Thanks anyway.

On another note, it seems that my isp (RailsPlayground) provides
instructions on doing what it is that I’m trying to do (Install Typo) so
hopefully I’ll get it straight sooner than later.

On 2/10/07, Kyle M. [email protected] wrote:


Regards,

Adam Burrell
Software Engineer
VPC Solutions Inc.
(703 626-1787 (cell)

Prime example -

I’m simply trying to install typo on my hosted account. I’m following
the
rules provided by my ISP and am running into issues left and right.
Shouldn’t it be as simple as me uploading the application to the server
and
pointing apache to my app? I hate to draw comparisons but in Domino,
this
would be as simple as me uploading the app to the server. If I need to
redirect my url to it I simply setup a redirection document. Oh well,
this
isn’t Domino and I need to learn the rails way…

-Adam

On 2/10/07, Phlip [email protected] wrote:

with
Redirecting... ← NOT a blog!!!


Regards,

Adam Burrell
Software Engineer
VPC Solutions Inc.
(703 626-1787 (cell)

Adam Burrell said the following on 02/10/2007 07:05 PM:

Prime example -

I’m simply trying to install typo on my hosted account. I’m following
the rules provided by my ISP and am running into issues left and right.
Shouldn’t it be as simple as me uploading the application to the server
and pointing apache to my app? I hate to draw comparisons but in
Domino, this would be as simple as me uploading the app to the server.
If I need to redirect my url to it I simply setup a redirection
document. Oh well, this isn’t Domino and I need to learn the rails way…

BTDT.
Its about familiarity.
I had no problems deploying Typo (on Dreamhost) without reading
instructions. They’re Linux; I’m used to Linux.

If I tried deploying anything in Domino I’d be having the same
frustrations
as you are with Typo; I’m not familiar with it.

Persist. We were all beginners once :slight_smile:


Knowledge will forever govern ignorance: And a people who mean to be
their own governours, must arm themselves with the power which knowledge
gives.
–James Madison, quoted on the Library of Congress

Adam Burrell wrote:

I’m simply trying to install typo on my hosted account. I’m following the
rules provided by my ISP

I meant “your ISP’s instrunctions on installing on your site via
Capistrano”. Like this:

http://wiki.railsplayground.com/railsplayground/show/How+To+Use+Capistrano+With+RailsPlayground

( http://tinyurl.com/2g22f3 )

and am running into issues left and right.

If your ISP doesn’t support Capistrano, then you are stuck at the bottom
of
the learning curve. Setting a Rails site up thru a SSH login is like
assembling one of those model ships inside a bottle, via long tweezers
and
such. Without assembling the ship outside the bottle and then sneaking
it
in.


Phlip
Redirecting... ← NOT a blog!!!

Adam Burrell wrote:

I think I’ll just head back to my Mac to dig into this. It’s just too
frustrating on Windows. Thanks anyway.

On another note, it seems that my isp (RailsPlayground)

Uh, I found those instructions hard to follow, and I already had
non-trivial
Capistrano (and SVN) experience. I advise the admin to upgrade the docs.
You
must start here, despite the “Guru” in the title implies this is the
advanced stuff. It is, instead, the getting started stuff. You must set
an
SVN account up:

http://wiki.railsplayground.com/railsplayground/show/diff/How+To+Use+Capistrano+with+the+Guru+Plan

( http://tinyurl.com/yv72o7 )

Ask support@ themselves for more details there!

Next, if you get this far, Apache refuses to serve public or
public/dispatch.* if any of their permissions are too permissive, such
as
chmod 775. They must be 755. I added this cap task to my
config/deploy.rb:

run 'chmod 755 ~/champion/current/public ’ +
‘~/champion/current/public/dispatch*’

Not to keep you in suspense, here’s my entire deploy.rb, which has
worked
for a while, with the sensitive details masked; ### for the project
name,
%%% for the site name, and *** for the Linux/SSH user name, and ‘phlip’
for
the SVN user name. (Note that the project and site names are
different;
that’s a software engineering Best Practice, for if your client needs to
perform the Replace Owner Refactor…)

set :user, ‘***’
set :svn_username, ‘phlip’
set :svn_password, ENV[‘SVN_PASSWORD’]
set :server, ‘%%%.railsplayground.net’
set :application, “###”
set :repository, “http://%%%.svnrepository.com/svn/###/trunk”
role :web, server
role :app, server
role :db, server, :primary => true

set :deploy_to, “/home/#{user}/#{application}”

task :restart, :roles => :app do
run 'chmod 755 ~/###/current/public ’ +
‘~/###/current/public/dispatch*’
end


Phlip
Redirecting... ← NOT a blog!!!

Adam–

I’d venture a guess that deployment was never as easy as “just
sync’ing” or FTPing. You have to create databases, some security
measures need to be in place to make sure you’re not scribbling madly
all over system files, and so on. You’re just used to the hoops
you’ve been jumping, not the Rails hoops.

Rails is not well supported by a GUI, and many would say that’s a
good thing. GUIs are wonderful for abstracting underlying OS stuff
out of your mental working set, but you’re still performing the same
actions as you would at a command line. The problem with relying on a
GUI too much is that it can lull you into forgetting about how your
code really interacts with the environment in which it runs. Maybe
typing in Linux commands is a bit closer to the metal than you
expected in the first decade of the 21st Century, but it seems that
most successful Rails developers are doing just that.

One reason I moved away from heavily IDE-centric development was that
the environments kept making decisions for me and they were not
great choices. I wound up with brittle code left in simply to keep
the IDEs from spitting up chunks. In every way, I would say that
shedding the bulky IDEs has been liberating.

Oh, and you can actually FTP a Rails app up to a server and start it.
I recommend Capistrano, as it makes deployment predictable and
rollback easy. But just for your comfort, understand that Rails apps
are still just a collection of files and they can get to the server
any old way you want. What you cannot do with a Rails app is make a
wholesale in-situ replacement of the application by copying it.
That’s because Rails relies on loading certain parts of the framework
once per serving process and never again until a server restart.
Sure, you can replace a controller or view periodically, but with
Capistrano, you’ll probably discover that deploying the whole app is
as easy as copying any given file.

Good luck and press on!

On Feb 10, 2007, at 10:53 PM, Phlip wrote:

Is there any other productized solution besides Cap??

rsync? Nobody’s thought it through (AFAIK) as well as has been done
in Cap, but I’d be surprised if Komodo and/or Steel don’t come up
with something that either provides similar functionality or wraps
Capistrano at some point.

As cool as Capistrano is, relying on it doing “magic” is not the
right thing to do. If you rely on Capistrano magic, you’ll get by a
lot of the time, but the one time when you want to tweak a
deployment, you won’t understand how the darn thing works in the
first place. That’s why it’s so useful to copy files up to the server
and set the permissions and tweak around with the servers and blah,
blah at least once so you understand all the goodness you’re getting
from Cap.

Hey wait. You’re still going to have to mess around with the servers.
All Capistrano can do is restart them. You have to apply the critical
thinking involved in properly configuring them for the mix of pages
you expect to server and the load they are expected to handle.

See, this is the Web-scripting myth: You can throw anything at a Web
server and it will happily churn out pages no matter what. Behind the
scenes of every high performing Web site are people thinking about
what the best Web server technology for the job might be. Developers
have to be involved in this kind of thing. No IDE or deployment tool
gets around that. And to the OP, this is not stuff unique to RoR –
it’s always lurking there.

s.ross wrote:

I recommend Capistrano

This is an interesting question for the Rails FAQ: Does Rails
“recommend”
Capistrano, or does Rails “require” it. Of course you can go SFTP-crazy
and
get a running Rails site (including Ruby stuffed into the ~/bin folder,
if
you like, and including manually stopping and starting the web server).
Is
there any other productized solution besides Cap??

About IDEs, the best IDE for a programmer is a command line with the
option
to write wrong command lines, but where short command lines are easy.
‘rake
deploy’ is just a button, now.


Phlip
Redirecting... ← NOT a blog!!!

To paraphrase Laurence Oliver:

Son, you need to learn how to program.

On Feb 10, 10:05 pm, “Adam Keith B.” [email protected] wrote:
I’m hopelessly hooked on GUIs as they’re all I’ve

s.ross wrote:

As cool as Capistrano is, relying on it doing “magic” is not the
right thing to do. If you rely on Capistrano magic, you’ll get by a
lot of the time, but the one time when you want to tweak a
deployment, you won’t understand how the darn thing works in the
first place. That’s why it’s so useful to copy files up to the server
and set the permissions and tweak around with the servers and blah,
blah at least once so you understand all the goodness you’re getting
from Cap.

A good way to look at this: Capistrano is DRY.

Using Capistrano, you Don’t need to Repeat Yourself.

For example, I noticed my webserver kacked on a public/ folder with
permissions of chmod 775.

(Because I followed your advice, and built many websites the old
fashioned
way, I know what “chmod” means. [And I know how icky those web servers
are
that don’t have the elegant simplicity of chmod to rely on!])

So I manually ran chmod 755 public a couple times.

Then I got inside deploy.rb, and added run ‘chmod 755 public’.

Capistrano allows me to Don’t Repeat Myself. It took over this menial
task,
so I didn’t have to do it over and over again.

And this rescued me from the terrors of researching who or what was
setting
my public folder to 775.


Phlip
Redirecting... ← NOT a blog!!!

Neil W. said the following on 02/11/2007 05:17 AM:

To paraphrase Laurence Oliver:

Son, you need to learn how to program.

On Feb 10, 10:05 pm, “Adam Keith B.” [email protected] wrote:
I’m hopelessly hooked on GUIs as they’re all I’ve

ever known and the thought of not having one is pretty spooky.

See http://www.cryptonomicon.com/beginning.html
and In the Beginning... Was the Command Line - Wikipedia

And that “Neal” not “Neil”.

And ow do you think those GUIs make use of the system command that they
front for?


He who stops being better stops being good.
- Oliver Cromwell

If you use Visual Studio, you may want to try out our IDE, Ruby In
Steel:

http://www.sapphiresteel.com/

Adam Keith B. wrote:

While I know that there’s probably no WYSIWYG IDE for RoR out there

You may also want to glance at our RoadMap:
http://www.sapphiresteel.com/Ruby-In-Steel-Road-Map

Note the section:

“Visual Rails Developer - Visual Web Page Designer for Rails”
That will be along in a few months :wink:

best wishes
Huw C.
SapphireSteel Software

Hi Adam,

I too am relatively new with Rails, so apologies to the rest of you if
what I say is naive or inaccurate, but at least my process gave me
some success on bluehost, though probably my hosted apps are still in
deployment mode, since i saw no difference changing the setting
environment.rb to production.

But I have yet to read the deployment chapter in version 2 of Agile
Web D. with Rails. Thats a book I love by the way!

I use a Mac so you may need to make some conversions, I found Rails
development much nicer on a Mac compared to Windows, though intial
installation can be fiddly. The main issue is the different rails
installation on my webhost.

So the way i deploy an application (on bluehost), is:

  1. create the db, with the webhosts DB tools, or you can use something
    like CocoaMysql (nice GUI), but then you will need your host to allow
    the connection via the appropriate port, and you will need a static IP
    address.
  2. From a terminal (try cygwin on windows, maybe that will work for
    you) change to the user that your webhost expects you to be (I created
    a special user for that in my prefs) “su” (admin), then just type “su
    username”
  3. ssh in to the host and go to rails dev directory. (type “ssh your
    address”, and then password), then “cd” to the rails dev directory.
  4. “rails newapp”, creates a new app (this is done because your host
    will have a different rails installation from you, and caused me to
    become unstuck sometimes)
  5. ftp up and overwrite
  • the app directory
  • db directory or parts of it if this is the second time around
  1. Edit:
  • database.yml : user and password should be what ever you set up on
    the host.
  • change appropriate stuff on the server in routes.rb
  • delete default/index.html
  1. Run a rake process to create the DB schema “rake migrate”

  2. create new subdomain in the host (look at your host directions for
    this) and point it to your new rails app.

Let me know if anything is unclear, since i copied this list from my
notes.

I have some web services which let me synchronise data in the DBs
between the local machine and webhost, let me know if you need tips
for that, though that was much easier than deployment.
J

Fantastic! I’ll be in line for it when it comes out.

Thanks to everyone for their responses so far. I hammered at it most
of the night and eventually found out that Typo doesn’t work on my
hosted server (per the hosting admin) and I was able to successfully
install and configure Mephisto, which is pretty nice. Now my next
step is to work through the new book “Build your own…” by sitepoint
and build my “Digg clone” app. I think I’m going to stick with FTP
and learn how to get everything set myself for now. I was able to get
RadRails to work with my site using the subversion repository. I feel
like it might be possible for me to just use that setup but something
tells me that I’ll need to set permissions or tweak the server in some
way regardless. I have the “Agile Web D. with Rails” book so
maybe it’s got some good deployment info in it. Combined with all of
the great resources you all have pointed me to so far, I think I’ll be
okay. I do need to say that the support at RailsPlayground so far has
been outstanding and very responsive.

Also, I’m primarily a Mac user (Macintosh obsessive is more like it)
and was only using a Windows machine because I don’t have a Mac laptop
right now and I needed to work on a laptop. I’m hoping to spring for
a MacBook in the next month or so. I was actually turned onto RoR by
one of the geniuses at the Apple store where I worked most of last
year. It’s great that they’re actually going to put Rails w/ Mongrel
in Leopard server. That combined with all of the other services built
in are going to make it pretty hard to pass up. I recently got to
take a peek at the Wiki server that they’ve built in and it’s
gorgeous. It’s something that Apple has built themselves and it’s
going to be quite useful.

-Adam

On 2/11/07, Huw C. [email protected] wrote:

http://www.sapphiresteel.com/Ruby-In-Steel-Road-Map

Posted via http://www.ruby-forum.com/.


Regards,

Adam Burrell
Software Engineer
VPC Solutions Inc.
(703 626-1787 (cell)