Skip to content

Commit

Permalink
simplify with docker-compose. Run everything in one command
Browse files Browse the repository at this point in the history
  • Loading branch information
FUNNYDMAN committed Nov 23, 2019
1 parent 5f9ba34 commit de4d79c
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
dbdata

.idea/
2 changes: 0 additions & 2 deletions Docker/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions Docker/1_docker_run_server.sh

This file was deleted.

1 change: 0 additions & 1 deletion Docker/2_docker_psql_client.sh

This file was deleted.

3 changes: 0 additions & 3 deletions Docker/3_docker_delete_server.sh

This file was deleted.

5 changes: 0 additions & 5 deletions Docker/Dockerfile

This file was deleted.

45 changes: 0 additions & 45 deletions Docker/Readme.md

This file was deleted.

6 changes: 0 additions & 6 deletions README.MD

This file was deleted.

42 changes: 42 additions & 0 deletions README.md
@@ -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
```

12 changes: 0 additions & 12 deletions create_db.sh

This file was deleted.

12 changes: 12 additions & 0 deletions docker-compose.yml
@@ -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

0 comments on commit de4d79c

Please sign in to comment.