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