Browse Source

publish postgres port as remote access is needed for grocery_transactions.py/sh

Pi 2 weeks ago
parent
commit
5064eb5c2a
2 changed files with 4 additions and 1 deletions
  1. 2 0
      docker-compose.yml
  2. 2 1
      run.sh

+ 2 - 0
docker-compose.yml

@@ -21,6 +21,8 @@ services:
       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
       TZ: Pacific/Auckland
       PGTZ: Pacific/Auckland
+    ports:
+      - "192.168.0.20:5432:5432"
     expose:
       - 5432
     shm_size: 128mb

+ 2 - 1
run.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 
 mkdir data
-pg_dump -d grocery -Ft -f- > dump
+pg_dump -d grocery -Ft -f dump
 podman-compose -p grocery up -d
 podman exec -i grocery_db_1 psql -U postgres -b < <( cat <<EOF
 --CREATE DATABASE grocery;
@@ -13,6 +13,7 @@ ALTER ROLE grocery_ro LOGIN;
 EOF
 )
 podman exec -i  grocery_db_1 pg_restore -U postgres -Ce --dbname postgres  < dump
+# need to delete the line: host all all all scram-sha-256
 podman exec -i grocery_db_1 bash -c 'cat >> /var/lib/postgresql/data/pg_hba.conf' <<EOF
 host    grocery         grocery_ro      ::1/128                 trust
 host    grocery         grocery_ro      127.0.0.1/32            trust