Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Befriend QColdsweat with a PostgreSQL database

Jiří Smolík edited this page Apr 4, 2017 · 15 revisions

WORK UNDER PROGRESS:
Consider this page only a draft for now. Don't take it too seriously.

https://www.postgresql.org/docs/9.6/static/sql-createdatabase.html
https://www.postgresql.org/docs/9.6/static/app-createuser.html
https://www.postgresql.org/docs/9.6/static/bookindex.html
http://stackoverflow.com/questions/1471571/how-to-configure-postgresql-for-the-first-time
http://stackoverflow.com/questions/2172569/how-do-i-login-and-authenticate-to-postgresql-after-a-fresh-install https://www.adminer.org/ https://github.com/vrana/adminer/

Coldsweat uses the psycopg2 python module to communicate with PostgreSQL and at the time of writing, its compatibility is:

  • Python 2 versions from 2.6 to 2.7
  • Python 3 versions from 3.2 to 3.6
  • PostgreSQL server versions from 7.4 to 9.6
  • PostgreSQL client library version from 9.1

This means that psycopg2 v2.7.1 supports PostgreSQL v9.6.x and therefore, QColdsweat supports PostgreSQL v9.6.x. At the time of writing, you could use one of the following QPKGs:

  • App Center (depending on QTS and your NAS model): PostgreSQL v9.6.0.1.
  • App Center (depending on QTS and your NAS model): PostgreSQL v9.3.4.2.
  • QNAP forum (non-ARM machines): PostgreSQL v9.5.4.

All of those should be supported :).

Step 1: Install QColdsweat

See the README.

Step 2: Install PostgreSQL

As denoted above.

Step 3: Install 'psycopg2' (requires command line)

  1. SSH into your QNAP.
  2. Execute /sbin/getcfg "QColdsweat" "Install_Path" -f "/etc/config/qpkg.conf".
    • This will output the folder where QColdsweat has been installed.
  3. Navigate to the parent folder of the folder returned in step 2.
  4. From there, navigate to the sub-folder where PostgreSQL has been installed.
    • Should be something like ./PostgreSQL96.
  5. Execute:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(pwd)/lib"
export PATH="$PATH:$(pwd)/bin"
pip install psycopg2

Step 4: Setup the database

WORK UNDER PROGRESS:
I haven't succeeded in getting through yet, feel free to try yourself :). Guide: https://www.postgresql.org/docs/9.6/static/server-start.html

Eventually, we'll have to change Coldsweat's config, like this.