[Backgroundrb-devel] Different environments in backgroudrb.yml

Dave Dupre gobigdave at gmail.com
Tue Jan 8 13:22:29 EST 2008


I use a cap task to generate the file rather than copy it.

In cap 2.0:

after "deploy:update_code", "backgroundrb:write_config"

namespace :backgroundrb do
  desc "Write backgroundrb config file"
  task :write_config, :roles => :app do
    rails_env = fetch(:rails_env, 'production')
    script = <<-SH
:backgroundrb:
  :ip: localhost
  :port: 11006
  :environment: #{rails_env}
SH
    put script, "#{release_path}/config/backgroundrb.yml", :mode => 0644
  end
end
end

I use the same technique for my spin script and just about any file that
needs slightly different contents depending on the environment.  You can
even use ERB to generate your apache scripts.  I find it much easier than
maintaining several versions of the same file.

Dave

On Jan 8, 2008 12:57 PM, hemant kumar <gethemant at gmail.com> wrote:

> Oh No, that won't work out, for running BackgrounDRb itself, you must
> have proper entry in backgroundrb.yml file.
>
> So, I will suggest you to have different files for development and
> production environment and keep backgroundrb.yml file out of SVN. A cap
> task can copy backgroundrb.yml.production to backgroundrb.yml when
> deploying on machines.
>
>
>
> On Tue, 2008-01-08 at 18:49 +0100, Raimond Garcia wrote:
> > Cool, what about development and production environments? should I
> > just not include the environment definition in backgroundrb.yml, and
> > simply start the servers using the appropriate environment each time?
> > for example
> >
> > RAILS_ENV=development ./script/backgroundrb start
> > and
> > RAILS_ENV=production ./script/backgroundrb start
> >
> >
> > On Jan 8, 2008, at 6:15 PM, hemant kumar wrote:
> >
> > > Hi
> > > On Tue, 2008-01-08 at 17:43 +0100, Raimond Garcia wrote:
> > >> Hi,
> > >>
> > >> Got everything setup nicely with backgroundrb for the development
> > >> environment and running tests with rspec.  However, I have to keep
> > >> editing the backgroundrb.yml file, to switch between development and
> > >> testing environment.  How can I declare a development, testing and
> > >> production environment in backgroundrb.yml?
> > >>
> > >> Thanks in advance
> > >
> > > in your bdrb_test_helper.rb file put:
> > >
> > > RAILS_ENV = 'test' at top and you are set.
> > >
> > >
> > >
> >
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080108/603235e0/attachment-0001.html 


More information about the Backgroundrb-devel mailing list