2011-03-05 23:31:54 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
2011-05-01 23:23:58 +00:00
|
|
|
use FindBin qw($Bin);
|
2011-03-05 23:31:54 +00:00
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
sub usage {
|
2011-03-19 08:30:18 +00:00
|
|
|
die "Usage: dev-indexer [--wipe] <portnumber> -- [other_blobserver_opts]";
|
2011-03-05 23:31:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
my $opt_wipe;
|
|
|
|
GetOptions("wipe" => \$opt_wipe)
|
|
|
|
or usage();
|
|
|
|
|
|
|
|
my $port = shift || "3200";
|
|
|
|
usage() unless $port =~ /^\d+$/;
|
|
|
|
|
2011-05-02 01:21:22 +00:00
|
|
|
system("./build.pl", "server/go/camlistored") and die "Failed to build camlistored";
|
|
|
|
system("./build.pl", "clients/go/camdbinit") and die "Failed to build camdbinit";
|
2011-05-01 23:23:58 +00:00
|
|
|
|
2011-03-13 01:40:42 +00:00
|
|
|
my $DBNAME = "devcamlistore";
|
2011-05-02 01:21:22 +00:00
|
|
|
my @opts;
|
2011-03-05 23:31:54 +00:00
|
|
|
if ($opt_wipe) {
|
2011-05-02 01:21:22 +00:00
|
|
|
push @opts, "-wipe";
|
|
|
|
} else {
|
|
|
|
push @opts, "-ignoreexists";
|
2011-03-05 23:31:54 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 01:21:22 +00:00
|
|
|
system("./clients/go/camdbinit/camdbinit",
|
|
|
|
"-user=root",
|
|
|
|
"-password=root",
|
|
|
|
"-host=localhost",
|
|
|
|
"-database=$DBNAME",
|
|
|
|
@opts) and die "Failed to run camdbinit.\n";
|
|
|
|
|
2011-05-01 23:23:58 +00:00
|
|
|
print "Starting indexer with indexer on http://localhost:$port/indexer/\n";
|
2011-03-05 23:31:54 +00:00
|
|
|
|
|
|
|
$ENV{CAMLI_PASSWORD} = "pass$port";
|
2011-05-01 23:23:58 +00:00
|
|
|
$ENV{CAMLI_PORT} = $port;
|
2011-03-30 03:29:32 +00:00
|
|
|
exec("$FindBin::Bin/server/go/camlistored/camlistored",
|
2011-05-01 23:23:58 +00:00
|
|
|
"-configfile=$Bin/config/dev-indexer-config.json",
|
2011-03-05 23:31:54 +00:00
|
|
|
"-listen=:$port",
|
|
|
|
@ARGV);
|