Skip to content

Commit

Permalink
document need for jq, now scripts fail if not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Oct 23, 2014
1 parent bbcbc01 commit c1de8b3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
19 changes: 12 additions & 7 deletions doc/Sphinx/source/Developers/dev-main.rst
Expand Up @@ -5,40 +5,45 @@ Solr and Dev Environment
Solr
++++

Dataverse 4.0 depends on Solr, which you should run on localhost during development. The Dataverse-specific ``schema.xml`` configuration file described below is required. Solr must be running with this custom schema in place during setup.
Dataverse 4.0 depends on Solr ( http://lucene.apache.org/solr/ ) , which you should run on localhost during development. The Dataverse-specific ``schema.xml`` configuration file described below is required. Solr must be running with this custom schema in place during setup.

Installing and Running Solr
===========================

Download solr-4.6.0.tgz from http://lucene.apache.org/solr/ to any directory you like but in the example below, we have downloaded the tarball to a directory called "solr" in our home directory. For now we are using the "example" template but we are replacing ``schema.xml`` with our own.
Download solr-4.6.0.tgz from http://archive.apache.org/dist/lucene/solr/4.6.0/solr-4.6.0.tgz to any directory you like but in the example below, we have downloaded the tarball to a directory called "solr" in our home directory. For now we are using the "example" template but we are replacing ``schema.xml`` with our own.

- ``cd ~/solr``
- ``tar xvfz solr-4.6.0.tgz``
- ``cd solr-4.6.0/example``
- ``cp ~/NetBeansProjects/dataverse/conf/solr/4.6.0/schema.xml solr/collection1/conf/schema.xml``
- ``java -jar start.jar``

Please note: If you prefer, once the proper ``schema.xml`` file is in place, you can simply double-click "start.jar" rather that running ``java -jar start.jar`` from the command line.
Please note: If you prefer, once the proper ``schema.xml`` file is in place, you can simply double-click "start.jar" rather that running ``java -jar start.jar`` from the command line. Figuring out how to stop Solr after double-clicking it is an exercise for the reader.

Once Solr is up and running you should be able to see a "Solr Admin" dashboard at http://localhost:8983/solr

Once some dataverses, datasets, and files have been created and indexed, you can experiment with searches directly from Solr at http://localhost:8983/solr/#/collection1/query and look at the JSON output of searches, such as this wildcard search: http://localhost:8983/solr/collection1/select?q=*%3A*&wt=json&indent=true . You can also get JSON output of static fields Solr knows about: http://localhost:8983/solr/schema/fields

jq
++

A command-line tool called ``jq`` ( http://stedolan.github.io/jq/ ) is required by the setup scripts.

If you are already using ``brew``, ``apt-get``, or ``yum``, you can install ``jq`` that way. Otherwise, download the binary for your platform from http://stedolan.github.io/jq/ and make sure it is in your ``$PATH`` (``/usr/bin/jq`` is fine) and executable with ``sudo chmod +x /usr/bin/jq``.

Setting up your dev environment
+++++++++++++++++++++++++++++++

Once you install Glassfish 4 and PostgreSQL, you need to configure the environment for the dataverse app - configure the database connection, set some options, etc. We have a new installer script that should do it all for you:
Once you install Glassfish 4 and PostgreSQL, you need to configure the environment for the Dataverse app - configure the database connection, set some options, etc. We have a new installer script that should do it all for you:

``cd scripts/install``

``./install``

The script will prompt your for some configuration values. It is recommended that you choose "localhost" for your hostname if this is a development environment. For everything else it should be safe to accept the defaults.
The script will prompt you for some configuration values. It is recommended that you choose "localhost" for your hostname if this is a development environment. For everything else it should be safe to accept the defaults.

This new script is a hybrid of the old installer from v.3.* and Michael's shell script - the latter is used for configuring Glassfish, by means of asadmin commands. A serious advantage of this approach is that you should now be able to safely run the installer on an already configured system.

Once again, you don't need to run the old script ``scripts/setup/asadmin-setup.sh`` anymore!

All the future changes to the configuration that are Glassfish-specific and can be done through asadmin should now go into ``scripts/install/glassfish-setup.sh``.

Rebuilding your dev environment
Expand Down
1 change: 1 addition & 0 deletions scripts/api/setup-all.sh
@@ -1,4 +1,5 @@
#!/bin/bash
command -v jq >/dev/null 2>&1 || { echo >&2 '`jq` ("sed for JSON") is required, but not installed. Download the binary for your platform from http://stedolan.github.io/jq/ and make sure it is in your $PATH (/usr/bin/jq is fine) and executable with `sudo chmod +x /usr/bin/jq`. On Mac, you can install it with `brew install jq` if you use homebrew: http://brew.sh . Aborting.'; exit 1; }
echo "deleting all data from Solr"
curl http://localhost:8983/solr/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"

Expand Down
15 changes: 14 additions & 1 deletion scripts/installer/install
Expand Up @@ -354,10 +354,11 @@ while (<DATATEMPLATEIN>) {
close DATATEMPLATEIN;
close SQLDATAOUT;

# 3. CHECK POSTGRES AVAILABILITY:
# 3. CHECK POSTGRES AND JQ AVAILABILITY:

my $pg_local_connection = 0;
my $psql_exec;
my $jq_exec = "";
my $pg_major_version = 0;
my $pg_minor_version = 0;

Expand Down Expand Up @@ -396,6 +397,18 @@ if ( $CONFIG_DEFAULTS{'POSTGRES_SERVER'} eq 'localhost' ) {
}
}

for my $sys_path_dir (@sys_path_dirs) {
if ( -x $sys_path_dir . "/jq" ) {
$jq_exec = $sys_path_dir;
last;
}
}
if ( $jq_exec eq "" ) {
print STDERR "\nERROR: I haven't been able to find the jq command in your PATH! Please install it from http://stedolan.github.io/jq/\n";
exit 1;

}

my $psql_major_version = 0;
my $psql_minor_version = 0;

Expand Down

0 comments on commit c1de8b3

Please sign in to comment.