aiiinotate
v0.9.1
Published
a fast IIIF-compliant annotation server
Maintainers
Readme
aiiinotate
aiiinotate is a fast and lightweight annotation server for IIIF. It relies on nodejs/fastify and mongodb and provides an API to read/write/update/delete IIIF annotations and index manifests.
NOTE: currently, only annotations following the IIIF presentation API 2.0 and 2.1 are supported.
API
See the docs on the aiiinotate API.
PROD USAGE
Install
Install mongodb.
- see dev installation script for help
- checkout the official installation guide
Install aiiinotate
npm install aiiinotateEnv definition
Basic definition
Copy config/.env.template to .env and edit it.
Runtime env sourcing
Once the package is installed, it must access variables from the .env file. However, running aiiinotate <commands> creates a subscript which means you can't source an .env file.
# THIS WILL FAIL: `aiiinotate` is executed in a subscript that doesn't inherit from the variables fetched in `source`.
source /path/to/.env && aiiinotate <command>The solutions: do either:
- use
dotenvxto inject variables:npx dotenvx run -f /path/to/.env -- aiiinotate <command> - manually export variables:
set -a source /path/to/.env set +a aiiinotate <command>
For clarity, we omit env sourcing from the below commands.
Setup the app
- Start
mongod
sudo systemctl start mongod- Create and configure the database
aiiinotate migrate applyUsage
All commands are accessible through a CLI (./src/cli).
Run the app
aiiinotate serve prodRun the CLI
The base command is:
aiiinotate -- <command>It will give full access to the CLI interface of Aiiinotate. Run aiiinotate --help for more info.
For more information, see the CLI docs.
Import data
See the CLI docs.
DEV USAGE
Install
# clone the repo
git clone [email protected]:Aikon-platform/aiiinotate.git
# move inside it
cd aiiinotate
# install mongodb
bash ./scripts/setup_mongodb.sh
# install node
bash ./scripts/setup_node.sh
# install dependencies
npm iSetup
After installing, some setup must be done
Setup your
.envfile afterconfig/.env.templateand place it at./config/.env.Start
mongod
sudo systemctl start mongod- Configure the database
npm run migrate applyUsage
Remember to have your mongodb service running: sudo systemctl start mongod !
- Start the app
# reload enabled
npm run dev- Test the app. NOTE: the tests will probably fail if you set the env variable
AIIINOTATE_STRICT_MODEtotrue.
npm run test- Run the CLI. (see the CLI docs for more info)
npm run cli- Process migrations. (see the CLI docs for more info)
# NOTE: the `--` is necessary !
npm run migrate -- <command> <arguments?>- Import data. (see the CLI docs for more info)
# NOTE: the `--` is necessary !
npm run cli -- import <arguments>Test coverage
aiiinotate is well tested: over 90% test coverage on all files !
ℹ ----------------------------------------------------------------------------------------
ℹ file | line % | branch % | funcs % | uncovered lines
ℹ ----------------------------------------------------------------------------------------
ℹ all files | 90.02 | 79.43 | 78.73 |
ℹ ----------------------------------------------------------------------------------------License
GNU GPL 3.0.
