浏览代码

Update subnet for bridge and readme description

https
jakobsn 6 年前
父节点
当前提交
919d3c633d
共有 4 个文件被更改,包括 29 次插入16 次删除
  1. +1
    -1
      .env
  2. +26
    -13
      README.md
  3. +1
    -1
      docker-compose.yml
  4. +1
    -1
      src/Dockerfile

+ 1
- 1
.env 查看文件

@@ -1 +1 @@
groupid=09
groupid=19

+ 26
- 13
README.md 查看文件

@@ -6,8 +6,9 @@ Web Server image: https://github.com/tiangolo/uwsgi-nginx-docker
webpy framework: http://webpy.org/ webpy framework: http://webpy.org/




### Prerequisites:
docker https://www.docker.com/
## Prerequisites:

Docker https://www.docker.com/


On linux docker is started with 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/ 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 system prune -a


$ docker-compose up --build
$ docker-compose up


# Deploy locally # 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 mysql


python3
python 3.6.8 or higher


src/app/requirements.txt src/app/requirements.txt


### Run Datatbase:
## Run Datatbase:

Launch mysql at default port (3306) Launch mysql at default port (3306)


$ systemctl start mysqld $ systemctl start mysqld
@@ -57,12 +67,15 @@ Insert mysql queries


Then populate databse by posting mysql/sql/init.sql into mysql 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/ $ cd src/app/


$ python3 src/app/main.py $ 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.

+ 1
- 1
docker-compose.yml 查看文件

@@ -31,5 +31,5 @@ networks:
driver: bridge driver: bridge
ipam: ipam:
config: config:
- subnet: 10.${groupid}.0.0/16
- subnet: 10.${groupid}.0.0/18

+ 1
- 1
src/Dockerfile 查看文件

@@ -26,4 +26,4 @@ ENTRYPOINT ["/entrypoint.sh"]
RUN chmod +x ./wait-for-it.sh RUN chmod +x ./wait-for-it.sh


# Hold the webserver from launching until the database is ready with 50s timeout # 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"]

正在加载...
取消
保存