The Bitrepository quickstart is a package for quickly getting a basic fully functioning bitrepository reference system up on a localhost.
The quickstart will setup a bitrepository comprised of:
As the setup is basic – encryption, authentication and authorization is not enabled in the quickstart.
For the quickstart to work some prerequisites and requirements exists.
All the quickstart components are meant to run on the same machine in an Linux environment. Possibility accessible from other machines, provided that firewall rules allow.
The quickstart needs some infrastructure, for message exchange and file exchange
The bitrepository needs an Apache Active MQ for sending messages between components. In the quickstart it is assumed that it is accessible on the localhost on the default port using a tcp connection. I.e. tcp://localhost:61616
It must not require any authentication to connect.
The default settings from the Apache Active MQ destribution will suffice, but the user/deployer is free to make changes to the Active MQ installation as long as the MQ can be reached as described above.
If the MQ is not available on the above url, the pillars and services simply will not work.
Apache Active MQ can be obtained from the ActiveMQ download site.
You can run this process in docker with this command
In [1]:
!docker run \
--detach \
--rm \
--env 'ACTIVEMQ_MIN_MEMORY=512' \
--env 'ACTIVEMQ_MAX_MEMORY=2048' \
--publish 61616:61616 \
--name activemq \
webcenter/activemq:5.12.0 \
/opt/activemq/bin/activemq console
Per design the bitrepository uses a webdav server for file transfer. The quickstart configuration assumes that a webdav server is available on http://localhost/dav/.
It must not require any authentication to connect.
If no Webdav server is available see File Exchange Server Setup for references on setup.
Should there be a HTTP server running on localhost that does not support webdav, or that use of another webdav server is wanted, then the ReferenceSettings.xml files for the AuditTrailService and CommandLine client needs to be have their FileExchange section changed to reflect this.
As the file location is specified per request this is not a hard requirement for deployment of the quickstart package, but something that needs to be taken into consideration.
You can run a apache2 based webdav server in docker with this easy command
In [2]:
!docker run \
--detach \
--rm \
--publish 80:80 \
--name webdav \
blekinge/apache_webdav
To run the quickstart a few system requirements must be in place.
A java runtime enviroment 1.8 or newer is needed.
For the quickstart.sh script, the curl
is needed to retrieve the Tomcat servlet container.
When having ensured the above mentioned requirements are in place the quickstart package should be obtained from: Quickstart (newest release, devel version).
The quickstart tar.gz should be unpackaged.
Via the commandline cd to the unpacked directory and run the command "./setup.sh"
The first time running the setup script will adapt the configuration files to work with the deployed destination. Thus the quickstart will stop working if the quickstart directory is moved to another destination after the first run.
Running the setup.sh script does the following:
In [3]:
%%bash
wget -Nq "https://sbforge.org/nexus/service/local/artifact/maven/redirect?g=org.bitrepository.reference&a=bitrepository-integration&v=LATEST&r=snapshots&p=tar.gz&c=quickstart&" -O quickstart.tgz
tar -xzf quickstart.tgz
In [4]:
%%bash
cd bitrepository-quickstart
./setup.sh
In [5]:
%alias bitmag bitrepository-quickstart/commandline/bin/bitmag.sh %l
Test for checking the sanity of the system as a whole. This means a roundtrip with only sunshine usage of the system getting through all the core functionality
The purpose of the test is to make certain that the core functionality works as expected when behaving nicely. The test is designed such that the system state is the same prior to the test starting and after ending it - provided that the test passes. This also means that the test can be repeated an arbitrary number of times as long as it passes.
In the following the same fileID is used in all operations. The only restriction is that the fileID is valid for all components in the test, and is not already present in the collection.
In [6]:
%bitmag get-file-ids -c books
In [7]:
%bitmag put-file -c books -f README.md
In [8]:
%bitmag get-file-ids -c books
In [9]:
%bitmag get-checksums -c books -i README.md
In [10]:
%bitmag get-checksums -c books -i README.md -S abcd -R MD5 -p checksum-pillar
In [11]:
%bitmag get-checksums -c books -i README.md -S abcd -R MD5
In [12]:
%bitmag get-checksums -c books -i README.md -R MD5
%bitmag get-checksums -c books -i README.md -S 'abcd' -R MD5
In [13]:
!md5sum README.md
%bitmag get-file -c books -i README.md -l README.md.tmp
!md5sum README.md.tmp
In [14]:
!xmllint bitrepository-quickstart/commandline/logback.xml > logback.changed.xml
oldhash=!md5sum bitrepository-quickstart/commandline/logback.xml | cut -d' ' -f1
%bitmag replace-file -c books -i logback.xml -f logback.changed.xml -C {oldhash} -p file1-pillar
%bitmag replace-file -c books -i logback.xml -f logback.changed.xml -C {oldhash} -p file2-pillar
%bitmag replace-file -c books -i logback.xml -f logback.changed.xml -C {oldhash} -p checksum-pillar
Wait for each pillar to complete the operation.
In [15]:
%bitmag get-file-ids -c books
In [16]:
%bitmag get-checksums -c books -i logback.xml
In [17]:
!md5sum bitrepository-quickstart/commandline/logback.xml
%bitmag get-checksums -c books -i logback.xml
In [18]:
%bitmag get-file -c books -i logback.xml -l logback.downloaded.xml
!md5sum logback.downloaded.xml
!md5sum logback.changed.xml
Wait for the operation(s) to complete with success
In [19]:
oldhash=!md5sum logback.changed.xml | cut -d' ' -f1
%bitmag delete -c books -i logback.xml -C {oldhash} -p file1-pillar
%bitmag delete -c books -i logback.xml -C {oldhash} -p file2-pillar
%bitmag delete -c books -i logback.xml -C {oldhash} -p checksum-pillar
In [20]:
%bitmag get-file-ids -c books -i logback.xml
Use the quickstart script to stop and start the quickstart components:
In [21]:
!bitrepository-quickstart/quickstart.sh stop
Use these commands to stop the docker servers again
In [22]:
!docker stop webdav
In [23]:
!docker stop activemq
In [24]:
!docker ps