Skip to content

Commit

Permalink
Merge pull request #15 from renatocaval/docker-compose
Browse files Browse the repository at this point in the history
Adds docker-compose file for local development
  • Loading branch information
ignasi35 authored Mar 19, 2019
2 parents e5efe40 + 05b84f2 commit e4ddb31
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ The inventory service consumes a stream of events published to Kafka by the shop

## Setup

You will need to install PostgreSQL. In development, the application expects it to be running on localhost on the default port (5432), and it expects there to be a database called `shopping_cart`, with a user called `shopping_cart` with password `shopping_cart` that has full access to it. This can be created using the following SQL:
To run this application locally you will need access to a Postgres database. We suggest you run it on a docker container but a local or remote native instance will also work.

We provide a `docker-compose.yml` file that you can use to run a Postgres database already configured for this application. The docker container will be exposed on port 5432.

To create the image and start the container, run the command bellow at the root of this project.

```bash
docker-compose up -d
```

If you prefer to run Postgres on natively your machine, you need to create the database, the user and password yourself. The application expects it to be running on localhost on the default port (5432), and it expects there to be a database called `shopping_cart`, with a user called `shopping_cart` with password `shopping_cart` that has full access to it. This can be created using the following SQL:

```sql
CREATE DATABASE shopping_cart;
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
postgres:
image: postgres:latest
container_name: shopping_cart_postgres
environment:
- "TZ=Europe/Amsterdam"
- "POSTGRES_USER=shopping_cart"
- "POSTGRES_PASSWORD=shopping_cart"
ports:
- "5432:5432" # credentials (shopping_cart:shopping_cart)

0 comments on commit e4ddb31

Please sign in to comment.