From fd2d7cd5c64a2c5aae06d8c4530088b809137e67 Mon Sep 17 00:00:00 2001 From: maxlath Date: Wed, 25 Aug 2021 15:37:10 +0200 Subject: [PATCH] readme: format --- README.md | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a399001..0e71310 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Used only for testing and development purposes, so use in production at your own ## Install -```bash +```sh git clone https://github.com/inventaire/docker-inventaire.git ``` @@ -16,25 +16,25 @@ got to `cd docker-inventaire` clone `inventaire` core application server -> [setup](https://github.com/inventaire/inventaire#installation) -```bash +```sh git clone https://github.com/inventaire/inventaire.git ``` Build -```bash +```sh docker-compose build ``` Download Node dependencies: -```bash +```sh docker-compose run --rm inventaire npm install ``` Configure inventaire so that it can connect to CouchDB: -```bash +```sh echo "module.exports = { db: { username: 'couchdb', @@ -52,7 +52,7 @@ Start the inventaire install steps above, before installing dependencies, make s Delete `network_host` occurences from `docker-compose.yml` and adapt the `config/local.js` in consequence: -``` +```js module.exports = { protocol: 'http', port: 3006, @@ -71,7 +71,7 @@ module.exports = { ## Usage -```bash +```sh docker-compose up -d ``` @@ -79,13 +79,13 @@ docker-compose up -d A user admin is not that useful in development, it only allows you to merge/delete entities, see any user contributions, and a few more things. But if needed, start by signing up a user : -```bash +```sh curl http://localhost:3006/api/auth?action=signup -d '{"username": "yourusername", "password": "yourpassword", "email":"some+email@example.org"}' ``` Grab the new user id -```bash +```sh user_id=$(curl --user yourusername:yourpassword http://localhost:3006/api/user | jq -r '._id') ``` @@ -116,7 +116,7 @@ module.exports = { Elasticsearch import limit may be below the indexation import rate -```bash +```sh curl -XPOST http://localhost:9200/wikidata/_close curl -H 'Content-Type:application/json' -H 'Accept: application/json' -XPUT http://localhost:9200/wikidata/_settings -d '{"index.mapping.total_fields.limit": 20000}' curl -XPOST http://localhost:9200/wikidata/_open @@ -128,13 +128,13 @@ In case you would like to play with out-of-the-box data. Run api tests to populate tests dbs (see Tests section) -```bash +```sh docker-compose -f docker-compose.yml -f docker-compose.test.yml exec inventaire npm run test-api ``` - Replicate `*-tests` dbs documents into `*` dbs -```bash +```sh `docker-compose exec inventaire npm run replicate-tests-db` ``` @@ -142,26 +142,34 @@ docker-compose -f docker-compose.yml -f docker-compose.test.yml exec inventaire Start services with test environnement with [multiple compose files](https://docs.docker.com/compose/extends/#understanding-multiple-compose-files) -```bash +```sh docker-compose -f docker-compose.yml -f docker-compose.test.yml up ``` Execute tests script -`docker-compose exec inventaire npm run test-api` +```sh +docker-compose exec inventaire npm run test-api +``` or execute directly the test command -`docker-compose exec inventaire ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --timeout 20000 /opt/inventaire/path/to/test/file` +```sh +docker-compose exec inventaire ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --timeout 20000 /opt/inventaire/path/to/test/file +``` Tip : create a symbolic link on your machine between the inventaire folder and docker working directory on your machine at `/opt/`, in order to autocomplete path to test file to execute -`sudo ln ~/path/to/inventaire-docker/inventaire /opt -s` +```sh +sudo ln ~/path/to/inventaire-docker/inventaire /opt -s +``` Alternatively, as root in inventaire container: -`# mkdir /supervisor/path/to/inventaire` -`# ln -s /opt/ /supervisor/path/to/inventaire` +```sh +mkdir /supervisor/path/to/inventaire +ln -s /opt/ /supervisor/path/to/inventaire +``` ## Troubleshooting @@ -170,7 +178,7 @@ Alternatively, as root in inventaire container: See also [Elasticsearch with Docker](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/docker.html) -### Quieting couchdb notice -couchdb may warn constantly that `_users` database does not exist, [as documented](https://docs.couchdb.org/en/latest/setup/single-node.html), you can create de database with: +### Quieting CouchDB notice +CouchDB may warn constantly that `_users` database does not exist, [as documented](https://docs.couchdb.org/en/latest/setup/single-node.html), you can create de database with: `curl -X PUT http://127.0.0.1:5984/_users`