github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/misc/old-devscripts/dev-indexer (about) 1 #!/usr/bin/perl 2 3 use strict; 4 use FindBin qw($Bin); 5 use Getopt::Long; 6 7 sub usage { 8 die "Usage: dev-indexer [--wipe] <portnumber> -- [other_blobserver_opts]"; 9 } 10 11 my $opt_wipe; 12 GetOptions("wipe" => \$opt_wipe) 13 or usage(); 14 15 my $port = shift || "3200"; 16 usage() unless $port =~ /^\d+$/; 17 18 system("./build.pl", "server/go/camlistored") and die "Failed to build camlistored"; 19 system("./build.pl", "clients/go/camdbinit") and die "Failed to build camdbinit"; 20 21 my $DBNAME = "devcamlistore"; 22 my @opts; 23 if ($opt_wipe) { 24 push @opts, "-wipe"; 25 } else { 26 push @opts, "-ignoreexists"; 27 } 28 29 system("./clients/go/camdbinit/camdbinit", 30 "-user=root", 31 "-password=root", 32 "-host=localhost", 33 "-database=$DBNAME", 34 @opts) and die "Failed to run camdbinit.\n"; 35 36 print "Starting indexer with indexer on http://localhost:$port/indexer/\n"; 37 38 $ENV{CAMLI_PASSWORD} = "pass$port"; 39 $ENV{CAMLI_PORT} = $port; 40 exec("$FindBin::Bin/server/go/camlistored/camlistored", 41 "-configfile=$Bin/config/dev-indexer-config.json", 42 "-listen=:$port", 43 @ARGV);