Skip to content

Commit

Permalink
Merge pull request #212 from hashgraph/00208-D-postgres-setup-guide-md
Browse files Browse the repository at this point in the history
00208 Postgres setup guide in markdown format
  • Loading branch information
qnswirlds authored May 14, 2020
2 parents 2ddbb66 + 9ecc689 commit 856a700
Show file tree
Hide file tree
Showing 6 changed files with 728 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ on the Swirlds Platform.
## JVM
OpenJDK12 is strongly recommended.

## PostgreSQL dependency
The current implementation of Swirlds Platform has a non-negotiable dependency
on PostgreSQL. Use the included
[Docker-based PostgreSQL setup guide](docs/postgresql-setup-guide.md)
to ensure your local environment includes an appropriately configured
PostgreSQL instance.

## Solidity
Hedera Contracts support `pragma solidity <=0.5.9`.

Expand All @@ -28,14 +35,6 @@ start a local network of Hedera Services nodes using Docker Compose.

*[This section presupposes basic familiarity with IntelliJ and Maven.]*

### PostgreSQL dependency

The current implementation Swirlds Platform has a non-negotiable dependency
on PostgreSQL. Use the included
[Docker-based setup guide](docs/PostgreSQL_Setup_Guide.docx)
to ensure your local environment includes an appropriately configured
PostgreSQL instance.

### Preliminaries

First, open the top-level *pom.xml* in IntelliJ as a new project. Then
Expand Down
Binary file removed docs/PostgreSQL_Setup_Guide.docx
Binary file not shown.
Binary file added docs/authorize-drive-sharing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/enable-hyper-v-and-containers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/postgresql-setup-guide.md
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
```
Loading

0 comments on commit 856a700

Please sign in to comment.