Skip to content
Draft
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
19 changes: 19 additions & 0 deletions scripts/deploy/download_dataverse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

. setenv.sh

mkdir -p $SCRIPTS_DOWNLOAD_DIR

if [[ -f ${DATAVERSE_WAR} ]]; then
rm "${DATAVERSE_WAR}"
fi

if [[ -f ${DATAVERSE_ORIGINAL_WAR} ]]; then
echo "$DATAVERSE_HTTP_DOWNLOAD already downloaded to ${DATAVERSE_ORIGINAL_WAR}."
else
echo "Downloading $DATAVERSE_HTTP_DOWNLOAD to ${DATAVERSE_ORIGINAL_WAR}."
wget -O $DATAVERSE_ORIGINAL_WAR "$DATAVERSE_HTTP_DOWNLOAD"
fi

cp $DATAVERSE_ORIGINAL_WAR ${DATAVERSE_WAR}

21 changes: 21 additions & 0 deletions scripts/deploy/reindex_solr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e
. setenv.sh

echo "### ReIndex Solr step 1 ###"
reindex_step1_resp=$(curl -X DELETE "$DATAVERSE_API_URL/admin/index/timestamps?unblock-key=$UNBLOCK_KEY")

echo "status: $reindex_step1_resp"
if [[ $reindex_step1_resp != *"\"status\":\"OK\","* ]]; then
echo "### ReIndex step 1 failed!!! ###"
exit 1
fi

echo "### ReIndex Solr step 2 ###"
reindex_step2_resp=$(curl "$DATAVERSE_API_URL/admin/index/continue?unblock-key=$UNBLOCK_KEY")
echo "status: $reindex_step2_resp"
if [[ $reindex_step2_resp != *"\"status\":\"OK\","* ]]; then
echo "### ReIndex step 2 failed!!! ###"
exit 1
fi
37 changes: 37 additions & 0 deletions scripts/deploy/setenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

export SCRIPTS_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
export SCRIPTS_DOWNLOAD_DIR=$HOME/download

export DATAVERSE_MODULE="dataverse/dataverse-webapp"

# RELEASE VERSION
#export DATAVERSE_VERSION=1.0.0
#export DATAVERSE_WAR_NAME=dataverse-webapp-$DATAVERSE_VERSION.war
#export DATAVERSE_HTTP_DOWNLOAD=https://maven.ceon.pl/artifactory/drodb-releases/pl/edu/icm/$DATAVERSE_MODULE/$DATAVERSE_VERSION/$DATAVERSE_WAR_NAME

# SNAPSHOT VERSION
export DATAVERSE_VERSION=1.1.0-SNAPSHOT
export DATAVERSE_WAR_NAME=dataverse-webapp-1.1.0-20250312.014933-20.war
export DATAVERSE_HTTP_DOWNLOAD=https://maven.ceon.pl/artifactory/drodb-snapshots/pl/edu/icm/$DATAVERSE_MODULE/$DATAVERSE_VERSION/$DATAVERSE_WAR_NAME


export SCHEMA_XML_HTTP_DOWNLOAD=https://raw.githubusercontent.com/CeON/dataverse/develop/conf/solr/7.3.1/schema.xml
export SOLR_CONFIG_XML_HTTP_DOWNLOAD=https://raw.githubusercontent.com/CeON/dataverse/develop/conf/solr/7.3.1/solrconfig.xml

export DATAVERSE_ORIGINAL_WAR=$SCRIPTS_DOWNLOAD_DIR/$DATAVERSE_WAR_NAME
export DATAVERSE_WAR=$SCRIPTS_DOWNLOAD_DIR/dataverse.war
export SCHEMA_XML=$SCRIPTS_DOWNLOAD_DIR/schema.xml
export SOLR_CONFIG_XML=$SCRIPTS_DOWNLOAD_DIR/solrconfig.xml

export ASADMIN_BIN="/opt/glassfish/bin/asadmin"
export GLASSFISH_DOMAIN_DIR=/opt/glassfish/glassfish/domains/domain1
export SOLR_DIR=/opt/solr
export SOLR_COLLECTION_DIR=$SOLR_DIR/server/solr/collection1

export LOGIN_AS_GLASSFISH="sudo /bin/su - glassfish -s /bin/bash"
export LOGIN_AS_SOLR="sudo /bin/su - solr -s /bin/bash"
export SERVICE_BIN="sudo /bin/systemctl"

export DATAVERSE_API_URL=http://localhost:8080/api

19 changes: 19 additions & 0 deletions scripts/deploy/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e
. setenv.sh

echo "### Starting Solr ###"
$SERVICE_BIN start solr

echo "### Starting Glassfish ###"
$SERVICE_BIN start glassfish

echo "### Downloading Dataverse war ###"
. download_dataverse.sh

echo "### Deploying Dataverse ###"
$ASADMIN_BIN deploy --force $DATAVERSE_WAR

. reindex_solr.sh

13 changes: 13 additions & 0 deletions scripts/deploy/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

. setenv.sh

echo "### Undeploying Dataverse ###"
$ASADMIN_BIN undeploy dataverse

echo "### Stopping Glassfish ###"
$SERVICE_BIN stop glassfish

echo "### Stopping Solr ###"
$SERVICE_BIN stop solr

15 changes: 15 additions & 0 deletions scripts/deploy/update_solr_schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

. setenv.sh

if [ "$(whoami)" != "solr" ]; then
echo "Script must be run as user: solr"
exit -1
fi

wget -O $SOLR_CONFIG_XML $SOLR_CONFIG_XML_HTTP_DOWNLOAD
wget -O $SCHEMA_XML $SCHEMA_XML_HTTP_DOWNLOAD

cp $SCHEMA_XML $SOLR_COLLECTION_DIR/conf/
cp $SOLR_CONFIG_XML $SOLR_COLLECTION_DIR/conf/