Ruby on Rails Wednesday, February 29, 2012

On Wed, Feb 29, 2012 at 12:06 PM, Colin Law <clanlaw@googlemail.com> wrote:

On 29 February 2012 10:42, Bert Gloan <lists@ruby-forum.com> wrote:
> Currently I have been doing the usual cap deployments for a project to a
> test environment as my app develops. Nothing exciting, but I have now
> got to deploy it on a reasonable scale to a DMZ that has no access to
> the git repo/ or any other nice things.
>
> Anyone got 'best practice' for this situation, I can push to the DMZ
> using ssh/scp etc, even rsync ... but rather than a cobbled together
> approach, I would prefer good practice.

I use a script that touches the local tmp/restart.txt (which, for me
anyway, causes the server to restart) then uses rsync to update the
server then using ssh run the remote command to precompile the assets.
For the actual file transfer rsync is amazingly fast (particularly if
the server is remote) as the connection is only made once.

If any gems have changed you will need to bundle install on the server
also, but I do this manually if required.  Also if migrations have
been added then you will need to run the migrations.

For the rsync I have an ignore file containing:
.git
.gitignore
.rvmrc
.bundle
doc
log
db/schema.rb
tmp/cache
tmp/pids
tmp/sesssions
tmp/sockets
tmp/markup
test
spec
public/javascripts/all.js
public/assets
vendor/bundle
.bundle/config

I too will be interested to hear of other suggestions.

If I understand correctly, the root problem of the OP
is not being able to use standard capistrano recipes
since the production server (in the DMZ) cannot reach
the git repo that is inside the company firewall?

What I have done in such a scenario (where my production
server is at a hosting company) is to use standard
capistrano practice, but have a "production" branch of
the git repo on the production server. So the `git checkout`
on the production server is pulling from a "local" repo.

The top of my deploy.rb then becomes something like:

set :user, 'vandenabeele' # username on the production server
set :application, 'flamjobs' # app name
set :repository, 'vandenabeele@xxx.yyy.zz:git/flamjobs.git'
set :branch, 'production'

For that, I has set-up a "bare" repository in the directory
/home/vandenabeele/git/flamjobs.git

and I push into that from my dev machine before running
cap deploy (I could probably automate that too ...).

HTH,

Peter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment