From d310b695c4466fdd84891f4af0f3ab64d0ab3a51 Mon Sep 17 00:00:00 2001 From: markliu2013 Date: Thu, 10 Aug 2023 21:08:40 +0800 Subject: [PATCH] save --- README.md | 10 +++--- docker-compose-ali-no-mysql.yml | 24 ++++++++++++++ docker-compose-ali.yml | 56 +++++++++++++++++++++++++++++++++ docker-compose-hub-no-mysql.yml | 24 ++++++++++++++ docker-compose-no-mysql.yml | 6 ++-- docker-compose.yml | 18 +++++++---- notes.txt | 3 +- 7 files changed, 125 insertions(+), 16 deletions(-) create mode 100644 docker-compose-ali-no-mysql.yml create mode 100644 docker-compose-ali.yml create mode 100644 docker-compose-hub-no-mysql.yml diff --git a/README.md b/README.md index 2281002..523bf5c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ 请确保本机已安装docker compose。如遇到任何问题欢迎加入 QQ群: 639653091 讨论。 -启动前请修改docker-compose.yml数据的默认root密码,MYSQL_ROOT_PASSWORD修改为自己的密码。 +启动前请修改docker-compose.yml数据的默认root密码,MYSQL_ROOT_PASSWORD修改为自己的密码,同时修改api.env文件。 + +为防止恶意注册,请修改api.env中的邀请码。如遇端口冲突问题,请修改docker-compose.yml文件修改对应的端口。 ```sh $ git clone --depth 1 https://github.com/getmoneynote/docker-compose-moneywhere.git @@ -28,11 +30,7 @@ 如需备份数据,请访问 [http://127.0.0.1:8085](http://127.0.0.1:8085) 打开phpMyAdmin操作,数据库是MySQL5.7。 -phpMyAdmin登录的信息请对照api.env配置文件填写。 - -请定期使用打开phpMyAdmin导出sql文件,备份你的记账数据!!!!!!!! - -邀请码可以在api.env文件修改 invite_code 变量,如遇端口冲突问题,请修改docker-compose.yml文件修改对应的端口。 +phpMyAdmin登录的信息请对照api.env配置文件填写。请定期使用phpMyAdmin导出sql文件,备份你的记账数据!!!!!!!! ## QA 1. 很多人安装遇到数据库的问题,有可能是之前安装过,有数据文件,且自己修改过root密码。 使用 docker volume ls 命令查看有没有moneywhere_mysql_data文件,如果有,可以自己修改为另外的数据文件,或者删除moneywhere_mysql_data diff --git a/docker-compose-ali-no-mysql.yml b/docker-compose-ali-no-mysql.yml new file mode 100644 index 0000000..41c2d66 --- /dev/null +++ b/docker-compose-ali-no-mysql.yml @@ -0,0 +1,24 @@ +version: '3.0' + +services: + moneywhere-api-user: + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest + env_file: api.env + + moneywhere-fe-user: + links: + - moneywhere-api-user + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9097:80" + + moneywhere-fe-user-mobile: + links: + - moneywhere-api-user + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9098:80" \ No newline at end of file diff --git a/docker-compose-ali.yml b/docker-compose-ali.yml new file mode 100644 index 0000000..afe2627 --- /dev/null +++ b/docker-compose-ali.yml @@ -0,0 +1,56 @@ +version: '3' + +services: + mysql: + build: ./mysql/ + command: --init-file /data/1.sql + restart: always + environment: + MYSQL_ROOT_PASSWORD: NWPkVrO2 + MYSQL_DATABASE: moneywhere + volumes: + - moneywhere_mysql_data:/var/lib/mysql + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -pNWPkVrO2 | grep 'mysqld is alive' || exit 1"] + timeout: 20s + retries: 10 + + phpmyadmin: + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/phpmyadmin:latest + links: + - mysql + environment: + PMA_HOST: mysql + PMA_PORT: 3306 + PMA_ARBITRARY: 1 + restart: always + ports: + - "8085:80" + + moneywhere-api-user: + depends_on: + mysql: + condition: service_healthy + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest + env_file: api.env + + moneywhere-fe-user: + links: + - moneywhere-api-user + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9097:80" + + moneywhere-fe-user-mobile: + links: + - moneywhere-api-user + image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9098:80" + +volumes: + moneywhere_mysql_data: \ No newline at end of file diff --git a/docker-compose-hub-no-mysql.yml b/docker-compose-hub-no-mysql.yml new file mode 100644 index 0000000..79b296f --- /dev/null +++ b/docker-compose-hub-no-mysql.yml @@ -0,0 +1,24 @@ +version: '3.0' + +services: + moneywhere-api-user: + image: markliu2018/moneywhere-api-user:latest + env_file: api.env + + moneywhere-fe-user: + links: + - moneywhere-api-user + image: markliu2018/moneywhere-fe-user:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9097:80" + + moneywhere-fe-user-mobile: + links: + - moneywhere-api-user + image: markliu2018/moneywhere-fe-user-mobile:latest + environment: + USER_API_HOST: http://moneywhere-api-user:9092 + ports: + - "9098:80" \ No newline at end of file diff --git a/docker-compose-no-mysql.yml b/docker-compose-no-mysql.yml index 41c2d66..79b296f 100644 --- a/docker-compose-no-mysql.yml +++ b/docker-compose-no-mysql.yml @@ -2,13 +2,13 @@ version: '3.0' services: moneywhere-api-user: - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest + image: markliu2018/moneywhere-api-user:latest env_file: api.env moneywhere-fe-user: links: - moneywhere-api-user - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest + image: markliu2018/moneywhere-fe-user:latest environment: USER_API_HOST: http://moneywhere-api-user:9092 ports: @@ -17,7 +17,7 @@ services: moneywhere-fe-user-mobile: links: - moneywhere-api-user - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest + image: markliu2018/moneywhere-fe-user-mobile:latest environment: USER_API_HOST: http://moneywhere-api-user:9092 ports: diff --git a/docker-compose.yml b/docker-compose.yml index afe2627..7bdc420 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,21 +2,27 @@ version: '3' services: mysql: - build: ./mysql/ - command: --init-file /data/1.sql + image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD: NWPkVrO2 MYSQL_DATABASE: moneywhere + command: [ + '--character-set-server=utf8mb4', + '--collation-server=utf8mb4_general_ci', + '--max_connections=10000' + ] volumes: - moneywhere_mysql_data:/var/lib/mysql healthcheck: + # test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -pNWPkVrO2 | grep 'mysqld is alive' || exit 1"] + # test: ["CMD-SHELL", "mysqladmin ping | grep 'Access denied' || exit 1"] timeout: 20s retries: 10 phpmyadmin: - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/phpmyadmin:latest + image: phpmyadmin/phpmyadmin links: - mysql environment: @@ -31,13 +37,13 @@ services: depends_on: mysql: condition: service_healthy - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest + image: markliu2018/moneywhere-api-user:latest env_file: api.env moneywhere-fe-user: links: - moneywhere-api-user - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest + image: markliu2018/moneywhere-fe-user:latest environment: USER_API_HOST: http://moneywhere-api-user:9092 ports: @@ -46,7 +52,7 @@ services: moneywhere-fe-user-mobile: links: - moneywhere-api-user - image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest + image: markliu2018/moneywhere-fe-user-mobile:latest environment: USER_API_HOST: http://moneywhere-api-user:9092 ports: diff --git a/notes.txt b/notes.txt index 3400a10..b27e7e4 100644 --- a/notes.txt +++ b/notes.txt @@ -1 +1,2 @@ -docker-compose -f docker-compose-hub.yml up -d \ No newline at end of file +docker-compose -f docker-compose-hub.yml up -d +docker-compose -f docker-compose-no-mysql.yml up -d