From 2d203dad1bb9a775267aa6d85721ee7232795d82 Mon Sep 17 00:00:00 2001 From: David Okun Date: Thu, 26 Mar 2020 19:46:55 -0500 Subject: [PATCH] organized script files, updated README.md --- README.md | 11 ++++++++++- resetDB.sh => bin/resetDB.sh | 1 + setupDB.sh => bin/setupDB.sh | 1 + setupTestDB.sh => bin/setupTestDB.sh | 1 + bin/stopDB.sh | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) rename resetDB.sh => bin/resetDB.sh (84%) rename setupDB.sh => bin/setupDB.sh (92%) rename setupTestDB.sh => bin/setupTestDB.sh (92%) create mode 100755 bin/stopDB.sh diff --git a/README.md b/README.md index 94b7b79..592eb6f 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,17 @@ To try out (you will need Docker installed): ```bash git clone https://github.com/brokenhandsio/SteamPressExample.git cd SteamPressExample -./setupDB.sh +./bin/setupDB.sh swift run ``` This will create a site at http://localhost:8080. The blog can be found at http://localhost:8080/blog/ and you can login at http://localhost:8080/blog/admin/. The first time you visit the login a user will be created and the details printed to the console. + +**Note**: If you receive an error such as "Thread 1: Fatal error: Error raised at top level...", then it is likely you are already running an instance of PostgreSQL on your machine. To try and resolve: + +``` +./bin/stopDB.sh # will stop your existing docker instance if running +lsof -i :5432 # will show you existing processes running postgres +brew services stop postgresql # will stop postgresql if homebrew is running it +./bin/setupDB.sh # restarts db for this example +``` diff --git a/resetDB.sh b/bin/resetDB.sh similarity index 84% rename from resetDB.sh rename to bin/resetDB.sh index dc2c0ea..0d443a4 100755 --- a/resetDB.sh +++ b/bin/resetDB.sh @@ -1 +1,2 @@ +#!/bin/bash docker stop steampress && docker rm steampress && sh setupDB.sh diff --git a/setupDB.sh b/bin/setupDB.sh similarity index 92% rename from setupDB.sh rename to bin/setupDB.sh index 67ce83c..c4f4ece 100755 --- a/setupDB.sh +++ b/bin/setupDB.sh @@ -1 +1,2 @@ +#!/bin/bash docker run --name steampress -e POSTGRES_DB=steampress -e POSTGRES_USER=steampress -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres diff --git a/setupTestDB.sh b/bin/setupTestDB.sh similarity index 92% rename from setupTestDB.sh rename to bin/setupTestDB.sh index 341133f..7e72681 100755 --- a/setupTestDB.sh +++ b/bin/setupTestDB.sh @@ -1 +1,2 @@ +#!/bin/bash docker run --name steampress-test -e POSTGRES_DB=steampress-test -e POSTGRES_USER=steampress -e POSTGRES_PASSWORD=password -p 5433:5432 -d postgres diff --git a/bin/stopDB.sh b/bin/stopDB.sh new file mode 100755 index 0000000..b8fca5b --- /dev/null +++ b/bin/stopDB.sh @@ -0,0 +1,3 @@ +#!/bin/bash +containerID=$(docker ps -q -f "name=steampress") +docker rm -f $containerID \ No newline at end of file