Setting up a development environment with Git

From EPrints Documentation
Revision as of 06:16, 30 August 2018 by Kgoetz (Talk | contribs)

Jump to: navigation, search

This page will detail how to set up EPrints in a development environment that will allow you to keep your local version up to date with any changes made to the EPrints Git repository [1]

Ideally you should work through a package install of EPrints before you do this, which will set up users and dependencies for you. You can find a handy video tutorial on how to do that on YouTube [2].

Your development environment should ideally emulate your production environment as closely as possible - you may want to run a virtual machine through an application such as VirtualBox, or use a Linux install directly on your development device.

Install Git

In your development environment, open a terminal window.

To install Git, use sudo apt-get install git

Set up the directory

This is the directory we are going to clone the repository into and it needs to sit in /usr/share. For example, you may want to call it eprints-git, so use the command sudo mkdir /usr/share/eprints-git.

NOTE: From now on you can replace any instance of <your-directory> with the name you've given your eprints directory. Don't include the <> marks, though!

We now need to give ownership to the eprints user and www-data group. If you don't have an eprints user, you'll need to create one. Set ownership with sudo chown eprints:www-data <your-directory>.

Clone the repository

The first thing to do now is to change to your new eprints folder with cd <your-directory>. Now switch to your eprints user with sudo su eprints.

Let's clone the repository into here. Head off to the repository in your browser [3] and take a look at the right hand sidebar. There is a box with the HTTPS clone url in it - copy this URL and use it in the command git clone <the-url> on your command line. If all goes to plan, Git should now clone the repository into your directory!

Get your dev EPrints working

Okay, so now things get a little fiddly. Head into the core EPrints libraries by typing cd eprints/perl_lib/EPrints. Now we're going to create a copy of the template SystemSettings.pm file. Do this with cp SystemSettings.pm.templ SystemSettings.pm.

We now need to edit this new SystemSettings file. You can do this in your editor of choice. Find the line that reads 'base_path' => "/opt/eprints3". This should be line 20. You need to edit this to read' 'base_path' => "/usr/share/<your-directory>/eprints"

You should also make sure that the user and group settings (lines 23 and 24) are correct - these are usually eprints. Save your changes.

Now we need to create a repository. Type cd ../../bin. From here, ./epadmin create to start the repository creation script. Follow this through to create your new repository.

Finally, we need to add our repository as a site. This will be an easy task if you've already installed EPrints from a package (as suggested at the beginning of this documentation!) but the location of the sites is platform dependant. On Ubuntu, you can find them in etc/apache2/sites-enabled, for example. Edit eprints.conf in your text editor of choice and change the path to reflect where your new site lives.

Restart your server with sudo apache2 restart and you should be able to access your new Git enabled site from a browser. If you've changed the hostname for your site, don't forget to edit your hosts file accordingly!