Skip to content

Commit

Permalink
I think I have got it
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Apr 13, 2020
1 parent 7b926c7 commit 6281863
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 10 additions & 3 deletions scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
# Pre-Requisite - build these - https://github.com/tsugiproject/docker-php.git

# docker build --tag tsugi_pg4e .

# docker run -p 8080:80 -p 3306:3306 -p 5000:5432 -e TSUGI_SERVICENAME=PG4E -e MYSQL_ROOT_PASSWORD=secret -e PSQL_ROOT_PASSWORD=secret -e MAIN_REPO=https://github.com/csev/pg4e --volume-driver=nfs -v /Users/csev/docker:/mnt/csev --name pg4e -dit tsugi_pg4e:latest

# navigate to http://localhost:8080/

# docker exec -it pg4e bash

# psql -h 127.0.0.1 -U postgres -W
# Should fail
# host: psql -h 127.0.0.1 -p 5000 -U postgres -W

# psql -h 127.0.0.1 -p 5000 -U postgres -W
# dock: psql -h 127.0.0.1 -p 5432 -U postgres -W
# dock: CREATE USER x WITH PASSWORD 'y';
# dock: CREATE DATABASE pg4e WITH OWNER x;

# navigate to http://localhost:8080/
# host: psql -h 127.0.0.1 -p 5000 -U x pg4e

# mysql -u root --host=127.0.0.1 --port=3306 -p

Expand Down
12 changes: 8 additions & 4 deletions scripts/docker/tsugi-pg4e-startup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
echo "Running MySQL Startup"

echo "Running PG4E Startup"

bash /usr/local/bin/tsugi-dev-startup.sh return

Expand All @@ -21,12 +22,15 @@ cat >> /var//www/html/tsugi/config.php << EOF
EOF

# Open things up
# Open things up all but postgres user
# https://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg-hba-conf-entry-for-host
# https://stackoverflow.com/questions/61179852/how-to-configure-postgessql-to-accept-all-incoming-connections-except-postgres
cat >> /etc/postgresql/11/main/pg_hba.conf << EOF
host all all 0.0.0.0/0 md5
host all postgres 0.0.0.0/0 reject
host all all 0.0.0.0/0 md5
EOF

# https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
rm /tmp/x
sed "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" < /etc/postgresql/11/main/postgresql.conf > /tmp/x
cp /tmp/x /etc/postgresql/11/main/postgresql.conf
Expand Down

0 comments on commit 6281863

Please sign in to comment.