From fb801836f764036b81d61d4e91d52abcec9cdd0e Mon Sep 17 00:00:00 2001 From: georgolden Date: Wed, 25 May 2022 17:59:26 +0200 Subject: [PATCH 1/2] Improve README and db installation --- README.md | 14 ++++++++++++++ db/setup.sh | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a627c18..a9ebe7e 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,20 @@ let's start with - Ask questions in https://t.me/nodeua and post issues on [github](https://github.com/HowProgrammingWorks/NodejsStarterKit/issues) +## Quick installation + +- Run docker command for postgres + +```sh + docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d postgres +``` + +- Run to prepare database + +```sh + cd ./db && sh setup.sh && cd .. +``` + ## License Copyright (c) 2020-2022 Metarhia contributors. diff --git a/db/setup.sh b/db/setup.sh index 5e36c2b..eade713 100755 --- a/db/setup.sh +++ b/db/setup.sh @@ -1,3 +1,3 @@ -psql -f install.sql -U postgres -PGPASSWORD=marcus psql -d application -f structure.sql -U marcus -PGPASSWORD=marcus psql -d application -f data.sql -U marcus +PGPASSWORD=postgres psql -h 127.0.0.1 -f install.sql -U postgres +PGPASSWORD=marcus psql -h 127.0.0.1 -d application -f structure.sql -U marcus +PGPASSWORD=marcus psql -h 127.0.0.1 -d application -f data.sql -U marcus From 3e52c5a7657c9c76a3f55b1e9ab460fab62ca3e5 Mon Sep 17 00:00:00 2001 From: georgolden Date: Wed, 25 May 2022 18:13:41 +0200 Subject: [PATCH 2/2] Use only docker for pg initialization --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a9ebe7e..7c9b463 100644 --- a/README.md +++ b/README.md @@ -63,18 +63,22 @@ let's start with - Ask questions in https://t.me/nodeua and post issues on [github](https://github.com/HowProgrammingWorks/NodejsStarterKit/issues) -## Quick installation +## Quick installation with docker - Run docker command for postgres ```sh - docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d postgres + docker run --name pg_test -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d postgres ``` - Run to prepare database ```sh - cd ./db && sh setup.sh && cd .. + docker cp ./db/install.sql pg_test:/install.sql + docker cp ./db/data.sql pg_test:/data.sql + docker cp ./db/structure.sql pg_test:/structure.sql + docker cp ./db/setup.sh pg_test:/setup.sh + docker exec -it pg_test sh setup.sh ``` ## License