Custom maintenance

22 views
Skip to first unread message

martin

unread,
Mar 12, 2011, 1:36:31 PM3/12/11
to webis...@googlegroups.com
Hi there,

Is there a way to provide custom maintenance files with webistrano? I created a task to disanle the app. The task reads am erb-file, parses the file and puts the file to the system directory. Everything else is handled by the apache configuration.

But there are several problems: the task cannot read the file, which is located in apps/views/layouts. If i call File.read("#{current_path}/app/views/layouts/maintenance.html.erb") I get an "no such file" error. That is because File.read() searches the file on my local file system and not remotely.

So how can I tell webistrano to read the file from the server? The next problem is, the maintenance file expects 2 parameters, which normally came fron the command like: REASON="database updates" cap deploy:web:disable.
Can I prompt for an value only on a specific task?

The task runs perfectly under capistrano, but I want to use this task in webistrano, too.

Thanks,
Martin

Jonathan Weiss

unread,
Mar 16, 2011, 4:54:56 AM3/16/11
to webis...@googlegroups.com, martin
> But there are several problems: the task cannot read the file, which is located in apps/views/layouts. If i call File.read("#{current_path}/app/views/layouts/maintenance.html.erb") I get an "no such file" error. That is because File.read() searches the file on my local file system and not remotely.

Yes, this is how random Ruby code is evaluated in
Capistrano/Webistrano - always on the system where
Capistrano/Webistrano is running on. Only `run` and `sudo` commands
are run through SSH on the remote system.

It works for you in Capistrano because there you have a local checkout
of the source, so it still executes it locally but the file is there.

> So how can I tell webistrano to read the file from the server?

http://blog.innerewut.de/2007/9/28/capturing-output-in-capistrano

Or create a Ruby script with your functionality, upload & execute it.

> The next problem is, the maintenance file expects 2 parameters, which normally came fron the command like: REASON="database updates" cap deploy:web:disable.
> Can I prompt for an value only on a specific task?

No, the prompt will appear on all tasks.

Jonathan

--
Jonathan Weiss
http://blog.innerewut.de
http://twitter.com/jweiss

Reply all
Reply to author
Forward
0 new messages