Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4217 glassfish5 #4244

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions conf/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ else
fi
echo Images will be pushed to Docker Hub with the tag \"$TAG\".
# Use "conf" directory as context so we can copy schema.xml into Solr image.
docker build -t iqss/dataverse-solr:$TAG -f solr/Dockerfile ../../conf
docker push iqss/dataverse-solr:$TAG
#docker build -t iqss/dataverse-solr:$TAG -f solr/Dockerfile ../../conf
#docker push iqss/dataverse-solr:$TAG
# TODO: Think about if we really need dataverse.war because it's in dvinstall.zip.
# FIXME: Automate the building of dataverse.war and dvinstall.zip. Think about https://github.com/IQSS/dataverse/issues/3974 and https://github.com/IQSS/dataverse/pull/3975
cp ../../target/dataverse*.war dataverse-glassfish/dataverse.war
cp ../../scripts/installer/dvinstall.zip dataverse-glassfish
cp ../../doc/sphinx-guides/source/_static/util/default.config dataverse-glassfish
cp ../../downloads/glassfish-4.1.zip dataverse-glassfish
cp ../../downloads/glassfish-5.0.zip dataverse-glassfish
cp ../../downloads/weld-osgi-bundle-2.2.10.Final-glassfish4.jar dataverse-glassfish
docker build -t iqss/dataverse-glassfish:$TAG dataverse-glassfish
# FIXME: Check the output of `docker build` and only push on success.
Expand Down
2 changes: 1 addition & 1 deletion conf/docker/dataverse-glassfish/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
glassfish-4.1.zip
glassfish-5.0.zip
weld-osgi-bundle-2.2.10.Final-glassfish4.jar
dvinstall.zip
dataverse.war
Expand Down
14 changes: 5 additions & 9 deletions conf/docker/dataverse-glassfish/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM centos:7.2.1511
MAINTAINER Dataverse (support@dataverse.org)

COPY glassfish-4.1.zip /tmp
COPY glassfish-5.0.zip /tmp
COPY weld-osgi-bundle-2.2.10.Final-glassfish4.jar /tmp
COPY default.config /tmp
COPY dvinstall.zip /tmp
Expand Down Expand Up @@ -33,16 +33,12 @@ RUN find /tmp
#
#RUN exitEarly

# Install Glassfish 4.1
# Install Glassfish 5.0

RUN cd /tmp \
&& unzip glassfish-4.1.zip \
&& mv glassfish4 /usr/local \
&& cd /usr/local/glassfish4/glassfish/modules \
&& rm weld-osgi-bundle.jar \
&& cp /tmp/weld-osgi-bundle-2.2.10.Final-glassfish4.jar . \
#FIXME: Patch Grizzly too!
&& echo "Done installing and patching Glassfish"
&& unzip glassfish-5.0.zip \
&& mv glassfish5 /usr/local \
&& echo "Done installing Glassfish"

RUN chmod g=u /etc/passwd

Expand Down
5 changes: 3 additions & 2 deletions doc/sphinx-guides/source/_static/util/default.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
HOST_DNS_ADDRESS localhost
GLASSFISH_DIRECTORY /usr/local/glassfish4
GLASSFISH_DIRECTORY /usr/local/glassfish5
ADMIN_EMAIL
MAIL_SERVER mail.hmdc.harvard.edu
MAIL_SERVER localhost
POSTGRES_ADMIN_USERNAME postgres
POSTGRES_ADMIN_PASSWORD secret
POSTGRES_SERVER 127.0.0.1
POSTGRES_PORT 5432
Expand Down
4 changes: 3 additions & 1 deletion doc/sphinx-guides/source/developers/dev-environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Glassfish

As a `Java Enterprise Edition <http://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition>`_ 7 (Java EE 7) application, Dataverse requires an applications server to run.

FIXME: Update to Glassfish 5

