From ee73ea714e456e4dbfe00b66691e678afe1488d1 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 9 Sep 2019 16:11:26 +1000 Subject: [PATCH] Update docs for installing with PostgreSQL - make target - documentation --- Makefile | 10 +++++++--- docs/config.rst | 21 ++++++++++++++++----- docs/start.rst | 1 + 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5d0f88babe..f16ed77041 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,14 @@ superuser: # Install pre-requisites for mysql setup mysql: - apt-get install mysql-server - apt-get install libmysqlclient-dev + apt-get install mysql-server libmysqlclient-dev pip3 install mysqlclient +# Install pre-requisites for postgresql setup +postgresql: + apt-get install postgresql postgresql-contrib libpq-dev + pip3 install psycopg2 + # Run PEP style checks against source code style: flake8 InvenTree @@ -66,4 +70,4 @@ backup: python3 InvenTree/manage.py dbbackup python3 InvenTree/manage.py mediabackup -.PHONY: clean migrate superuser install mysql style test coverage docreqs docs backup update \ No newline at end of file +.PHONY: clean migrate superuser install mysql postgresql style test coverage docreqs docs backup update \ No newline at end of file diff --git a/docs/config.rst b/docs/config.rst index 64667a9cb1..d2dc1f0cf9 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -26,11 +26,11 @@ InvenTree provides support for multiple database backends - any backend supporte Database options are specified under the *database* heading in the configuration file. Any option available in the Django documentation can be used here - it is passed through transparently to the management scripts. -**SQLITE:** +**SQLite:** By default, InvenTree uses an sqlite database file : ``inventree_db.sqlite3``. This provides a simple, portable database file that is easy to use for debug and testing purposes. -**MYSQL:** MySQL database backend is supported with the native Django implemetation. To run InvenTree with the MySQL backend, a number of extra packages need to be installed: +**MySQL:** MySQL database backend is supported with the native Django implemetation. To run InvenTree with the MySQL backend, a number of extra packages need to be installed: * mysql-server - *MySQL backend server* * libmysqlclient-dev - *Required for connecting to the MySQL database in Python* @@ -38,14 +38,25 @@ By default, InvenTree uses an sqlite database file : ``inventree_db.sqlite3``. T These requirements can be installed from the base directory with the command ``make mysql``. -It is up to the database adminstrator to create a new database to store inventree data, in addition to a username/password to access the data. +It is then up to the database adminstrator to create a new MySQL database to store inventree data, in addition to a username/password to access the data. .. important:: MySQL Collation: When creating the MySQL database, the adminstrator must ensure that the collation option is set to *utf8_unicode_520_ci* to ensure that InvenTree features function correctly. -The database options then need to be adjusted to communicate the MySQL backend. Refer to the `Django docs `_ for further information. +The database options (in the ``config.yaml`` file) then need to be adjusted to communicate the MySQL backend. Refer to the `Django docs `_ for further information. -**POSTGRESQL:** PostgreSQL database backend is supported with the native Django implementation. Note that to use this backend, the ``psycopg2`` Python library must first be installed. +**PostgreSQL:** PostgreSQL database backend is supported with the native Django implementation. Note that to use this backend, the following system packages must be installed: + +* postgresql +* postgresql-contrib +* libpq-dev +* (pip3) psycopg2 + +These requirements can be installed from the base directory with the command ``make postgresql``. + +It is then up to the database adminstrator to create a new PostgreSQL database to store inventree data, in addition to a username/password to access the data. + +The database options (in the ``config.yaml`` file) then need to be adjusted to communicate the PostgreSQL backend. Refer to the `Django docs `_ for further information. Allowed Hosts / CORS -------------------- diff --git a/docs/start.rst b/docs/start.rst index f239bde858..30ac87ad17 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -87,6 +87,7 @@ Other shorthand functions are provided for the development and testing process: * ``make superuser`` - Create a superuser account * ``make migrate`` - Perform database migrations * ``make mysql`` - Install packages required for MySQL database backend +* ``make postgresql`` - Install packages required for PostgreSQL database backend * ``make backup`` - Backup database tables and media files * ``make test`` - Run all unit tests * ``make coverage`` - Run all unit tests and generate code coverage report