Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify with docker-compose. Run everything in one command
- Loading branch information
FUNNYDMAN
committed
Nov 23, 2019
1 parent
5f9ba34
commit de4d79c
Showing
11 changed files
with
57 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dbdata | ||
|
||
.idea/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
# Northwind database for Postgres | ||
|
||
A simple sql script that will populate a database with the famous northwind example, | ||
adapted for postgres. | ||
|
||
<img src=ER.png /> | ||
|
||
## Getting started: | ||
|
||
#### Pre-requirement: install docker and docker-compose | ||
|
||
https://www.docker.com/get-started | ||
|
||
https://docs.docker.com/compose/install/ | ||
|
||
|
||
####1. run docker-compose | ||
|
||
```bash | ||
docker-compose up | ||
``` | ||
|
||
####2. run psql client in the docker-compose container | ||
|
||
````bash | ||
> docker-compose exec db psql -U northwind_user -d northwind | ||
psql (10.5 (Debian 10.5-1.pgdg90+1)) | ||
Type "help" for help. | ||
|
||
postgres=# select * from us_states; | ||
state_id | state_name | state_abbr | state_region | ||
----------+----------------------+------------+-------------- | ||
1 | Alabama | AL | south | ||
2 | Alaska | AK | north | ||
... | ||
```` | ||
|
||
####3. stop docker-compose | ||
```bash | ||
docker-compose down | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
version: '3' | ||
|
||
services: | ||
db: | ||
image: postgres:12 | ||
environment: | ||
POSTGRES_DB: northwind | ||
POSTGRES_USER: northwind_user | ||
POSTGRES_PASSWORD: thewindisblowing | ||
volumes: | ||
- ./dbdata:/var/lib/postgresql/data | ||
- ./northwind.sql:/docker-entrypoint-initdb.d/northwind.sql |