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

Added dockerized postgres #6

wants to merge 3 commits into
base: master
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -30,6 +30,7 @@ dist

# Temp dir
@@ -4,11 +4,15 @@ This is a minimal example of using the [Warthog](

## Setup

To get things set up, run `yarn bootstrap`.
To get things set up,

1. Start PostgreSQL. You can BYO or we've provided a dockerized PostgreSQL, which can be run with `yarn postgres:start`
2. Install dependencies with `yarn bootstrap`

## Running the server

Run `yarn start` to run the server.
1. Start the PostgreSQL instance you created during setup
2. Run `yarn start` to run the server

## Using GraphQL Playground

@@ -8,7 +8,7 @@
"url": ""
"scripts": {
"bootstrap": "cp .env.example .env && yarn && yarn db:create && yarn db:seed:dev",
"bootstrap": "cp .env.example .env && yarn && yarn db:create && NODE_ENV=development yarn db:seed:dev",
"db:create": "createdbjs $(dotenv -p TYPEORM_DATABASE) 2>&1 || :",
"db:drop": "dropdbjs $(dotenv -p TYPEORM_DATABASE) 2>&1 || :",
"db:seed:dev": "ts-node tools/seed.ts",
@@ -19,7 +19,9 @@
"start": "DEBUG=warthog* yarn start:ts",
"start:ts": "ts-node-dev --type-check src/index.ts",
"test": "jest --detectOpenHandles --verbose --coverage",
"watch:ts": "nodemon -e ts,graphql -x ts-node --type-check src/index.ts"
"watch:ts": "nodemon -e ts,graphql -x ts-node --type-check src/index.ts",
"postgres:start": "cd postgres && docker-compose up",
"postgres:clean": "docker stop $(docker ps -a -q); docker rm $(docker ps -a -q); docker volume prune -f"
"husky": {
"hooks": {
No changes.
@@ -0,0 +1,17 @@
version: '3.6'

This comment has been minimized.

Copy link

goldcaddy77 Apr 22, 2019


Can we just name the folder db and mount the data in the root... or are you concerned that then this file would then get mounted as well? If so, what about the folder names db and data so that the directory structure is db/data?

This comment has been minimized.

Copy link

bdombro Apr 22, 2019


Yeah you could, but I like to keep the data separate from source files (i.e. the docker-compose file) for the sake of self-documentation. Also, in the future I would add a README and possibly other assets in the postgres folder, like possibly a seed file. Your call though.

image: postgres
restart: always
- ./db_data:/var/lib/postgresql/data
- 5432:5432
# To set password, use, etc. Default is u/p/db: postgres/none/postgres
# POSTGRES_DB: warthog-example
# POSTGRES_PASSWORD: testpassword
# POSTGRES_USER: postgres

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.