Python 3.6
, 3.7
$ sudo apt-get install python3 build-essential python3-dev
$ brew install python
Please follow the instructions https://github.com/nvm-sh/nvm#installing-and-updating
We're using v10.14.0
(first version we install is the default)
$ nvm install 10.14.0
Please folow the instructions https://classic.yarnpkg.com/en/docs/install/#debian-stable
$ brew install yarn
install poetry
https://poetry.eustace.io/docs/
$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python -
install pre-commit
https://pre-commit.com/
$ curl https://pre-commit.com/install-local.py | python -
And run
$ pre-commit install
Please follow the instractions https://www.nginx.com/resources/wiki/start/topics/tutorials/install/
$ apt-get update
$ apt-get install nginx
$ brew install nginx
Add the following configuration:
server {
listen 8080 default_server;
server_name _;
location / {
proxy_pass http://localhost:3000/api;
proxy_set_header Host localhost:3000;
proxy_http_version 1.1;
}
location /api {
proxy_pass http://localhost:8000/api;
proxy_set_header Host localhost:8000;
proxy_http_version 1.1;
}
}
- On macOS
/usr/local/etc/nginx/nginx.conf
- On Debian / Ubuntu
/etc/nginx/conf.d/default.conf
And reload nginx
$ nginx -s reload
Follow the guide https://docs.docker.com/compose/install/
$ cd backend
$ poetry install
$ cd ui
$ yarn install
First you need to start all the services (postgreSQL, Redis, ElasticSearch, RabbitMQ)
$ docker-compose -f docker-compose.travis.yml up -d
And initialize database and ES
$ cd backend
$ ./scripts/setup
You can visit Backend http://localhost:8000
$ cd backend
$ ./scripts/server
You can visit UI http://localhost:3000
$ cd ui
$ yarn start
You can also connect UI to another environment by changing the proxy a server by changing the ui/package.json
{
...
"proxy": "http://A_PROXY_SERVER",
...
}
Both backend and UI are accessible http://localhost:8080
$ cd backend
$ ./run-tests.sh
Or you can run specific tests:
$ poetry run py.test tests/unit
$ poetry run py.test tests/integration
$ poetry run py.test tests/integration-async
Run isort
and flake8
checks.
$ ./run-code-checks.sh
$ cd ui
$ yarn test # in ui folder
$ ./run-e2e.sh
For script tests we're using cypress https://docs.cypress.io/
$ cd smoke-tests
$ yarn install
$ yarn run cypress:open # UI
$ yarn run cypress:run # cmd interface
First make sure that you are running:
$ cd backend
$ ./scripts/server
There is a command inspirehep importer records
which accepts url -u
, a directory of JSON
files -d
and JSON
files -f
.
A selection of demo records can be found in data
directory and they are structure based on the record type (i.e. literature
). Examples:
# Local
$ poetry run inspirehep importer records -u https://labs.inspirehep.net/api/literature/20 -u https://labs.inspirehep.net/api/literature/1726642
# Docker
$ ./docker-inspire run --rm web poetry run inspirehep importer records -u https://labs.inspirehep.net/api/literature/20 -u https://labs.inspirehep.net/api/literature/1726642
# Local
$ poetry run inspirehep importer records -d data/records/literature
# Docker
$ ./docker-inspire run --rm web poetry run inspirehep importer records -d data/records/literature
# Local
$ poetry run inspirehep importer records -f data/records/literature/374836.json -f data/records/authors/999108.json
# Docker
$ ./docker-inspire run --rm web poetry run inspirehep importer records -f data/records/literature/374836.json -f data/records/authors/999108.json