Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Requirements

You will need a running Postgres server.

A quick web search will show you how to install one. You basically need a dedicated server running where everybody has access to. It’s also possible to host the database in the Cloud or at you web host.

Create new database

When you create a new library the software will automatically create the new database for you.

All you have to provide is the login information (user & password), the database server (server name or IP address) and the database name - how you want to call the new database (Example: das_element). The software will setup all the tables for you. Nothing that you have to do.

Optional: You can use a SSL certificate.


Setup Postgres Server - docker compose

A easy way to create a new database server is to use Docker Compose

Please make sure to install Docker and Docker Compose first.

  1. create a new folder: database_postgres

  2. create a new text file inside the folder called: docker-compose.yml

  3. add this code snipped into the file …

version: '3'

services:
  postgres:
    image: postgres:13.1
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "root" ]
      timeout: 45s
      interval: 10s
      retries: 10
    restart: always
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=password
      - APP_DB_USER=docker
      - APP_DB_PASS=docker
      - APP_DB_NAME=docker
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    ports:
      - 5432:5432

4. run this command to start the database:

docker-compose up -d

Setup Postgres Server - Linux

Installation guide for Debian:

https://linuxize.com/post/how-to-install-postgresql-on-debian-10/

Make sure to setup the postgresql.conf and pg_hba.conf correctly.

Setup Postgres Server - MacOS

It’s recommended to use Homebrew to install Postgres

https://www.sqlshack.com/setting-up-a-postgresql-database-on-mac/

brew install postgres

Setup Postgres Server - Windows

On a machine that’s accessible by everybody on the network (e.g. Virtual Machine) install the Postgres Software.

Download the installer:
https://www.postgresql.org/download/windows/

Installation Guide:
https://www.enterprisedb.com/docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/01_invoking_the_graphical_installer/

Use pgAdmin4 to view & edit your Database.
Set an master password.

Dashboard → Add New Server → input information (Host name/address, Username, Password)

Create a database user to allow access the database.

The needs to:

  • login

  • create databases

Troubleshooting

no pg_hba.conf entry for host

Edit pg_hba.conf and allow Users access the database.

File location pg_hba.conf

Windows: C:\Program Files\PostgreSQL\14\data\pg_hba.conf
MacOS: /usr/local/var/pg_hba.conf

  1. configure access to the database

    1. edit postgresql.conf
      Windows: C:\Program Files\PostgreSQL\14\data\postgresql.conf
      MacOS: /usr/local/var/postgresql.conf

    2. edit line: listen_addresses = '*'

  2. allow User access

    1. edit pg_hba.conf

    2. edit block:

# TYPE DATABASE USER CIDR-ADDRESS  METHOD
host  all  all 0.0.0.0/0 trust

  • No labels