1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-08-06 13:19:47 +00:00

Add db and dindexer setup instructions

King_DuckZ 2016-06-16 22:37:30 +01:00
parent 1cebf2bd66
commit 05061ac751

@ -47,7 +47,44 @@ Or, if you prefer a step-by-step list of commands:
mkdir -p dindexer_build/debug
cd dindexer_build/debug
# in the following command replace ~/dindexer with the path to where you cloned the git repository
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DPBL_WITH_TESTS=off ~/dindexer
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DPBL_WITH_TESTS=off -DDB_OWNER_NAME=dindexer-user ~/dindexer
cmake --build .
ctest
```
```
I personally like to have a directory structure like this for my code:
dev
code
dindexer <-- my source code
build
dindexer
debug <-- build files
release <-- build files
If you have a similar structure, it probably makes sense to have one shared location for your dindexer config file. In this case, pass the full path to cmake with the -DDINDEXER_CONFIG_FILE option:
```bash
cd build/dindexer/debug
cmake -DDINDEXER_CONFIG_FILE=$HOME/dev/build/dindexer.yml .
```
This will override whatever default was chosen by the first invocation of cmake.
## Setting up PostgreSQL
Assuming you already have PostgreSQL already up and running, you need to create a new database and the tables that dindexer will use. Follow these steps:
* Create a user if you want to have a separate user for dindexer - I generally call it dindexer-user. This has to match the value you passed to the -DDB_OWNER_NAME option in cmake.
* Create a database, you can call it however you like but in this example I'll just call it dindexer-db
* Build dindexer as explained in this page
* Find a file called dindexer.sql in your build directory, it contains the schema you need to create.
* If you are using pgadmin3, connect to the database you just created, then in the list on the left right-click on dindexer-db and choose Restore; in the popup dialog put the full path to dindexer.sql in the Filename field, choose dindexer-user as the Rolename and click the Restore button.
## Setting up dindexer
At this point you only need to tell dindexer the parameters to connect to PostgreSQL.
* Copy the sample dindexer.yml from your source to where dindexer expects to find it - if you're not sure where you should put it, simply run `./dindexer -b` and look at the path next to the CONFIG_FILE_PATH field.
* Open the configuration file you just copied and fill in the options with the right parameters to connect to PostgreSQL
At this point you're ready to go. Try running `./dindexer locate test.txt`. You should get no output at all. If you get any error message instead, you're still missing something.