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

update Vagrantfile to use CentOS-8.2 and Payara5 #7153

Merged
merged 3 commits into from Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 3 additions & 17 deletions Vagrantfile
Expand Up @@ -4,23 +4,15 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.7"

puts "Sorry, this Vagrant environment is not working."
puts "If you'd like to help get it working, please see"
puts "https://github.com/IQSS/dataverse/issues/6849"
puts
puts "You can also try the Vagrant environment at"
puts "https://github.com/GlobalDataverseCommunityConsortium/dataverse-ansible"
exit 1
config.vm.box = "bento/centos-8.2"

config.vm.provider "virtualbox" do |vbox|
vbox.cpus = 4
vbox.memory = 4096
end

#config.vm.provision "shell", path: "scripts/vagrant/setup.sh"
#config.vm.provision "shell", path: "scripts/vagrant/setup-solr.sh"
config.vm.provision "shell", path: "scripts/vagrant/setup.sh"
config.vm.provision "shell", path: "scripts/vagrant/setup-solr.sh"
config.vm.provision "shell", path: "scripts/vagrant/install-dataverse.sh"

config.vm.network "private_network", type: "dhcp"
Expand All @@ -30,12 +22,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network "forwarded_port", guest: 8080, host: 8088
config.vm.network "forwarded_port", guest: 8181, host: 8188

# FIXME: use /dataverse/downloads instead
config.vm.synced_folder "downloads", "/downloads"
# FIXME: use /dataverse/conf instead
config.vm.synced_folder "conf", "/conf"
# FIXME: use /dataverse/scripts instead
config.vm.synced_folder "scripts", "/scripts"
config.vm.synced_folder ".", "/dataverse"

end
2 changes: 0 additions & 2 deletions doc/sphinx-guides/source/developers/tools.rst
Expand Up @@ -30,8 +30,6 @@ With Maven installed you can run ``mvn package`` and ``mvn test`` from the comma
Vagrant
+++++++

Please note that the Vagrant environment is currently broken. For details, see https://github.com/IQSS/dataverse/issues/6849

Vagrant allows you to spin up a virtual machine running Dataverse on your development workstation. You'll need to install Vagrant from https://www.vagrantup.com and VirtualBox from https://www.virtualbox.org.

We assume you have already cloned the repo from https://github.com/IQSS/dataverse as explained in the :doc:`/developers/dev-environment` section.
Expand Down
2 changes: 1 addition & 1 deletion downloads/download.sh
@@ -1,5 +1,5 @@
#!/bin/sh
curl -L -O https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/5.201/payara-5.201.zip
curl -L -O https://github.com/payara/Payara/releases/download/payara-server-5.2020.2/payara-5.2020.2.zip
curl -L -O https://archive.apache.org/dist/lucene/solr/7.7.2/solr-7.7.2.tgz
curl -L -O https://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
20 changes: 6 additions & 14 deletions scripts/vagrant/install-dataverse.sh
Expand Up @@ -7,28 +7,20 @@ fi
WAR=/dataverse/target/dataverse*.war
if [ ! -f $WAR ]; then
echo "no war file found... building"
echo "Installing nss on CentOS 6 to avoid java.security.KeyException while building war file: https://github.com/IQSS/dataverse/issues/2744"
yum install -y nss
su $SUDO_USER -s /bin/sh -c "cd /dataverse && mvn package"
#echo "Installing nss on CentOS 6 to avoid java.security.KeyException while building war file: https://github.com/IQSS/dataverse/issues/2744"
#yum install -y nss
su $SUDO_USER -s /bin/sh -c "cd /dataverse && mvn -q package"
fi
cd /dataverse/scripts/installer

# move any pre-existing `default.config` file out of the way to avoid overwriting
pid=$$
if [ -e default.config ]; then
mv default.config tmp-${pid}-default.config
cp default.config tmp-${pid}-default.config
fi

# FIXME: The default.config format changed in https://github.com/IQSS/dataverse/pull/6809
echo "HOST_DNS_ADDRESS localhost" > default.config
echo "GLASSFISH_DIRECTORY /home/dataverse/payara5" >> default.config

if [ ! -z "$MAILSERVER" ]; then
echo "MAIL_SERVER $MAILSERVER" >> default.config
fi

