From 84ef4db188b1988227feba832e5779587de42a48 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Tue, 6 Feb 2018 21:20:00 +0000 Subject: Filled in some of the first method stubs, added serverconfig.ts, and added script to install postgres on lab machine for doing db stuff --- getmepostgres.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 getmepostgres.sh (limited to 'getmepostgres.sh') diff --git a/getmepostgres.sh b/getmepostgres.sh new file mode 100755 index 0000000..05db59d --- /dev/null +++ b/getmepostgres.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +echo "> Checking for postgres at ~/pg"; +if [ -d "~/pg" ]; then + echo "Postgres Directory exists, nevermind..."; + exit 1; +fi + +echo "> Making postgres directory at ~/pg"; +mkdir ~/pg; +currentDir=$(pwd); + +echo "> Chaning dir to ~/pg"; +cd ~/pg; + +echo "> Cloning Repo"; +git clone https://github.com/postgres/postgres.git; + +echo "> Checking out to version 10"; +cd ./postgres; +git reset --hard REL_10_0; + +echo "> Configuring"; +sleep 2; +./configure --prefix=$HOME/pg/postgres/ --with-python PYTHON=/usr/bin/python2.7; + + +read -p "Press [Enter] key to Build Postgres..."; +echo "> Building Postgres"; +make -j 5; + +read -p "Press [Enter] key to Install Postgres..."; +echo "> Installing Postgres"; +make install; + +echo "> Creating the Database"; +~/pg/postgres/bin/initdb -D ~/pg/postgres/data/; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "> Completed the installation of Postgres. Please use `./runmepostgres.sh` to run."; +cd $currentDir; -- cgit v1.2.1 From d66a0d90a658d5094ba274c4b4c4c3d66d8254a3 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Wed, 7 Feb 2018 03:09:50 +0000 Subject: Streamlined script for adding postgres, and added packages in preparation for writing ORM --- getmepostgres.sh | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'getmepostgres.sh') diff --git a/getmepostgres.sh b/getmepostgres.sh index 05db59d..50976f8 100755 --- a/getmepostgres.sh +++ b/getmepostgres.sh @@ -6,6 +6,15 @@ if [ -d "~/pg" ]; then exit 1; fi +echo " "; +echo " "; +echo " "; +echo "This installation process takes ~3:50 minutes to complete."; +echo " "; +echo " "; +echo " "; +sleep 3; + echo "> Making postgres directory at ~/pg"; mkdir ~/pg; currentDir=$(pwd); @@ -16,30 +25,39 @@ cd ~/pg; echo "> Cloning Repo"; git clone https://github.com/postgres/postgres.git; -echo "> Checking out to version 10"; +echo "> Checking out to version 10.1"; cd ./postgres; -git reset --hard REL_10_0; +git reset --hard REL_10_1; echo "> Configuring"; -sleep 2; ./configure --prefix=$HOME/pg/postgres/ --with-python PYTHON=/usr/bin/python2.7; - -read -p "Press [Enter] key to Build Postgres..."; echo "> Building Postgres"; make -j 5; -read -p "Press [Enter] key to Install Postgres..."; echo "> Installing Postgres"; make install; -echo "> Creating the Database"; +echo "> Initialise the Database"; ~/pg/postgres/bin/initdb -D ~/pg/postgres/data/; - -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "> Completed the installation of Postgres. Please use `./runmepostgres.sh` to run."; +echo " "; +echo " "; +echo " "; +echo " "; +echo "> Starting the postgres server"; +~/pg/postgres/bin/pg_ctl -D ~/pg/postgres/data/ -l POSTGRES_logfile start; +echo "> Create the Database"; +~/pg/postgres/bin/createdb be4; +echo "> Creating Admin user"; +~/pg/postgres/bin/psql -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';"; +echo "> Granting Admin Permissions"; +~/pg/postgres/bin/psql -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;"; + + +echo " "; +echo " "; +echo " "; +echo " "; +echo " "; +echo "> Completed the installation of Postgres."; cd $currentDir; -- cgit v1.2.1 From 1bd45e04ea49d198a85a78eeac7ab6ce67db1ccf Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Wed, 7 Feb 2018 18:08:13 +0000 Subject: started working on ORM for DB --- getmepostgres.sh | 59 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'getmepostgres.sh') diff --git a/getmepostgres.sh b/getmepostgres.sh index 50976f8..cb0388a 100755 --- a/getmepostgres.sh +++ b/getmepostgres.sh @@ -1,26 +1,27 @@ #!/bin/bash -echo "> Checking for postgres at ~/pg"; -if [ -d "~/pg" ]; then +PGDIR=${1-"$HOME/pg"} + +echo "> Checking for postgres at $PGDIR"; +if [ -d "$PGDIR" ]; then echo "Postgres Directory exists, nevermind..."; exit 1; fi -echo " "; -echo " "; -echo " "; +echo; +echo; +echo; echo "This installation process takes ~3:50 minutes to complete."; -echo " "; -echo " "; -echo " "; -sleep 3; +echo; +echo; +echo; -echo "> Making postgres directory at ~/pg"; -mkdir ~/pg; +echo "> Making postgres directory at $PGDIR"; +mkdir -p "$PGDIR"; currentDir=$(pwd); -echo "> Chaning dir to ~/pg"; -cd ~/pg; +echo "> Changing dir to $PGDIR"; +cd "$PGDIR"; echo "> Cloning Repo"; git clone https://github.com/postgres/postgres.git; @@ -30,34 +31,34 @@ cd ./postgres; git reset --hard REL_10_1; echo "> Configuring"; -./configure --prefix=$HOME/pg/postgres/ --with-python PYTHON=/usr/bin/python2.7; +./configure --prefix="$PWD" --with-python PYTHON="/usr/bin/python2.7"; echo "> Building Postgres"; -make -j 5; +make; echo "> Installing Postgres"; make install; echo "> Initialise the Database"; -~/pg/postgres/bin/initdb -D ~/pg/postgres/data/; -echo " "; -echo " "; -echo " "; -echo " "; +"$PGDIR/postgres/bin/initdb" -D "$PGDIR/postgres/data/"; +echo; +echo; +echo; +echo; echo "> Starting the postgres server"; -~/pg/postgres/bin/pg_ctl -D ~/pg/postgres/data/ -l POSTGRES_logfile start; +"$PGDIR/postgres/bin/pg_ctl" -D "$PGDIR/postgres/data/" -l POSTGRES_logfile start; echo "> Create the Database"; -~/pg/postgres/bin/createdb be4; +"$PGDIR/postgres/bin/createdb" be4; echo "> Creating Admin user"; -~/pg/postgres/bin/psql -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';"; +"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';"; echo "> Granting Admin Permissions"; -~/pg/postgres/bin/psql -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;"; +"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;"; -echo " "; -echo " "; -echo " "; -echo " "; -echo " "; +echo; +echo; +echo; +echo; +echo; echo "> Completed the installation of Postgres."; cd $currentDir; -- cgit v1.2.1 From 2163349b8e5c5a5eca21c5865563552365e42209 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 8 Feb 2018 17:07:31 +0000 Subject: removed postgres password --- getmepostgres.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'getmepostgres.sh') diff --git a/getmepostgres.sh b/getmepostgres.sh index cb0388a..035b300 100755 --- a/getmepostgres.sh +++ b/getmepostgres.sh @@ -50,7 +50,7 @@ echo "> Starting the postgres server"; echo "> Create the Database"; "$PGDIR/postgres/bin/createdb" be4; echo "> Creating Admin user"; -"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';"; +"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "CREATE USER admin;"; echo "> Granting Admin Permissions"; "$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;"; -- cgit v1.2.1