Skip to content

03. Making changes on the local development environment

alawvt edited this page Aug 25, 2020 · 30 revisions

NOTE: Some of the variables in dspace/config/local.cfg are overwritten by variables in site_secrets.yml, which is part of the vtlibans_dspace project. Any changes to those variable should be committed to the vtlibans_dspace project.

The modules folder

One of the challenges of customizing our source code is migrating these changes to future releases of DSpace. To deal with this, DSpace uses Maven WAR Overlays in the dspace/modules/ folder to contain our customizations. Therefore, our customizations should either be in a configuration file in dspace/config/ or in a file in the dspace/modules/ folder. If you need to change a file and it is not already in the modules folder, first copy the file into the modules folder as a separate commit. Then make changes to that file(s) in an additional commit(s). This will allow us to more easily see the customizations that have been made.

Clone this repository into the vtlibans_dspace folder

If you want to modify the code in this repository, you will need to clone it in the vtlibans_dspace folder, as described in Step 4. Set up the shared directory needed for the Vagrantfile and optionally clone the VTUL/vtechworks project

Get the latest code

cd dspace
git checkout vt_6_x_dev
git pull

(If you forget to pull the latest code before you make changes, you can save the changes you made with git stash, then pull with git pull, then reapply your changes to the updated branch with git stash pop.)

Decide on a code branch to use

Simple commit on branch vt_6_x_dev

If you are only going to make a simple change (e.g., a change to a configuration file), you can make the change on the main development branch vt_6_x_dev with a single commit and then push it directly to that branch. You can use your existing vagrant box or create a new one with dspace_repo_version: 'vt_6_x_dev' as described in To redeploy with the latest commit on the same GitHub branch listed in dspace_repo_version.

Create separate branch off branch vt_6_x_dev

For more significant changes, create and check out a feature branch off vt_6_x_dev and make your commits there. You will need to destroy your existing vagrant box with vagrant destroy and create a new vagrant box as described in To deploy a different git branch.

git checkout -b (branchname) 

replace "branchname" with a unique descriptive name, for example

git checkout -b enable_imagemagick_filters

Change site_secrets.yml variable, dspace_repo_version to the new branch name, e.g. dspace_repo_version: 'vt_6_x_dev'

Make changes

Make changes to the code.

Commit changes

Push changes to GitHub

vagrant up for a new vagrant box or vagrant provision for an existing vagrant box

Once you are satisfied, Commit change(s)

push them to GitHub


Build in local machine and rsync (not working now, so don't use)

cd dspace
git checkout vt_6_x_dev # (or desired branch)
mvn clean package -Denv=dspace_local -Dmirage2.on=true
vagrant rsync

Connect to your virtual machine

Change to vtlibans_dspace on your local host and connect to your VM. :

cd ..
vagrant ssh

Stop Tomcat, deploy new code, restart Tomcat.

From your VM:

sudo /usr/sbin/service tomcat8 stop
sudo chown -R vtechworks:vtechworks /var/local/vtechworks/src/dspace/dspace/target/dspace-installer
cd /var/local/vtechworks/src/dspace/dspace/target/dspace-installer
sudo /opt/apache-ant/bin/ant update

sudo chown -R vtechworks:vtechworks /dspace
sudo /usr/sbin/service tomcat8 restart

If necessary, reindex Solr, which may be necessary to see items

WARNING: THIS WILL TAKE NEARLY AN HOUR IF YOU HAVE A FULL COPY OF THE DATABASE

sudo -u vtechworks /dspace/bin/dspace index-discovery -b
sudo /usr/sbin/service tomcat8 start

If you still can't see any items, check the value of 'solr.server' in the maven properties file.

Test

Your repository will be available again shortly at http://192.168.60.4. Test everything.

Create a new administrator

If you need to create a new administrator, see https://wiki.duraspace.org/display/DSDOC5x/Command+Line+Operations.

sudo -u vtechworks /dspace/bin/dspace create-administrator

but see https://groups.google.com/g/dspace-tech/c/9RESJYABb_k if there is an error.

If you need to create a new user account, see https://wiki.duraspace.org/display/DSDOC5x/Managing+User+Accounts.