Difference between revisions of "Getting started"

From Archivematica
Jump to navigation Jump to search
Line 47: Line 47:
 
# Temporary: switch to playbooks/archivematica branch
 
# Temporary: switch to playbooks/archivematica branch
 
#* <code>git checkout playbooks/archivematica</code>
 
#* <code>git checkout playbooks/archivematica</code>
 +
#* <code>cd deploy-pub/playbooks/archivematica/</code>
 
# Install VirtualBox, Vagrant, Ansible
 
# Install VirtualBox, Vagrant, Ansible
 
#* <code>sudo apt-get install virtualbox vagrant</code>
 
#* <code>sudo apt-get install virtualbox vagrant</code>
#* Vagrant must be at least 1.5
+
#* Vagrant must be at least 1.5 (it can also be downloaded from [https://www.vagrantup.com/downloads.html vagrantup.com])
 
#** <code>vagrant --version</code>
 
#** <code>vagrant --version</code>
#* <code>sudo pip install ansible</code>
+
#* <code>sudo pip install -U ansible</code>
# Helpers
+
# Download Ansible roles
#* Install vagrant helper plugin http://hakunin.com/six-ansible-practices
 
#** <code>vagrant plugin install vagrant-hostsupdater</code>
 
#* Guest additions https://github.com/dotless-de/vagrant-vbguest
 
#** <code>vagrant plugin install vagrant-vbguest</code>
 
# Create machine
 
#* <code>cd deploy-pub/playbooks/archivematica/</code>
 
#* <code>vagrant up</code>
 
#* Will prompt for sudo to modify /etc/hosts adding am-local.myapp.dev
 
# Login now available (but nothing needs to be run on the VM)
 
#* <code>ssh vagrant@am-local.myapp.dev</code> or <code>vagrant ssh</code>
 
# Get updates to roles
 
 
#* <code>ansible-galaxy install -f -r requirements.yml</code>
 
#* <code>ansible-galaxy install -f -r requirements.yml</code>
# Execute playbook
+
# Create virtual machine and provision it
#* <code>ansible-playbook -i hosts singlenode.yml</code>
+
#* <code>vagrant up</code> (it takes a while)
# Archivematica should be available at 192.168.168.192 and the storage service at 192.168.168.192:8000
+
# Login now available via:
 
+
#* <code>vagrant ssh</code>
You may want to add this to your .ssh/config
+
# Services available:
<pre>
+
#* Archivematica - http://192.168.168.192
  Host 192.168.168.* *.myapp.dev
+
#* Archivematica Storage Service: http://192.168.168.192:8000 (user: test, pass: test)
  StrictHostKeyChecking no
 
  UserKnownHostsFile=/dev/null
 
  User vagrant
 
  LogLevel ERROR
 
</pre>
 
  
 
=== Development Machine ===
 
=== Development Machine ===

Revision as of 15:31, 16 September 2015

Main Page > Development > Getting Started

This wiki page describes getting started with Archivematica as a developer. For user and administrative manuals, please see http://www.archivematica.org.

Vital Stats

Projects

Archivematica consists of several projects working together.

  • Archivematica: Main repository containing the user-facing dashboard, task manager MCPServer and clients scripts for the MCPClient
  • Storage Service: Responsible for moving files to Archivematica for processing, and from Archivematica into storage
  • Format Policy Registry: Submodule shared between Archivematica and the Format Policy Registry (FPR) server that displays and updates FPR rules and commands

There are also several smaller repositories that support Archivematica in various ways. In general, you will not need these to develop on Archivematica.

Installation

There are two main ways to run Archivematica in development.

  1. Use ansible and vagrant to install Archivematica in a VM
  2. Install Archivematica on your development machine


Ansible & Vagrant

To install and run Archivematica from source on a VM:

  1. Checkout deployment repo
  2. Temporary: switch to playbooks/archivematica branch
    • git checkout playbooks/archivematica
    • cd deploy-pub/playbooks/archivematica/
  3. Install VirtualBox, Vagrant, Ansible
    • sudo apt-get install virtualbox vagrant
    • Vagrant must be at least 1.5 (it can also be downloaded from vagrantup.com)
      • vagrant --version
    • sudo pip install -U ansible
  4. Download Ansible roles
    • ansible-galaxy install -f -r requirements.yml
  5. Create virtual machine and provision it
    • vagrant up (it takes a while)
  6. Login now available via:
    • vagrant ssh
  7. Services available:

Development Machine

See development environment setup instructions

Tests

Archivematica and the related projects have a small but growing test suite. We use py.test to run our tests, which should be listed as a requirement in the development/local requirements file.

To run the tests, go to the repository root and run py.test

See below for project-specific setup or changes to running the tests.

Archivematica

Before running Archivematica tests, set the following environment variables.

#!/usr/bin/fish
set -xg DJANGO_SETTINGS_MODULE 'settings.local'
set -xg DJANGO_SECRET_KEY 'ADDKEY'
set -xg PYTHONPATH /usr/share/archivematica/dashboard/ /usr/lib/archivematica/archivematicaCommon/

#!/usr/bin/bash
export DJANGO_SETTINGS_MODULE='settings.local'
export DJANGO_SECRET_KEY='ADDKEY'
export PYTHONPATH=$PYTHONPATH:/usr/share/archivematica/dashboard/:/usr/lib/archivematica/archivematicaCommon/

Storage Service

Before running Storage Service tests, set the following environment variables

#!/usr/bin/fish
set -xg DJANGO_SETTINGS_MODULE storage_service.settings.local
set -xg DJANGO_SECRET_KEY 'ADDKEY'
set -xg SS_DB_NAME 'storage_service/default.db'
set -xg SS_DB_USER ''
set -xg SS_DB_PASSWORD ''
set -xg SS_DB_HOST ''
set -xg PYTHONPATH .  # The repository root

#!/usr/bin/bash
export DJANGO_SETTINGS_MODULE=storage_service.settings.local
export DJANGO_SECRET_KEY='ADDKEY'
export SS_DB_NAME='storage_service/default.db'
export SS_DB_USER=''
export SS_DB_PASSWORD=''
export SS_DB_HOST=''
export PYTHONPATH=.  # The repository root

Run tests from the storage_service subdirectory.

Skip known-failing test with py.test --ignore locations/tests/test_models.py