# FIXME: Switch to newer Python-based installer
./install -y -f
# Switch to newer Python-based installer
python3 ./install.py --noninteractive --config_file="default.config"

if [ -e tmp-${pid}-default.config ]; then # if we moved it out, move it back
mv -f tmp-${pid}-default.config default.config
Expand Down
7 changes: 4 additions & 3 deletions scripts/vagrant/setup-solr.sh
@@ -1,14 +1,15 @@
#!/bin/bash
echo "Setting up Solr"
dnf install -qy lsof
SOLR_USER=solr
SOLR_HOME=/usr/local/solr
mkdir $SOLR_HOME
chown $SOLR_USER:$SOLR_USER $SOLR_HOME
su $SOLR_USER -s /bin/sh -c "cp /downloads/solr-7.7.2.tgz $SOLR_HOME"
su $SOLR_USER -s /bin/sh -c "cp /dataverse/downloads/solr-7.7.2.tgz $SOLR_HOME"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME && tar xfz solr-7.7.2.tgz"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.7.2/server/solr && cp -r configsets/_default . && mv _default collection1"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.7.2/schema*.xml $SOLR_HOME/solr-7.7.2/server/solr/collection1/conf/"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.7.2/solrconfig.xml $SOLR_HOME/solr-7.7.2/server/solr/collection1/conf/solrconfig.xml"
su $SOLR_USER -s /bin/sh -c "cp /dataverse/conf/solr/7.7.2/schema*.xml $SOLR_HOME/solr-7.7.2/server/solr/collection1/conf/"
su $SOLR_USER -s /bin/sh -c "cp /dataverse/conf/solr/7.7.2/solrconfig.xml $SOLR_HOME/solr-7.7.2/server/solr/collection1/conf/solrconfig.xml"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.7.2 && bin/solr start && bin/solr create_core -c collection1 -d server/solr/collection1/conf/"
cp /dataverse/doc/sphinx-guides/source/_static/installation/files/etc/init.d/solr /etc/init.d/solr
chmod 755 /etc/init.d/solr
Expand Down
70 changes: 39 additions & 31 deletions scripts/vagrant/setup.sh
@@ -1,66 +1,73 @@
#!/bin/bash
echo "Installing dependencies for Dataverse"

# Add JQ
# python3 and psycopg2 for the Dataverse installer
dnf install -qy python3 python3-psycopg2

# Add JQ (TODO: just install this from EPEL?)
echo "Installing jq for the setup scripts"
wget http://stedolan.github.io/jq/download/linux64/jq
wget -q http://stedolan.github.io/jq/download/linux64/jq
chmod +x jq
# this is where EPEL puts it
sudo mv jq /usr/bin/jq

echo "Adding Shibboleth yum repo"
cp /dataverse/conf/vagrant/etc/yum.repos.d/shibboleth.repo /etc/yum.repos.d
cp /dataverse/conf/vagrant/etc/yum.repos.d/epel-apache-maven.repo /etc/yum.repos.d
# Uncomment this (and other shib stuff below) if you want
# to use Vagrant (and maybe PageKite) to test Shibboleth.
#yum install -y shibboleth shibboleth-embedded-ds

# java configuration et al
yum install -y java-1.8.0-openjdk-devel apache-maven httpd mod_ssl unzip
alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
alternatives --set javac /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
dnf install -qy java-1.8.0-openjdk-headless maven httpd mod_ssl unzip
alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk/bin/java
# do we need javac? the symlink is tied to package version...
# /etc/alternatives/javac -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el8_2.x86_64/bin/javac
#alternatives --set javac /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
java -version
javac -version
#javac -version

# switching to postgresql-9.6 per #4709
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum makecache fast
yum install -y postgresql96-server
/usr/pgsql-9.6/bin/postgresql96-setup initdb
/usr/bin/systemctl stop postgresql-9.6
cp /dataverse/conf/vagrant/var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/9.6/data/pg_hba.conf
/usr/bin/systemctl start postgresql-9.6
/usr/bin/systemctl enable postgresql-9.6
# disable centos8 postgresql module and install postgresql10-server
dnf -qy module disable postgresql
dnf install -qy https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf install -qy postgresql10-server
/usr/pgsql-10/bin/postgresql-10-setup initdb
/usr/bin/systemctl stop postgresql-10
cp /dataverse/conf/vagrant/var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/10/data/pg_hba.conf
/usr/bin/systemctl start postgresql-10
/usr/bin/systemctl enable postgresql-10