Glassfish 4.1 is required (not any earlier or later versions until https://github.com/IQSS/dataverse/issues/2628 is resolved), which can be downloaded from http://download.oracle.com/glassfish/4.1/release/glassfish-4.1.zip . If you have downloaded Glassfish as part of a Netbeans bundle, you can manually add the proper version by clicking "Tools", "Servers", "Add Server".

By default, Glassfish reports analytics information. The administration guide suggests this can be disabled with ``asadmin create-jvm-options -Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true``, should this be found to be undesirable for development purposes.
Expand Down Expand Up @@ -163,7 +165,7 @@ Run Installer
Please note the following:

- If you have trouble with the SMTP server, consider editing the installer script to disable the SMTP check.
- Rather than running the installer in "interactive" mode, it's possible to put the values in a file. See "non-interactive mode" in the :doc:`/installation/installation-main` section of the Installation Guide.
- Rather than running the installer in "interactive" mode, it's possible to put the values in a file. See "non-interactive mode" in the :doc:`/installation/installation-main` section of the Installation Guide. If you put a ``default.config`` file in place you can run ``./install -y -f -nogfpasswd -insecure`` to set up a dev environment, for example.

Now that you have all the prerequisites in place, you need to configure the environment for the Dataverse app - configure the database connection, set some options, etc. We have an installer script that should do it all for you. Again, assuming that the clone on the Dataverse repository was retrieved using NetBeans and that it is saved in the path ~/NetBeansProjects:

Expand Down
2 changes: 2 additions & 0 deletions doc/sphinx-guides/source/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Installing Glassfish

**Note:** The Dataverse installer need not be run as root, and it is recommended that Glassfish not run as root either. We suggest the creation of a glassfish service account for this purpose.

FIXME: Update to Glassfish 5

- Download and install Glassfish (installed in ``/usr/local/glassfish4`` in the example commands below)::

# wget http://dlc-cdn.sun.com/glassfish/4.1/release/glassfish-4.1.zip
Expand Down
2 changes: 1 addition & 1 deletion downloads/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
glassfish-4.1.zip
glassfish-5.0.zip
solr-4.6.0.tgz
weld-osgi-bundle-2.2.10.Final-glassfish4.jar
schemaSpy_5.0.0.jar
2 changes: 1 addition & 1 deletion downloads/download.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
curl -L -O http://download.java.net/glassfish/4.1/release/glassfish-4.1.zip
curl -L -O http://download.oracle.com/glassfish/5.0/release/glassfish-5.0.zip
curl -L -O https://archive.apache.org/dist/lucene/solr/4.6.0/solr-4.6.0.tgz
curl -L -O http://search.maven.org/remotecontent?filepath=org/jboss/weld/weld-osgi-bundle/2.2.10.Final/weld-osgi-bundle-2.2.10.Final-glassfish4.jar
curl -s -L http://sourceforge.net/projects/schemaspy/files/schemaspy/SchemaSpy%205.0.0/schemaSpy_5.0.0.jar/download > schemaSpy_5.0.0.jar
1 change: 1 addition & 0 deletions scripts/installer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default.config
31 changes: 26 additions & 5 deletions scripts/installer/install
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ my $mailserver;
my $yes;
my $force;
my $nogfpasswd;
my $insecure;
my $admin_email;
my ($rez) = GetOptions(
#"length=i" => \$length, # numeric
Expand All @@ -28,6 +29,7 @@ my ($rez) = GetOptions(
"y|yes" => \$yes,
"f|force" => \$force,
"nogfpasswd" => \$nogfpasswd,
"insecure" => \$insecure,
"admin_email=s" => \$admin_email,
);

Expand All @@ -54,6 +56,7 @@ else

'POSTGRES_SERVER',
'POSTGRES_PORT',
'POSTGRES_ADMIN_USERNAME',
'POSTGRES_ADMIN_PASSWORD',
'POSTGRES_DATABASE',
'POSTGRES_USER',
Expand All @@ -79,6 +82,7 @@ my %CONFIG_DEFAULTS = (
'ADMIN_EMAIL', '',
'MAIL_SERVER', 'mail.hmdc.harvard.edu',

'POSTGRES_ADMIN_USERNAME', 'postgres',
'POSTGRES_ADMIN_PASSWORD', 'secret',
'POSTGRES_SERVER', '127.0.0.1',
'POSTGRES_PORT', 5432,
Expand All @@ -105,6 +109,7 @@ my %CONFIG_PROMPTS = (

'POSTGRES_SERVER', 'Postgres Server Address',
'POSTGRES_PORT', 'Postgres Server Port',
'POSTGRES_ADMIN_USERNAME', 'Postgres ADMIN username',
'POSTGRES_ADMIN_PASSWORD', 'Postgres ADMIN password',
'POSTGRES_DATABASE', 'Name of the Postgres Database',
'POSTGRES_USER', 'Name of the Postgres User',
Expand All @@ -131,6 +136,7 @@ my %CONFIG_COMMENTS = (

'POSTGRES_SERVER', '',
'POSTGRES_PORT', '',
'POSTGRES_ADMIN_USERNAME', ":\n - We will need this to create the user and database that the Dataverse application will be using.\n (Hit RETURN if access control is set to \"trust\" for this connection in pg_hba.conf)\n: ",
'POSTGRES_ADMIN_PASSWORD', ":\n - We will need this to create the user and database that the Dataverse application will be using.\n (Hit RETURN if access control is set to \"trust\" for this connection in pg_hba.conf)\n: ",
'POSTGRES_USER', ":\n - This is the Postgres user that the Dataverse app will be using to talk to the database\n: ",
'POSTGRES_DATABASE', '',
Expand Down Expand Up @@ -713,14 +719,20 @@ if ( $psql_exec eq "" )
$psql_admin_exec = "PGPASSWORD=" . $CONFIG_DEFAULTS{'POSTGRES_ADMIN_PASSWORD'} . "; export PGPASSWORD; " . $psql_exec;
$psql_exec = "PGPASSWORD=" . $CONFIG_DEFAULTS{'POSTGRES_PASSWORD'} . "; export PGPASSWORD; " . $psql_exec;

print "Checking if we can talk to Postgres as the admin user...\n";
print "Checking if we can talk to Postgres as the admin user (" . $CONFIG_DEFAULTS{'POSTGRES_ADMIN_USERNAME'} . ")...\n";
}

# 4. CONFIGURE POSTGRES:

# 4a. BUT FIRST, CHECK IF WE CAN TALK TO POSTGRES AS THE ADMIN:

if ( $psql_admin_exec eq "" || system( $psql_admin_exec . "/psql -h " . $CONFIG_DEFAULTS{'POSTGRES_SERVER'} . " -U postgres -d postgres -c 'SELECT * FROM pg_roles' > /dev/null 2>&1" ) )
print "\$psql_admin_exec: $psql_admin_exec\n";

my $foo = $psql_admin_exec . "/psql -h " . $CONFIG_DEFAULTS{'POSTGRES_SERVER'} . " -U " . $CONFIG_DEFAULTS{'POSTGRES_ADMIN_USERNAME'} . " -d postgres -c 'SELECT * FROM pg_roles'";

print "\$foo: $foo\n";

if ( $psql_admin_exec eq "" || system( $psql_admin_exec . "/psql -h " . $CONFIG_DEFAULTS{'POSTGRES_SERVER'} . " -U " . $CONFIG_DEFAULTS{'POSTGRES_ADMIN_USERNAME'} . " -d postgres -c 'SELECT * FROM pg_roles' > /dev/null 2>&1" ) )
{
# No, we can't. :(
if ($pg_local_connection)
Expand Down Expand Up @@ -1099,7 +1111,11 @@ else {
# the username and password for every asadmin command, if
# access to :4848 is password-protected:

system( $glassfish_dir. "/bin/asadmin login" );
# If you you have a "default.config" file in place and run `./install -y -f -nogfpasswd`
# you can keep the installation process non-interactive.
unless ($nogfpasswd) {
system( $glassfish_dir. "/bin/asadmin login" );
}

# NEW: configure glassfish using ASADMIN commands:

Expand Down Expand Up @@ -1285,10 +1301,15 @@ for my $script ( "setup-all.sh" ) {
# $run_script = "tmpscript.sh";
#}
#else {
$run_script = $script;
# $run_script = $script;
#}
if ($insecure) {
$run_script = "$script --insecure";
} else {
$run_script = $script;
}

unless ( my $exit_code = system( "./" . $run_script . " > $run_script.$$.log 2>&1") == 0 )
unless ( my $exit_code = system( "./" . $run_script . " > $script.$$.log 2>&1") == 0 )
{
print "\nERROR executing script " . $script . "!\n";
exit 1;
Expand Down
6 changes: 6 additions & 0 deletions scripts/installer/resetgf5anddb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
/usr/local/glassfish5/glassfish/bin/asadmin stop-domain
rm -rf /usr/local/glassfish5/glassfish/domains/domain1/generated
psql -c 'DROP DATABASE "dvndb"' template1
../search/clear
rm -rf ~/dataverse/files
2 changes: 2 additions & 0 deletions scripts/vagrant/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ GLASSFISH_USER=glassfish
echo "Ensuring Unix user '$GLASSFISH_USER' exists"
useradd $GLASSFISH_USER || :
DOWNLOAD_DIR='/dataverse/downloads'
# FIXME: update to Glassfish 5
GLASSFISH_ZIP="$DOWNLOAD_DIR/glassfish-4.1.zip"
SOLR_TGZ="$DOWNLOAD_DIR/solr-4.6.0.tgz"
WELD_PATCH="$DOWNLOAD_DIR/weld-osgi-bundle-2.2.10.Final-glassfish4.jar"
Expand All @@ -37,6 +38,7 @@ if [ ! -f $GLASSFISH_ZIP ] || [ ! -f $SOLR_TGZ ]; then
echo "Done running download script."
fi
GLASSFISH_USER_HOME=~glassfish
# FIXME: update to Glassfish 5
GLASSFISH_ROOT=$GLASSFISH_USER_HOME/glassfish4
if [ ! -d $GLASSFISH_ROOT ]; then
echo "Copying $GLASSFISH_ZIP to $GLASSFISH_USER_HOME and unzipping"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ public void search(boolean onlyDataRelatedToMe) {
String allTypesFilterQuery = SearchFields.TYPE + ":(dataverses OR datasets OR files)";
filterQueriesFinalAllTypes.add(allTypesFilterQuery);

if (page == 0) {
logger.info("Variable 'page' was zero. Changing it one. What does this have to do with upgrading to Glassfish 5?");
page = 1;
}
int paginationStart = (page - 1) * paginationGuiRows;
/**
* @todo
Expand Down
6 changes: 5 additions & 1 deletion src/main/webapp/dataverse.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
<ui:define name="body">
<f:metadata>
<f:viewParam name="id" value="#{DataversePage.dataverse.id}"/>
<f:viewParam name="alias" value="#{DataversePage.dataverse.alias}"/>
<!--Commenting out this "DataversePage.dataverse.alias" line because Glassfish 5 doesn't like it.
No error message appears in server.log, DataversePage.init never fires, and the page shows this error:
"Validation Error – Required fields were missed or there was a validation error. Please scroll down to see details."
-->
<!--<f:viewParam name="alias" value="# {DataversePage.dataverse.alias}"/>-->
<f:viewParam name="ownerId" value="#{DataversePage.ownerId}"/>
<f:viewParam name="editMode" value="#{DataversePage.editMode}"/>
<f:viewAction action="#{DataversePage.init}"/>
Expand Down