Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the docker compose file with the pg 14 configuration #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions JavaScript/db/docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
start: ## start the database
start:
@docker-compose up -d db

stop: ## stop the database
stop:
@docker-compose stop db

logs: ## show logs
logs:
@docker-compose logs -f db

psql: ## run psql
psql: start
psql:
@docker-compose exec db sh -c 'psql -U $$POSTGRES_USER $$POSTGRES_DB'
33 changes: 33 additions & 0 deletions JavaScript/db/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Working with database

The script runs PostgresSQL 14 in Docker.

To run database locally use the following commands:

* it runs the database server:
```bash
make start
# or
docker-compose up -d db
```

* it stops the database server:
```bash
make stop
#or
docker-compose stop db
```

* it shows logs from the database server:
```bash
make logs
#or
docker-compose logs -f db
```

* it runs psql:
```bash
make psql
#or
docker-compose exec db sh -c 'psql -U $$POSTGRES_USER $$POSTGRES_DB'
```
15 changes: 15 additions & 0 deletions JavaScript/db/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.8'

services:
db:
image: postgres:14-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
volumes:
- ../setup.sh:/docker-entrypoint-initdb.d/setup.sh:ro
- ../install.sql:/install.sql:ro
- ../structure.sql:/structure.sql:ro
- ../data.sql:/data.sql:ro