Skip to content

Commit 6dae77b

Browse files
authored
Merge pull request #4 from stowns/infra
Add docker-compose/swarm infra file
2 parents 79db441 + 2bfcf76 commit 6dae77b

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ Environment based configuration using [Dotenv](https://www.npmjs.com/package/dot
1313

1414
Integration Testing with [SuperTest](https://github.com/visionmedia/supertest)
1515

16+
## Quickstart
17+
```
18+
npm install -g yarn
19+
yarn install
20+
# install docker https://docs.docker.com/install/
21+
docker stack deploy -c local-infra.yml infra
22+
# connect to postgres via postgres:password@localhost:5432
23+
# create 'seed' user with password 'password'
24+
# create 'seed' database and set the 'seed' user as the owner
25+
cp .env.example .env
26+
yarn run start
27+
# wait for app to start
28+
yarn global add sequelize-cli
29+
sequelize db:seed:all
30+
```
31+
1632
## Environment Setup
1733
This project uses the [Dotenv](https://www.npmjs.com/package/dotenv) library to load sensitive data such
1834
as database passwords and client secrets.
@@ -21,10 +37,10 @@ There is a `.env.example` file included at the root of this project as an exampl
2137
for your project.
2238

2339
### RabbitMQ
24-
Install and run [RabbitMQ](https://www.rabbitmq.com/) with the default settings
40+
Install and run [RabbitMQ](https://www.rabbitmq.com/) with the default settings (or use the provided local-infra.yml in conjunction with docker-compose/swarm)
2541

2642
### Database
27-
You will need a [PostgreSQL](https://www.postgresql.org) database running on localhost:5432
43+
You will need a [PostgreSQL](https://www.postgresql.org) database running on localhost:5432 (or use the provided local-infra.yml in conjunction with docker-compose/swarm)
2844

2945
The setup of PostgreSQL is beyond the scope of this guide. Please reference the [Install Guides](https://wiki.postgresql.org/wiki/Detailed_installation_guides)
3046
for help installing PostgreSQL on your machine.
@@ -43,7 +59,7 @@ You can also run the app in debug mode and attach a [Debugger](https://www.jetbr
4359
Once the app is running and the tables are created, you can seed the database with the sequelize-cli.
4460
Install the sequelize-cli by running
4561

46-
yarn install --g sequelize-cli
62+
yarn global add sequelize-cli
4763
4864
then run
4965

local-infra.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: '3.4'
2+
3+
services:
4+
5+
db:
6+
image: postgres
7+
ports:
8+
- 5432:5432
9+
environment:
10+
POSTGRES_PASSWORD: password
11+
PGDATA: /var/lib/postgresql/data/pgdata
12+
volumes:
13+
- pg-data:/var/lib/postgresql/data/pgdata
14+
15+
rabbitmq:
16+
image: rabbitmq
17+
ports:
18+
- 5672:5672
19+
- 8080:15672
20+
volumes:
21+
- rabbit-data:/var/lib/rabbitmq
22+
23+
volumes:
24+
pg-data:
25+
rabbit-data:

0 commit comments

Comments
 (0)