From 0dfd0d7ffe5f8bf6089be62b7ad50ae9078aa680 Mon Sep 17 00:00:00 2001 From: wbudic Date: Wed, 11 Aug 2021 16:56:47 +1000 Subject: [PATCH] upd. --- Installation.txt | 4 +- Installation_PostgreSQL.txt | 81 +++++++++++++++++++++++++++++++++++++ README.md | 19 ++++++--- 3 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 Installation_PostgreSQL.txt diff --git a/Installation.txt b/Installation.txt index cb1438d..3b82bbb 100644 --- a/Installation.txt +++ b/Installation.txt @@ -92,7 +92,7 @@ sudo cpan Compress::Zlib; sudo cpan IO::Compress::Gzip; sudo cpan IO::Prompter; sudo cpan IO::Interactive; -#Disabled testing for now on ProgresSQL driver +#Disabled testing for now on PostgreSQL driver sudo cpan -T DBD::Pg; @@ -103,7 +103,7 @@ sudo cpan Crypt::CBC; #Install DBI module sudo cpan DBI; sudo cpan DBD::SQLite; -#For ProgreSQL see Installation_ProgreSQL.txt before installing perl driver: +#For PostgreSQL see Installation_PostgreSQL.txt before installing perl driver: #cpan DBD::Pg; #Final Perl Installation Notes diff --git a/Installation_PostgreSQL.txt b/Installation_PostgreSQL.txt new file mode 100644 index 0000000..6b68a7c --- /dev/null +++ b/Installation_PostgreSQL.txt @@ -0,0 +1,81 @@ +# Notes + +PostgreSQL Server is a full database service solution (RDBSM). Handling interaction, like multiple enterprise schemas, databases, users and backups. +These all are and can be handled outside the scope of the LifeLog application. +However, it is not required or recommended to have a fully managed database system service, just to use for the LifeLog app. + + +Modify the following anon driver property tag in dbLifeLog/main.cnf to specify: +< + +The alias is by default assumed the actual database name as well as the user. + +Modify the following anon property, to have the SQL Server provide multiple users as different aliases for the loging into a specified single database. +< +to something like, to make logins now for the database users: +< +Where 'lifelog' is the server managed database. + +Hope all works for you, and happy logging! + + +# Install PostgreSQL +sudo mkdir /usr/include/postgresql +## Create the file repository configuration: +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + +## Import the repository signing key: +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + +## Update the package lists: +sudo apt-get update -y +sudo apt upgrade -y + +## Install the latest version of PostgreSQL. +## If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': +sudo apt-get -y install libpq-dev +sudo apt-get -y install postgresql-12 + +## Optional -> Enable port 5432 for PG server for local network on server. +sudo uwf allow 5432/tcp +sudo vim /etc/postgresql/12/main/postgresql.conf to modify--> listen_addresses = '*' +sudo vim pg_hba.conf -> +host all all 0.0.0.0/0 md5 +host all all ::/0 md5 +sudo service postgresql restart + +## Install required libpq-dev to compile test perl driver, later. +sudo apt install libpq-dev + +## Install perl driver. +sudo cpan DBD::Pg; + + +# To assign default Postgres SQL user roles. +sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" +sudo -u postgres psql -c "CREATE ROLE lifelog WITH LOGIN SUPERUSER CREATEDB CREATEROLE INHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'xxxxxxx'"; +sudo -u postgres psql -c "CREATE DATABASE lifelog;" +sudo -u postgres psql -c "grant all privileges on database lifelog to lifelog;" + +## Start stop Postgres SQL +sudo service postgresql start + +## Manually Obtain dep. if encountering lib problems. with i.e.: +wget https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/libpq-dev_12.4-1.pgdg20.04+1_amd64.deb +dpkg -i libpq-dev_12.4-1.pgdg20.04+1_amd64.deb +###Than run again driver install +sudo cpan DBD::Pg; + +# Installing pgAdmin4 +sudo apt install python3-pip +sudo python3 -m pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.30/pip/pgadmin4-4.30-py3-none-any.whl + +# Data directory location for backup +sudo -u postgres psql -c "SHOW data_directory;" | grep -G / +## Quick tar all +sudo tar czvf ~/postgresql.db.backup.tar $(sudo -u postgres psql -c "SHOW data_directory;" | grep -G /) + + + + + diff --git a/README.md b/README.md index 4cb46be..753065c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Preferably on a small inexpensive server connected to your local network. Written in Perl, easy to implement and modify. -Latest stable version is **2.1** in **SUN** stage. +Latest stable version is **2.3** in **SUN** stable stage. ## PC Requirements @@ -14,10 +14,17 @@ Latest stable version is **2.1** in **SUN** stage. * Processor 1.2+ GHZ or better, 2+ cores. * Only 2 GB+ physical. -Setup is requiring some Perl knowledge to install and enable, and tweak this application. The main application sources are located in the ../htdocs/cgi-bin directory. Current unstable, development ver. 1.6 is in the GIT branch. The development and features are stable progressive, starting from Moon, Sun and finally Earth stable stage. This application was and is usable since its Moon stage. - -https://www.sqlite.org/index.html database is required to run this web application. Note this isn't a full on blown database server requirment, that runs in your background and uses your computers resources. - +Setup is requiring some Perl knowledge to install and enable, and tweak this application. The main application sources are located in the ../htdocs/cgi-bin directory. + +### Quick Setup + * After downloading this application and installing in a directory (default is **~/dev**), which both can be done with: + * ```git clone https://github.com/wbudic/LifeLog.git``` + * Check here for further [instuctions](./Installation.txt). + * Before modifying any configuration, run the module installation and testing process. + * ```./install_modules.sh``` + * This might be necessary after even upgrades. + * Upgrades support preserving of data, and migration to any possible new data structures, automatically. + * Rolling back to an previous version even if not expected, it is not affected by any new modules you might have installed, down the track. ## What is the purpose of having this log kept? Here are some things that come to mind: @@ -68,7 +75,7 @@ Here are some things that come to mind: ## Life Log version v.2.+ -* Mulitple SQL database support ready and tested, currently ProgreSQL, LightSQL (default). +* Mulitple SQL database support ready and tested, currently PostgreSQL, LightSQL (default). * Data searches, views, updated, enhanced and upgraded. * Migration upgraded and test. * Cross version releases, automatic migration of data and structures. -- 2.34.1