Skip to content

Commit 4b47533

Browse files
authored
Merge pull request #31 from Human-Connection/28-connect-backend-frontend
Create new Docker network coc_network and let Docker services join
2 parents ca45054 + 6fbde52 commit 4b47533

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ To run the Docker version, follow these steps:
107107
and open the directory in the console. Then run `git clone https://github.com/Human-Connection/Clock-of-Change-API.git` to clone the repository to this directory.
108108
2. Go to the newly created Clock-of-Change-API directory (`cd Clock-of-Change-API` in the console)
109109
3. Run `docker-compose up`. This will build the Docker container on first startup and run it. This can take a while, but after some time you should see the Clock of Change ticking.
110-
4. To create an initial API key and sample entries, run `docker-compose exec db seed.sh`. The initial API key you can use with your requests will have the value `secret`.
110+
4. To create an initial API key and sample entries, run `docker-compose exec db_api seed.sh`. The initial API key you can use with your requests will have the value `secret`.
111111

112112
Now the Clock of Change API server is ready for usage at [http://127.0.0.1:1337](http://127.0.0.1:1337)
113113

docker-compose.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
version: '3'
1+
version: '3.5'
22

33
services:
4-
db:
4+
db_api:
55
image: mysql:5
66
volumes:
77
- coc_api_dbdata:/var/lib/mysql
88
- ./seed.sh:/usr/local/bin/seed.sh
9+
ports:
10+
- 3306:3306
11+
networks:
12+
- coc_network
913
environment:
1014
MYSQL_ROOT_PASSWORD: clockofchangepw
1115
MYSQL_DATABASE: clock_of_change
1216
MYSQL_USER: coc
1317
MYSQL_PASSWORD: 123456
14-
ports:
15-
- 3306:3306
1618
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
1719

1820
mailhog:
@@ -21,6 +23,8 @@ services:
2123
ports:
2224
- 1025:1025
2325
- 8025:8025
26+
networks:
27+
- coc_network
2428

2529
coc-api:
2630
image: clock-of-change-api
@@ -31,8 +35,10 @@ services:
3135
- /home/node/coc-api/node_modules
3236
ports:
3337
- 1337:1337
38+
networks:
39+
- coc_network
3440
environment:
35-
- MYSQL_HOST=db
41+
- MYSQL_HOST=db_api
3642
- MYSQL_DB=clock_of_change
3743
- MYSQL_USER=coc
3844
- MYSQL_PASS=123456
@@ -41,9 +47,13 @@ services:
4147
- MAIL_USER=mailer
4248
- MAIL_PASS=123456
4349
depends_on:
44-
- db
50+
- db_api
4551
- mailhog
46-
command: bash -c "wait-on tcp:db:3306 && db-migrate up && npm run start"
52+
command: bash -c "wait-on tcp:db_api:3306 && db-migrate up && npm run start"
4753

4854
volumes:
4955
coc_api_dbdata:
56+
57+
networks:
58+
coc_network:
59+
name: coc_network

0 commit comments

Comments
 (0)