Skip to content

Commit

Permalink
Add local build script and instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Jan 17, 2024
1 parent b829838 commit 63bda8d
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 18 deletions.
63 changes: 45 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,71 @@
# Srophé Application

A TEI publishing application. The Digital Wright

The Srophé Application is an open source TEI publishing framework. Originally developed as a digital publication platform for
Syriaca.org [http://syriaca.org/] the Srophé software has been generalize for use with any TEI publications.
The Srophé Application is an open source TEI publishing framework. Originally developed as a digital publication platform for Syriaca.org [http://syriaca.org/] the Srophé software has been generalize for use with any TEI publications.

## The Srophé Application offers
* Multi-lingual Browse

* Multi-lingual Browse
* Multi-lingual Search
* Faceted searching and browsing
* Maps (Google or Leafletjs) for records with coordinates.
* Maps (Google or Leafletjs) for records with coordinates.
* Timelines (https://timeline.knightlab.com/)
* D3js visualizations for TEI relationships
* RDF and SPARQL integration and data conversion
* Multi-format publishing: HTML, TEI, geoJSON, KML, JSON-LD, RDF/XML, RDF/TTL, Plain text

## Requirements
The Srophé Application runs on eXist-db v3.5.0 and up.

In order to use the git-sync feature
(syncing your online website with your github repository) you will need to install the eXist-db EXPath Cryptographic Module Implementation [http://exist-db.org/exist/apps/public-repo/packages/expath-crypto-exist-lib.html].
## Requirements

The Srophé Application runs on eXist-db v3.5.0 and up. In order to use the git-sync feature (syncing your online website with your github repository) you will need to install the eXist-db EXPath Cryptographic Module Implementation [http://exist-db.org/exist/apps/public-repo/packages/expath-crypto-exist-lib.html].

To use the RDF triplestore and SPARQL endpoint you will need to install the exist-db SPARQL and RDF indexing module [http://exist-db.org/exist/apps/public-repo/packages/exist-sparql.html?eXist-db-min-version=3.0.3]


## Getting started

Clone or fork the repository.

Create a data repository, clone or fork the https://github.com/srophe/srophe-app-data repository, or create your own.
Create a data repository, clone or fork the https://github.com/srophe/srophe-app-data repository, or create your own.

### Add your data
Add your TEI the data directory in srophe-app-data/data.
The Srophé Application depends on a unique identifier, for Syriaca.org uses `tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno[@type='URL']` as a unique identifier.
It is also possible to use the document uri, changes would have to made in repo-config.xml and in controller.xql to enable use of the document uri rather then the tei:idno.

Add your TEI the data directory in srophe-app-data/data.

The Srophé Application depends on a unique identifier, for Syriaca.org uses `tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:idno[@type='URL']` as a unique identifier.

It is also possible to use the document uri, changes would have to made in repo-config.xml and in controller.xql to enable use of the document uri rather then the tei:idno.

### Deploy data and application
In the root directory of each of your new repositories run 'ant' [link to ant instructions] to build the eXist-db application.
A new .xar file will be built and saved in srophe/build/ and srophe-data/build. You can install these applications via the eXist-db dashboard [http://localhost:8080/exist/apps/dashboard/index.html] using the Package Manager.

Once deployed the application should show up as 'The Srophe web application' on your dashboard.
Click on the icon to be taken to the app.
In the root directory of each of your new repositories run 'ant' [link to ant instructions] to build the eXist-db application.

A new .xar file will be built and saved in srophe/build/ and srophe-data/build. You can install these applications via the eXist-db dashboard [http://localhost:8080/exist/apps/dashboard/index.html] using the Package Manager.

Once deployed the application should show up as 'The Srophe web application' on your dashboard.
Click on the icon to be taken to the app.

Learn how to customize the application.

### Running Docker Container Locally

#### Local Requirements

*NOTE:* If you are on a Mac, you can use [Homebrew](https://brew.sh/) to install these requirements.

* [Docker](https://www.docker.com/products/docker-desktop/)
* [JDK](https://www.oracle.com/java/technologies/downloads/)
* Ant [Windows](https://mkyong.com/ant/how-to-install-apache-ant-on-windows/) | [MacOS](https://mkyong.com/ant/how-to-apache-ant-on-mac-os-x/)

#### Build and Run

From the root directory for this codebase, run the following command from the terminal.

~~~bash
ADMIN_PASSWORD=security! ./build/local.sh
~~~

If all goes well, you should be able to see the app running in the container at [localhost:8080](http://localhost:8080).

When you make changes to the code, you will need to stop the container and rerun the the script.

The "ADMIN_PASSWORD=security!" bit sets an environment variable used when starting eXist. This can be whatever you want. You could also set it to your environment and not have to include it each time you run the container.
45 changes: 45 additions & 0 deletions build/local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# force update
GITHUB_ORG="ecds"
GITHUB_REPOSITORY="WesleyWorks-data"

# remove any old auto deploy
rm -rf autodeploy
# create an autodeploy folder
mkdir autodeploy

echo "Running app build ..."
ant
echo "Ran app build successfully"

echo "Fetching the data repository to build a data xar"
git clone https://github.com/$GITHUB_ORG/$GITHUB_REPOSITORY

cd $GITHUB_REPOSITORY && rm -rf build && mkdir build
echo "Running data build ..."
ant
echo "Ran data build successfully"

cd ..

# move the xar from build to autodeploy
mv build/*.xar autodeploy/
mv $GITHUB_REPOSITORY/build/*.xar autodeploy/

rm -rf $GITHUB_REPOSITORY

# GET the version of the project from the expath-pkg.xml
VERSION=$(cat expath-pkg.xml | grep package | grep version= | awk -F'version="' '{ print $2 }' | awk -F'"' '{ print $1 }')
# GET the package name of the project from the expath-pkg.xml file
PACKAGE_NAME=$(cat expath-pkg.xml | grep package | grep version= | awk -F'abbrev="' '{ print $2 }' | awk -F'"' '{ print tolower($1) }')

echo "Deploying app $PACKAGE_NAME:$VERSION"


echo "Building docker file"
docker build -t "$PACKAGE_NAME:$VERSION" --build-arg ADMIN_PASSWORD="$ADMIN_PASSWORD" .
echo docker build -t "$PACKAGE_NAME:$VERSION" --build-arg ADMIN_PASSWORD="$ADMIN_PASSWORD" .
echo "Built successfully"

echo "Starting Docker container"
echo "Open your browser to http://localhost:8080"
docker run -it -p 8080:8080 "$PACKAGE_NAME:$VERSION" > /dev/null 2>&1

0 comments on commit 63bda8d

Please sign in to comment.