From 919d3c633d70bdfdb6b5cd40c1e8d9c68dc92d2c Mon Sep 17 00:00:00 2001 From: jakobsn Date: Tue, 31 Dec 2019 13:46:40 +0100 Subject: [PATCH] Update subnet for bridge and readme description --- .env | 2 +- README.md | 39 ++++++++++++++++++++++++++------------- docker-compose.yml | 2 +- src/Dockerfile | 2 +- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.env b/.env index 601df7e..afb3dca 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -groupid=09 +groupid=19 diff --git a/README.md b/README.md index f68f85a..ee6ce96 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ Web Server image: https://github.com/tiangolo/uwsgi-nginx-docker webpy framework: http://webpy.org/ -### Prerequisites: -docker https://www.docker.com/ +## Prerequisites: + +Docker https://www.docker.com/ On linux docker is started with @@ -17,28 +18,37 @@ To run docker-compose without sudo the user must be added to the usergroup: https://docs.docker.com/install/linux/linux-postinstall/ -### Build & Run +## Run + +$ docker-compose up + +### Build / Rebuild -$ docker-compose up --build +Upon changes in the code the docker image must be built again for the changes to take effect. Some changes might not get reflected even on build, which is when the --force-recreate attribute can be used. -### Prune/Recreate -If you need a fresh rebuild in case of startup issues use this command (WARNING this will remove all your docker images) +$ docker-compose up --build --force-recreate + +### Prune / Recreate +If you need a completely fresh rebuild (WARNING this will remove all your docker images). This will reset the images including the database which is not necessary affected by only rebuilding the images $ docker system prune -a -$ docker-compose up --build +$ docker-compose up # Deploy locally -Prerequisites: +Running the application outside of containers might be useful for development because the images does not need to be rebuilt for every change in the code. + +## Prerequisites: mysql -python3 +python 3.6.8 or higher src/app/requirements.txt -### Run Datatbase: +## Run Datatbase: + Launch mysql at default port (3306) $ systemctl start mysqld @@ -57,12 +67,15 @@ Insert mysql queries Then populate databse by posting mysql/sql/init.sql into mysql -Edit src/app/models/database.py to point at local server - +## Run app -###Run app +Edit src/app/models/database.py to point at local database server $ cd src/app/ $ python3 src/app/main.py + +# Config + +The ip and ports for the web server and database is set with the .env file using the groupid variable. diff --git a/docker-compose.yml b/docker-compose.yml index dbb74b1..890921f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,5 +31,5 @@ networks: driver: bridge ipam: config: - - subnet: 10.${groupid}.0.0/16 + - subnet: 10.${groupid}.0.0/18 diff --git a/src/Dockerfile b/src/Dockerfile index ee4071d..8b62588 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -26,4 +26,4 @@ ENTRYPOINT ["/entrypoint.sh"] RUN chmod +x ./wait-for-it.sh # Hold the webserver from launching until the database is ready with 50s timeout -CMD ["./wait-for-it.sh", "-t", "50", "-h", "10.5.0.5", "db:3306", "--", "/start.sh"] +CMD ["./wait-for-it.sh", "-t", "50", "-h", "10.${groupid}.0.5", "db:3306", "--", "/start.sh"]