ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Shea <m...@nitido.com>
Subject Re: publishing via http (with Apache and webdav)
Date Wed, 18 Aug 2010 14:03:30 GMT
Hey Anthony -

This is kinda on the back burner for me for now, since I've been using 
the SSH resolver for publishing for awhile... But thanks for sharing 
your solution! If I need to get this running in future, I'll definitely 
take a look back at this =).


Mike.

> Michael Shea-2 wrote:
>   
>> I will try to figure out how to configure Apache to support creating the 
>> dirs automatically when I have some time for it... In the meanwhile, I 
>> have also worked around the issue by setting up openssh on the target 
>> server so that I can use an SSH resolver.
>>
>>     
>
> Hi,
>
> I just wanted to share my solution. I haven't thoroughly tested it, but it
> seems to be working fine with Ivy 2.2.0-rc1. Basically, I added a mod_perl
> handler to Apache to catch any PUT requests, extract the full path, create
> all the directories, then let it continue its work.
>
> There is definitely some setup. You basically need four things: 
> 1) Apache 2 (I used 2.2.x)
> 2) Perl (I used ActivePerl 5.10) - Ensure it's in your system PATH for
> Apache to pick up!
> 3) mod_perl for Apache (I installed the ActivePerl 5.10 PPM package from
> http://perl.apache.org/docs/2.0/os/win32/install.html#PPM_Packages)
> 4) Apache webdav modules (they came standard with my Apache install)
>
> If you haven't clued in yet, I'm using Windows. The requirements are the
> same in Linux and UNIX, except where you grab perl, apache, and the perl
> module for apache is up to you to figure out. :-P
>
> In your apache base directory create the sub-directory "ApachePerl". In
> there create an empty Perl module file called "AutoMKCOL.pm". Edit it and
> copy/paste the following:
>
> ###########################################################
> #
> # This is a PerlFixupHandler that will take any PUT 
> # requests, determine the path required, and if it doesn't 
> # exist, creates the whole path. If there is a problem 
> # creating the path, an error is generated.
> #
> ###########################################################
> package ApachePerl::AutoMKCOL;
>
> use strict;
> use warnings;
>
> use Apache2::RequestRec ();
> use Apache2::ServerRec ();
> use Apache2::Log ();
>
> use File::Path qw(make_path);
> use File::Basename qw(dirname);
>
> # Compile constants
> use Apache2::Const -compile => qw(DECLINED);
>
> sub handler {
> 	my $r = shift;
>
> 	# Create directories if processing a put request.
> 	if ($r->method() eq "PUT")
> 	{
> 		# The full file system path to the file requested is a concat of the
> request filename and path_info.
> 		my $fullpath = $r->filename() . $r->path_info();
> 		my $dirname = dirname($fullpath);
> 		
> 		# If the directory doesn't exist, create it
> 		if (!(-d $dirname))
> 		{
> 			$r->log->info("Creating directory structure for PUT request: '" .
> $dirname . "'.");
> 			my @dirlist = make_path ($dirname); 
> 			
> 			# If at least one directory wasn't created, there was a problem
> 			die "Failed to create directory structure: '" . $dirname . "'." unless
> $#dirlist > -1;
> 		}
> 	}
>
> 	# Allow next handler to run
> 	return Apache2::Const::DECLINED;
> }
> 1;
>
> Now we turn our attention towards Apache's configuration file
> (conf/httpd.conf):
> - Ensure the mod_perl module is loaded: 
> LoadModule perl_module modules/mod_perl.so
>
> - Ensure the webdav modules are loaded: 
> LoadModule dav_module modules/mod_dav.so
> LoadModule dav_fs_module modules/mod_dav_fs.so
> LoadModule dav_lock_module modules/mod_dav_lock.so
>
> Activate WebDav file locking by adding this line near the top:
> DavLockDB "/path/to/Apache/DavLock"
>
> In the Directory directive of the path you want to enable the PUT method
> (Ivy publishing) add the following:
> <Directory "/path/to/Apache/htdocs/ivy/repository">
>     Dav On
>     PerlFixupHandler +ApachePerl::AutoMKCOL
> </Directory>
>
> And that's about it. Restart Apache and if you did everything right it
> should start fine and you can begin publishing with Ivy via the url
> resolver. In the httpd.conf file, if you change LogLevel to "debug"
> temporarily you will see the messages generated by the perl module and
> potentially other messages if you are having problems.
>
> Good luck!
>   


Mime
View raw message