First, create your working directory and cd
into it. Clone the project into this directory:
$ git clone https://github.com/rero/sonar.git
You need to install poetry, it will handle the virtual environment creation for the project in order to sandbox our Python environment, as well as manage the dependency installation, among other things.
$ pyenv install 3.9.9
$ cd sonar
$ pyenv local 3.9.9
$ pip install poetry
Next, cd
into the project directory and bootstrap the instance (this will install
all Python dependencies and build all static assets):
$ cd sonar
$ poetry run ./scripts/bootstrap
Start all dependent services using docker-compose (this will start PostgreSQL, Elasticsearch 6, RabbitMQ and Redis):
$ docker compose up -d
Make sure you have enough virtual memory for Elasticsearch in Docker:
# Linux
$ sysctl -w vm.max_map_count=262144
# macOS
$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
<enter>
linut00001:~# sysctl -w vm.max_map_count=262144
Next, create database tables, search indexes and message queues:
$ poetry run ./scripts/setup
Start the webserver and the celery worker:
$ poetry run ./scripts/server
Start a Python shell:
$ poetry run ./scripts/console
Run the test suite via the provided script:
$ poetry run ./scripts/test
By default, end-to-end tests are skipped. You can include the E2E tests like this:
$ env E2E=yes poetry run ./scripts/test
For more information about end-to-end testing see pytest-invenio.
You can use simulate a full production environment using the
docker-compose.full.yml
. You can start it like this:
$ ./docker/build-images.sh
$ docker compose -f docker-compose.full.yml up -d
$ ./docker/wait-for-services.sh --full
Remember to create database tables, search indexes and message queues if not already done:
$ docker compose -f docker-compose.full.yml run --rm web-ui "poetry run ./scripts/setup"
In addition to the normal docker-compose.yml
, this one will start:
- HAProxy (load balancer)
- Nginx (web frontend)
- UWSGI (application container)
- Celery (background task worker)
- Celery (background task beat)
- Flower (Celery monitoring)