GLASSFISH_USER=dataverse
echo "Ensuring Unix user '$GLASSFISH_USER' exists"
useradd $GLASSFISH_USER || :
PAYARA_USER=dataverse
echo "Ensuring Unix user '$PAYARA_USER' exists"
useradd $PAYARA_USER || :
SOLR_USER=solr
echo "Ensuring Unix user '$SOLR_USER' exists"
useradd $SOLR_USER || :
DOWNLOAD_DIR='/dataverse/downloads'
GLASSFISH_ZIP="$DOWNLOAD_DIR/payara-5.201.zip"
PAYARA_ZIP="$DOWNLOAD_DIR/payara-5.2020.2.zip"
SOLR_TGZ="$DOWNLOAD_DIR/solr-7.7.2.tgz"
if [ ! -f $GLASSFISH_ZIP ] || [ ! -f $SOLR_TGZ ]; then
echo "Couldn't find $GLASSFISH_ZIP or $SOLR_TGZ! Running download script...."
if [ ! -f $PAYARA_ZIP ] || [ ! -f $SOLR_TGZ ]; then
echo "Couldn't find $PAYARA_ZIP or $SOLR_TGZ! Running download script...."
cd $DOWNLOAD_DIR && ./download.sh && cd
echo "Done running download script."
fi
GLASSFISH_USER_HOME=~dataverse
GLASSFISH_ROOT=$GLASSFISH_USER_HOME/payara5
if [ ! -d $GLASSFISH_ROOT ]; then
echo "Copying $GLASSFISH_ZIP to $GLASSFISH_USER_HOME and unzipping"
su $GLASSFISH_USER -s /bin/sh -c "cp $GLASSFISH_ZIP $GLASSFISH_USER_HOME"
su $GLASSFISH_USER -s /bin/sh -c "cd $GLASSFISH_USER_HOME && unzip -q $GLASSFISH_ZIP"
PAYARA_USER_HOME=~dataverse
PAYARA_ROOT=/usr/local/payara5
if [ ! -d $PAYARA_ROOT ]; then
echo "Copying $PAYARA_ZIP to $PAYARA_USER_HOME and unzipping"
su $PAYARA_USER -s /bin/sh -c "cp $PAYARA_ZIP $PAYARA_USER_HOME"
su $PAYARA_USER -s /bin/sh -c "cd $PAYARA_USER_HOME && unzip -q $PAYARA_ZIP"
# default.config defaults to /usr/local/payara5 so let's go with that
rsync -a $PAYARA_USER_HOME/payara5/ $PAYARA_ROOT/
else
echo "$GLASSFISH_ROOT already exists"
echo "$PAYARA_ROOT already exists"
fi

#service shibd start
service httpd stop
/usr/bin/systemctl stop httpd
cp /dataverse/conf/httpd/conf.d/dataverse.conf /etc/httpd/conf.d/dataverse.conf
mkdir -p /var/www/dataverse/error-documents
cp /dataverse/conf/vagrant/var/www/dataverse/error-documents/503.html /var/www/dataverse/error-documents
service httpd start
/usr/bin/systemctl start httpd
#curl -k --sslv3 https://pdurbin.pagekite.me/Shibboleth.sso/Metadata > /tmp/pdurbin.pagekite.me
#cp -a /etc/shibboleth/shibboleth2.xml /etc/shibboleth/shibboleth2.xml.orig
#cp -a /etc/shibboleth/attribute-map.xml /etc/shibboleth/attribute-map.xml.orig
Expand All @@ -72,6 +79,7 @@ service httpd start
#service shibd restart
#curl -k --sslv3 https://pdurbin.pagekite.me/Shibboleth.sso/Metadata > /downloads/pdurbin.pagekite.me
#service httpd restart

echo "#########################################################################################"
echo "# This is a Vagrant test box, so we're disabling firewalld. #
echo "# Re-enable it with $ sudo systemctl enable firewalld && sudo systemctl start firewalld #"
Expand Down