From de183f8b4c9c2acb6777fb16f048c25ce6fc89e0 Mon Sep 17 00:00:00 2001 From: jakobsn Date: Thu, 3 Oct 2019 16:56:56 +0200 Subject: [PATCH] Define networking with docker-compose. Can now run docker-compose up --- docker-compose.yml | 14 +++++++++++++- mysql/sql/init.sql | 2 -- src/app/main.py | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cbc4909..b8f76bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,13 @@ version: "2" services: - db: build: context: ./mysql dockerfile: Dockerfile + networks: + backend: + ipv4_address: 10.5.0.5 app: @@ -18,4 +20,14 @@ services: ports: - "8080:8080" - "443:443" + networks: + backend: + ipv4_address: 10.5.0.6 + +networks: + backend: + driver: bridge + ipam: + config: + - subnet: 10.5.0.0/16 diff --git a/mysql/sql/init.sql b/mysql/sql/init.sql index 06c3a45..c8aa74e 100644 --- a/mysql/sql/init.sql +++ b/mysql/sql/init.sql @@ -1,5 +1,4 @@ - CREATE TABLE `db`.`users` ( `userid` INT NOT NULL, `username` VARCHAR(45) NULL, @@ -10,4 +9,3 @@ insert into users values (0, "admin", "password"); insert into users values (1, "bernt", "inge"); -GRANT ALL PRIVILEGES ON db.* TO 'root'@'%'; diff --git a/src/app/main.py b/src/app/main.py index ef0472c..4e27d60 100644 --- a/src/app/main.py +++ b/src/app/main.py @@ -9,7 +9,7 @@ urls = ( # Connect to database db = web.database( dbn="mysql", - host='172.18.0.22', + host='10.5.0.5', port=3306, user='root', pw='root',