From 853163b06f816228b8102284bfcc49d8abdb83ef Mon Sep 17 00:00:00 2001 From: markliu2013 Date: Sat, 27 Jan 2024 14:15:08 +0800 Subject: [PATCH] save --- README.md | 28 +++++++++++++--------------- api-no-mysql.env | 2 +- api.env | 6 +----- docker-compose-ali-no-mysql.yml | 8 +++++++- docker-compose-ali.yml | 16 +++++++++------- docker-compose-all-ali.yml | 4 ++-- docker-compose-all-no-mysql-ali.yml | 14 ++++++++------ docker-compose-all-no-mysql-hub.yml | 14 ++++++++------ docker-compose-hub-no-mysql.yml | 8 +++++++- docker-compose-hub.yml | 15 +++++++++------ docker-compose-no-mysql.yml | 14 ++++++++------ notes.txt | 18 +++++++++--------- 12 files changed, 82 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 31a2b94..c64448f 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,11 @@ docker run --name moneywhere -d \ ```sh docker run --name moneywhere -d \ - -e DB_HOST=host.docker.internal \ + -e DB_HOST=your_ip \ -e DB_PORT=3306 \ -e DB_NAME=moneywhere \ -e DB_USER=root \ - -e DB_PASSWORD=111111 \ + -e DB_PASSWORD=your_password \ -e invite_code=111111 \ -p 43742:9092 \ -p 43743:81 \ @@ -60,11 +60,11 @@ docker run --name moneywhere -d \ docker hub镜像启动(适合境外用户,此镜像无mysql服务,请将参数修改为自己的mysql服务。) ```sh docker run --name moneywhere -d \ - -e DB_HOST=host.docker.internal \ + -e DB_HOST=your_ip \ -e DB_PORT=3306 \ -e DB_NAME=moneywhere \ -e DB_USER=root \ - -e DB_PASSWORD=111111 \ + -e DB_PASSWORD=your_password \ -e invite_code=111111 \ -p 43742:9092 \ -p 43743:81 \ @@ -72,7 +72,7 @@ docker run --name moneywhere -d \ markliu2018/moneywhere-all-no-mysql:latest ``` -### docker compose 启动 +### docker compose 启动(推荐) 1. 请下载本项目源代码,使用git命令或直接下载源代码。 @@ -157,46 +157,44 @@ docker compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml pu docker 5 in 1 hub 启动 ```sh -docker compose -f docker-compose-all-hub.yml up -d +docker compose --env-file api.env -f docker-compose-all-hub.yml up -d ``` docker 5 in 1 hub 升级 ```sh -docker compose -f docker-compose-all-hub.yml pull && docker compose -f docker-compose-all-hub.yml up -d +docker compose -f docker-compose-all-hub.yml pull && docker compose --env-file api.env -f docker-compose-all-hub.yml up -d ``` docker 3 in 1 hub 启动 ```sh -docker compose -f docker-compose-all-no-mysql-hub.yml up -d +docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-hub.yml up -d ``` docker 3 in 1 hub 升级 ```sh -docker compose -f docker-compose-all-hub.yml pull && docker compose -f docker-compose-all-no-mysql-hub.yml up -d +docker compose -f docker-compose-all-hub.yml pull && docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-hub.yml up -d ``` - 阿里云 docker 5 in 1 启动 ```sh -docker compose -f docker-compose-all-ali.yml up -d +docker compose --env-file api.env -f docker-compose-all-ali.yml up -d ``` 阿里云 docker 5 in 1 升级 ```sh -docker compose -f docker-compose-all-ali.yml pull && docker compose -f docker-compose-all-ali.yml up -d +docker compose -f docker-compose-all-ali.yml pull && docker compose --env-file api.env -f docker-compose-all-ali.yml up -d ``` 阿里云 docker 3 in 1 启动 ```sh -docker compose -f docker-compose-all-no-mysql-ali.yml up -d +docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-ali.yml up -d ``` 阿里云 docker 3 in 1 升级 ```sh -docker compose -f docker-compose-all-ali.yml pull && docker compose -f docker-compose-all-no-mysql-ali.yml up -d +docker compose -f docker-compose-all-ali.yml pull && docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-ali.yml up -d ``` - ## QA 1. 很多人安装遇到数据库的问题,有可能是之前安装过,有数据文件,且自己修改过root密码。 使用 docker volume ls 命令查看有没有moneywhere_mysql_data文件,如果有,可以自己修改为另外的数据文件,或者删除moneywhere_mysql_data diff --git a/api-no-mysql.env b/api-no-mysql.env index b2eee69..6f305fb 100644 --- a/api-no-mysql.env +++ b/api-no-mysql.env @@ -2,5 +2,5 @@ DB_HOST=host.docker.internal DB_PORT=3306 DB_NAME=moneywhere DB_USER=root -DB_PASSWORD=111111 +DB_PASSWORD=78p7gkc1 invite_code=111111 \ No newline at end of file diff --git a/api.env b/api.env index f83761b..3ed6743 100644 --- a/api.env +++ b/api.env @@ -1,6 +1,2 @@ -DB_HOST=mysql -DB_PORT=3306 -DB_NAME=moneywhere -DB_USER=root -DB_PASSWORD=111111 +DB_PASSWORD=78p7gkc1 invite_code=111111 \ No newline at end of file diff --git a/docker-compose-ali-no-mysql.yml b/docker-compose-ali-no-mysql.yml index 48244f0..347c572 100644 --- a/docker-compose-ali-no-mysql.yml +++ b/docker-compose-ali-no-mysql.yml @@ -7,7 +7,13 @@ services: restart: always extra_hosts: - "host.docker.internal:host-gateway" - env_file: api-no-mysql.env + environment: + - DB_HOST=${DB_HOST:-host.docker.internal} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-moneywhere} + - DB_USER=${DB_USER:-root} + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" diff --git a/docker-compose-ali.yml b/docker-compose-ali.yml index 574a301..cabdc81 100644 --- a/docker-compose-ali.yml +++ b/docker-compose-ali.yml @@ -4,17 +4,13 @@ services: mysql: container_name: moneywhere_mysql image: registry.cn-hangzhou.aliyuncs.com/moneywhere/mysql8:latest - env_file: - - api.env restart: always environment: - - MYSQL_ROOT_PASSWORD=${DB_PASSWORD} - - MYSQL_DATABASE=${DB_NAME} + - MYSQL_ROOT_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - MYSQL_DATABASE=moneywhere command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_general_ci', - '--max_connections=10000', - '--default-authentication-plugin=mysql_native_password' ] volumes: - moneywhere_mysql_data:/var/lib/mysql @@ -38,7 +34,13 @@ services: - mysql image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest restart: always - env_file: api.env + environment: + - DB_HOST=mysql + - DB_PORT=3306 + - DB_NAME=moneywhere + - DB_USER=root + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" diff --git a/docker-compose-all-ali.yml b/docker-compose-all-ali.yml index dd1beb4..957a121 100644 --- a/docker-compose-all-ali.yml +++ b/docker-compose-all-ali.yml @@ -6,8 +6,8 @@ services: image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-all:latest restart: always environment: - - DB_PASSWORD=78p7gkc1 - - invite_code=111111 + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} volumes: - moneywhere_mysql_data:/var/lib/mysql ports: diff --git a/docker-compose-all-no-mysql-ali.yml b/docker-compose-all-no-mysql-ali.yml index 426da81..6c00c69 100644 --- a/docker-compose-all-no-mysql-ali.yml +++ b/docker-compose-all-no-mysql-ali.yml @@ -5,13 +5,15 @@ services: container_name: moneywhere image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-all-no-mysql:latest restart: always + extra_hosts: + - "host.docker.internal:host-gateway" environment: - - DB_HOST=${DB_HOST} - - DB_PORT=${DB_PORT} - - DB_NAME=${DB_NAME} - - DB_USER=${DB_USER} - - DB_PASSWORD=${DB_PASSWORD} - - invite_code=${invite_code} + - DB_HOST=${DB_HOST:-host.docker.internal} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-moneywhere} + - DB_USER=${DB_USER:-root} + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" - "43743:81" diff --git a/docker-compose-all-no-mysql-hub.yml b/docker-compose-all-no-mysql-hub.yml index ada99fe..a4ec2b5 100644 --- a/docker-compose-all-no-mysql-hub.yml +++ b/docker-compose-all-no-mysql-hub.yml @@ -5,13 +5,15 @@ services: container_name: moneywhere image: markliu2018/moneywhere-all-no-mysql:latest restart: always + extra_hosts: + - "host.docker.internal:host-gateway" environment: - - DB_HOST=host.docker.internal - - DB_PORT=3306 - - DB_NAME=moneywhere - - DB_USER=root - - DB_PASSWORD=111111 - - invite_code=111111 + - DB_HOST=${DB_HOST:-host.docker.internal} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-moneywhere} + - DB_USER=${DB_USER:-root} + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" - "43743:81" diff --git a/docker-compose-hub-no-mysql.yml b/docker-compose-hub-no-mysql.yml index 6bbc899..cfd4292 100644 --- a/docker-compose-hub-no-mysql.yml +++ b/docker-compose-hub-no-mysql.yml @@ -7,7 +7,13 @@ services: restart: always extra_hosts: - "host.docker.internal:host-gateway" - env_file: api-no-mysql.env + environment: + - DB_HOST=${DB_HOST:-host.docker.internal} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-moneywhere} + - DB_USER=${DB_USER:-root} + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" diff --git a/docker-compose-hub.yml b/docker-compose-hub.yml index 0ccfe0d..7ff13bb 100644 --- a/docker-compose-hub.yml +++ b/docker-compose-hub.yml @@ -4,16 +4,13 @@ services: mysql: container_name: moneywhere_mysql image: mysql:8.0 - env_file: api.env restart: always environment: - MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} - MYSQL_DATABASE: ${DB_NAME} + - MYSQL_ROOT_PASSWORD= ${DB_PASSWORD:-78p7gkc1} + - MYSQL_DATABASE= moneywhere command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_general_ci', - '--max_connections=10000', - '--default-authentication-plugin=mysql_native_password' ] volumes: - moneywhere_mysql_data:/var/lib/mysql @@ -37,7 +34,13 @@ services: - mysql image: markliu2018/moneywhere-api-user:latest restart: always - env_file: api.env + environment: + - DB_HOST=mysql + - DB_PORT=3306 + - DB_NAME=moneywhere + - DB_USER=root + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" diff --git a/docker-compose-no-mysql.yml b/docker-compose-no-mysql.yml index bcd4aaa..153362c 100644 --- a/docker-compose-no-mysql.yml +++ b/docker-compose-no-mysql.yml @@ -5,13 +5,15 @@ services: container_name: moneywhere image: markliu2018/moneywhere-all-no-mysql:latest restart: always + extra_hosts: + - "host.docker.internal:host-gateway" environment: - - DB_HOST=host.docker.internal - - DB_PORT=3306 - - DB_NAME=moneywhere - - DB_USER=root - - DB_PASSWORD=111111 - - invite_code=111111 + - DB_HOST=${DB_HOST:-host.docker.internal} + - DB_PORT=${DB_PORT:-3306} + - DB_NAME=${DB_NAME:-moneywhere} + - DB_USER=${DB_USER:-root} + - DB_PASSWORD=${DB_PASSWORD:-78p7gkc1} + - invite_code=${invite_code:-111111} ports: - "43742:9092" - "43743:81" diff --git a/notes.txt b/notes.txt index 8e3ad5d..2303b2a 100644 --- a/notes.txt +++ b/notes.txt @@ -40,44 +40,44 @@ docker compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml pu docker 5 in 1 hub 启动 ```sh -docker compose -f docker-compose-all-hub.yml up -d +docker compose --env-file api.env -f docker-compose-all-hub.yml up -d ``` docker 5 in 1 hub 升级 ```sh -docker compose -f docker-compose-all-hub.yml pull && docker compose -f docker-compose-all-hub.yml up -d +docker compose -f docker-compose-all-hub.yml pull && docker compose --env-file api.env -f docker-compose-all-hub.yml up -d ``` docker 3 in 1 hub 启动 ```sh -docker compose -f docker-compose-all-no-mysql-hub.yml up -d +docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-hub.yml up -d ``` docker 3 in 1 hub 升级 ```sh -docker compose -f docker-compose-all-hub.yml pull && docker compose -f docker-compose-all-no-mysql-hub.yml up -d +docker compose -f docker-compose-all-hub.yml pull && docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-hub.yml up -d ``` - 阿里云 docker 5 in 1 启动 ```sh -docker compose -f docker-compose-all-ali.yml up -d +docker compose --env-file api.env -f docker-compose-all-ali.yml up -d ``` 阿里云 docker 5 in 1 升级 ```sh -docker compose -f docker-compose-all-ali.yml pull && docker compose -f docker-compose-all-ali.yml up -d +docker compose -f docker-compose-all-ali.yml pull && docker compose --env-file api.env -f docker-compose-all-ali.yml up -d ``` 阿里云 docker 3 in 1 启动 ```sh -docker compose -f docker-compose-all-no-mysql-ali.yml up -d +docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-ali.yml up -d ``` 阿里云 docker 3 in 1 升级 ```sh -docker compose -f docker-compose-all-ali.yml pull && docker compose -f docker-compose-all-no-mysql-ali.yml up -d +docker compose -f docker-compose-all-ali.yml pull && docker compose --env-file api-no-mysql.env -f docker-compose-all-no-mysql-ali.yml up -d ``` + 78p7gkc1 ALTER USER 'root'@'%' IDENTIFIED BY '111111'; \ No newline at end of file