From e4b02be7a2d4869f66e71108b3028292346b9183 Mon Sep 17 00:00:00 2001 From: GuesWhoAmI Date: Thu, 31 Oct 2019 11:06:25 +0800 Subject: [PATCH 1/2] update docker-compose.yml and readme --- .env.example | 6 +++--- docker-compose.yml | 4 ++-- readme.md | 29 ++++++++++++++++------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.env.example b/.env.example index 2d2ea86f..6708d456 100755 --- a/.env.example +++ b/.env.example @@ -7,11 +7,11 @@ APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql -DB_HOST=127.0.0.1 +DB_HOST=db DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root -DB_PASSWORD= +DB_PASSWORD=123456 BROADCAST_DRIVER=log CACHE_DRIVER=file @@ -49,4 +49,4 @@ DEFAULT_INVITE_FORCE=0 DEFAULT_INVITE_COMMISSION=10 DEFAULT_INVITE_GEN_LIMIT=5 DEFAULT_STOP_REGISTER=0 -DEFAULT_EMAIL_VERIFY=0 \ No newline at end of file +DEFAULT_EMAIL_VERIFY=0 diff --git a/docker-compose.yml b/docker-compose.yml index 68ff5987..b7097945 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,10 +2,10 @@ version: '3' services: db: - container_name: v2board-db image: mysql + command: --default-authentication-plugin=mysql_native_password environment: - - MYSQL_ALLOW_EMPTY_PASSWORD=true + - MYSQL_ROOT_PASSWORD=123456 volumes: - ./docker/mysql:/var/lib/mysql - ./install.sql:/install.sql diff --git a/readme.md b/readme.md index e42b4e55..12cea965 100755 --- a/readme.md +++ b/readme.md @@ -1,36 +1,39 @@ -## Environment: +## 依赖环境: - PHP7.3+ - composer - MySQL5.5+ -## Steps +---- -### Before - -执行 `cp .env.example .env` 然后配置它; - -### 本地环境部署 +## 本地环境部署 1. 下载 composer > ```shell script > wget https://getcomposer.org/download/1.9.0/composer.phar > php composer.phar install > ``` -2. 初始化项目 +2. 从 `install.sql` 文件中恢复表 +3. 执行 `cp .env.example .env` 然后配置它 +4. 执行配置脚本 > ```shell script > sh init.sh > ``` > -3. 从 `install.sql` 文件中恢复表 +--- -### Docker 环境部署 -1. 初始化项目 +## Docker 环境部署 +1. 执行 `docker-compose run --rm db` 进入 docker 容器 +2. 从 `install.sql` 文件中恢复表后退出容器,执行 `docker-compose down` +3. 执行 `cp .env.example .env` 然后配置它 +4. 执行配置脚本 > ```shell script > docker run --rm -v $(pwd):/app composer install > docker run --rm -v $(pwd):/app composer sh init.sh > ``` -2. 进入 docker 容器从 `install.sql` 文件中恢复表 -3. 执行 `docker-compose up -d` 启动服务 +4. 执行 `docker-compose up -d` 启动服务 + +## 注意 +每次修改 `.env` 文件后需要执行 `docker run --rm -v $(pwd):/app composer sh init.sh` From d30faa5a601cd2d526228a95967be557c67c5da2 Mon Sep 17 00:00:00 2001 From: GuesWhoAmI Date: Thu, 31 Oct 2019 14:45:53 +0800 Subject: [PATCH 2/2] update --- .gitignore | 1 + docker-compose.yml => docker-compose.yml.example | 0 readme.md | 1 + 3 files changed, 2 insertions(+) rename docker-compose.yml => docker-compose.yml.example (100%) diff --git a/.gitignore b/.gitignore index a8ab7ee1..bff6a20d 100755 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ npm-debug.log yarn-error.log composer.phar yarn.lock +docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml.example similarity index 100% rename from docker-compose.yml rename to docker-compose.yml.example diff --git a/readme.md b/readme.md index 12cea965..d8820a6a 100755 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ --- ## Docker 环境部署 +> 首先 `cp docker-compose.yml.example docker-compose.yml` 选择性修改 1. 执行 `docker-compose run --rm db` 进入 docker 容器 2. 从 `install.sql` 文件中恢复表后退出容器,执行 `docker-compose down` 3. 执行 `cp .env.example .env` 然后配置它