-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from hashgraph/00208-D-postgres-setup-guide-md
00208 Postgres setup guide in markdown format
- Loading branch information
Showing
6 changed files
with
728 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# PostgreSQL Setup Guide | ||
|
||
This document describes the standard Swirlds/Hedera configuration for the PostgreSQL local development environment. | ||
|
||
## PostgreSQL Setup for Local Development | ||
### Download and Install Docker CE [Windows](https://hub.docker.com/editions/community/docker-ce-desktop-windows) or [MacOS X](https://hub.docker.com/editions/community/docker-ce-desktop-mac) | ||
1. If prompted, choose to use Linux Containers during installation. | ||
2. On Windows, you may be forced to log off after the installation completes. | ||
3. On Windows, if Hyper-V and Containers features are disabled, you will see the prompt below. Save your work, press Ok, and wait for your computer to restart. | ||
|
||
![](enable-hyper-v-and-containers.png) | ||
|
||
### Create a local folder to use with PostgreSQL | ||
``` | ||
# MacOS / Linux | ||
mkdir -p ~/Docker/Volumes/PostgreSQL/swirlds-fcfs | ||
``` | ||
|
||
### Run PostgreSQL image as a container | ||
Execute the following docker commands from the CLI: | ||
``` | ||
# MacOS / Linux | ||
docker run --name postgres -d -p 5432:5432 \ | ||
-v ~/Docker/Volumes/PostgreSQL/swirlds-fcfs:/var/lib/postgresql/data \ | ||
--env POSTGRES_PASSWORD=password --env POSTGRES_USER=swirlds \ | ||
--env POSTGRES_DB=fcfs \ | ||
--env PGDATA=/var/lib/postgresql/data/pgdata \ | ||
postgres:10.9-alpine | ||
# Windows | ||
cd “%USERPROFILE%” | ||
docker run --name postgres -d -p 5432:5432 ^ | ||
--env POSTGRES_PASSWORD=password --env POSTGRES_USER=swirlds ^ | ||
--env POSTGRES_DB=fcfs ^ | ||
--env PGDATA=/var/lib/postgresql/data/pgdata ^ | ||
postgres:10.9-alpine | ||
``` | ||
Notes: | ||
1. The version of PostgresSQL that is currently used: **postgres:10.9-alpine** | ||
2. On Windows, you may be asked to authorize the drive sharing as shown below. Press the “Share It” button to allow access. | ||
|
||
![](authorize-drive-sharing.png) | ||
|
||
### Copy the [PostgreSQL Configuration file](postgresql.conf) into the appropriate folder | ||
``` | ||
# MacOS / Linux | ||
cp docs/postgresql.conf ~/Docker/Volumes/PostgreSQL/swirlds-fcfs/pgdata | ||
``` | ||
|
||
### Control your PostgresSQL container | ||
``` | ||
# Start Postgres | ||
docker start postgres | ||
# Stop Postgres | ||
docker stop postgres | ||
# List Running Containers | ||
docker ps | ||
# List all Containers | ||
docker ps -a | ||
``` |
Oops, something went wrong.