No Description

Órla Ní Loinsigh b2ca4b3f0c Initial commit 2 years ago
dev-res b2ca4b3f0c Initial commit 2 years ago
docker b2ca4b3f0c Initial commit 2 years ago
migrations b2ca4b3f0c Initial commit 2 years ago
stor b2ca4b3f0c Initial commit 2 years ago
test-res b2ca4b3f0c Initial commit 2 years ago
tests b2ca4b3f0c Initial commit 2 years ago
.gitignore b2ca4b3f0c Initial commit 2 years ago
README.md b2ca4b3f0c Initial commit 2 years ago
babel.cfg b2ca4b3f0c Initial commit 2 years ago
config.py b2ca4b3f0c Initial commit 2 years ago
dev_run.py b2ca4b3f0c Initial commit 2 years ago
entrypoint.sh b2ca4b3f0c Initial commit 2 years ago
gunicorn.conf.py b2ca4b3f0c Initial commit 2 years ago
requirements.txt b2ca4b3f0c Initial commit 2 years ago
run.py b2ca4b3f0c Initial commit 2 years ago
run.sh.template b2ca4b3f0c Initial commit 2 years ago
staging_setup.py b2ca4b3f0c Initial commit 2 years ago

README.md

Irish Language Resource Infrastructure (ILRI)/eSTÓR UI

Development Quick Start

Dependencies

  • python 3.8+
  • python3.8-venv
  • STÓR toolchain (follow setup instructions to run the Flask app here)
  • Elasticsearch 8.x

Set up virtual environment and install python dependencies

From the checkout location run:

python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Set up Elasticsearch

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
sudo apt install apt-transport-https
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt update && sudo apt install elasticsearch

sudo vi /etc/elasticsearch/elasticsearch.yml
  # add this line: network.host: 0.0.0.0
  # change this line to: xpack.security.enabled: false

sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

Testing

To run with coverage, run the following from the checkout location:

export PYTHONPATH=stor:$PYTHONPATH
pybabel compile -d stor/translations
coverage run -m pytest -s

Running the server

First, copy the run script template locally:

cp run.sh.template run.sh

Next, all the environment variables in run.sh need to be set. If the toolchain service isn't available, then those parts of the editor cannot be run, but the rest should still work.

For the purposes of development, assuming the current working directory is the root of the repository and the toolchains are up and running on the same machine as described above:

  • DB_BASE_DIR is the directory where the database file will be created; it must be writable; commonly, this may be a directory called instance inside the current working directory
  • UPLOAD_FOLDER is the directory where resource files will be uploaded; it must be writable
  • TM_URL is the url of the TM-to-TMX toolchain, most likely http://127.0.0.1:5001/tm
  • DOC_URL is the url of the Doc-to-TMX toolchain, most likely http://127.0.0.1:5001/doc
  • ELASTICSEARCH_URL is the url of the Elasticsearch service; for many developer setups like that outlined above, this will be http://127.0.0.1:9200

The following will run a wrapper script that automatically sets up the required user groups and a few users and then starts the development server. Note that it will delete the contents of DB_BASE_DIR and UPLOAD_FOLDER before starting, so any data left in those from previous runs will be lost.

chmod +x run.sh
./run.sh