This commit is contained in:
markliu2013 2024-01-24 23:18:19 +08:00
parent aa8f2204cd
commit 4eea78f8ed
8 changed files with 97 additions and 20 deletions

View File

@ -4,42 +4,79 @@
部署前请确保已安装docker compose。如遇到任何问题欢迎加入 QQ群: 639653091 讨论。 部署前请确保已安装docker compose。如遇到任何问题欢迎加入 QQ群: 639653091 讨论。
部署步骤: ### 部署步骤:
1. 请下载本项目源代码使用git命令或直接下载源代码。 1. 请下载本项目源代码使用git命令或直接下载源代码。
```sh ```sh
git clone https://github.com/getmoneynote/docker-compose-moneywhere.git && cd docker-compose-moneywhere git clone https://github.com/getmoneynote/docker-compose-moneywhere.git && cd docker-compose-moneywhere
``` ```
2. 为保证数据安全问题请修改数据库默认密码一共2个地方需要修改。 2. 为保证数据安全问题请修改数据库默认密码。api.env -> DB_PASSWORD
1. docker-compose.yml文件 MYSQL_ROOT_PASSWORD变量 3. 为防止恶意注册请修改默认邀请码。api.env -> invite_code
2. api.env DB_PASSWORD变量修改
3. 为防止恶意注册请修改默认邀请码。api.env文件invite_code变量修改
4. 执行命令 4. 执行命令
```sh ```sh
docker compose up -d docker compose --env-file api.env up -d
``` ```
如果已有mysql服务想使用已存在的mysql服务请修改项目的mysql相关配置,执行命令 如果已有mysql服务想使用已存在的mysql服务请修改api-no-mysql.env文件为对应数据库信息,执行命令
```sh ```sh
docker compose -f docker-compose-no-mysql.yml up -d docker compose --env-file api-no-mysql.env -f docker-compose-no-mysql.yml up -d
``` ```
默认使用Docker Hub官方网站镜像中国大陆可能出现无法拉去镜像可尝试使用阿里云镜像。项目运行后本身不依赖任何外部第三方服务。 默认使用Docker Hub官方网站镜像中国大陆可能出现无法拉去镜像可尝试使用阿里云镜像。项目运行后本身不依赖任何外部第三方服务。
```sh ```sh
docker compose -f docker-compose-ali.yml up -d docker compose --env-file api.env -f docker-compose-ali.yml up -d
``` ```
版本升级,使用最新镜像。 版本升级,使用最新镜像。
```sh ```sh
docker compose pull && docker compose up -d docker compose pull && docker compose --env-file api.env up -d
``` ```
#### docker命令说明
docker hub with mysql 启动
```sh ```sh
docker compose -f docker-compose-no-mysql.yml pull && docker compose -f docker-compose-no-mysql.yml up -d docker compose --env-file api.env -f docker-compose-hub.yml up -d
``` ```
docker hub no mysql 启动
```sh
docker-compose --env-file api-no-mysql -f docker-compose-hub-no-mysql.yml up -d
```
阿里云 with mysql 启动
```sh
docker compose --env-file api.env -f docker-compose-ali.yml up -d
```
阿里云 no mysql 启动
```sh
docker-compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml up -d
```
docker hub with mysql 升级
```sh
docker compose -f docker-compose-hub.yml pull && docker compose --env-file api.env -f docker-compose-hub.yml up -d
```
docker hub no mysql 升级
```sh
docker compose -f docker-compose-hub-no-mysql.yml pull && docker-compose --env-file api-no-mysql -f docker-compose-hub-no-mysql.yml up -d
```
阿里云 with mysql 升级
```sh
docker compose -f docker-compose-ali.yml pull && docker compose --env-file api.env -f docker-compose-ali.yml up -d
```
阿里云 no mysql 升级
```sh
docker compose -f docker-compose-ali-no-mysql.yml pull && docker-compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml up -d
```
成功运行后,访问 [http://127.0.0.1:43743](http://127.0.0.1:43743) 可以打开网页版记账程序使用前请注册一个账户默认的邀请码是1111116个1, 为防止被恶意注册,请修改默认邀请码。 成功运行后,访问 [http://127.0.0.1:43743](http://127.0.0.1:43743) 可以打开网页版记账程序使用前请注册一个账户默认的邀请码是1111116个1, 为防止被恶意注册,请修改默认邀请码。

View File

@ -4,6 +4,7 @@ services:
moneywhere-api-user: moneywhere-api-user:
container_name: moneywhere_api container_name: moneywhere_api
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest
restart: always
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
env_file: api-no-mysql.env env_file: api-no-mysql.env
@ -15,6 +16,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:
@ -25,6 +27,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:

View File

@ -4,10 +4,12 @@ services:
mysql: mysql:
container_name: moneywhere_mysql container_name: moneywhere_mysql
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/mysql:5.7 image: registry.cn-hangzhou.aliyuncs.com/moneywhere/mysql:5.7
env_file:
- api.env
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: 111111 - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
MYSQL_DATABASE: moneywhere - MYSQL_DATABASE=${DB_NAME}
command: [ command: [
'--character-set-server=utf8mb4', '--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci', '--collation-server=utf8mb4_general_ci',
@ -35,6 +37,7 @@ services:
links: links:
- mysql - mysql
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-api-user:latest
restart: always
env_file: api.env env_file: api.env
ports: ports:
- "43742:9092" - "43742:9092"
@ -44,6 +47,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:
@ -54,6 +58,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest image: registry.cn-hangzhou.aliyuncs.com/moneywhere/moneywhere-fe-user-mobile:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:

View File

@ -4,6 +4,7 @@ services:
moneywhere-api-user: moneywhere-api-user:
container_name: moneywhere_api container_name: moneywhere_api
image: markliu2018/moneywhere-api-user:latest image: markliu2018/moneywhere-api-user:latest
restart: always
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
env_file: api-no-mysql.env env_file: api-no-mysql.env
@ -15,6 +16,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user:latest image: markliu2018/moneywhere-fe-user:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:
@ -25,6 +27,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user-mobile:latest image: markliu2018/moneywhere-fe-user-mobile:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:

View File

@ -4,10 +4,11 @@ services:
mysql: mysql:
container_name: moneywhere_mysql container_name: moneywhere_mysql
image: mysql:5.7 image: mysql:5.7
env_file: api.env
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: 111111 MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: moneywhere MYSQL_DATABASE: ${DB_NAME}
command: [ command: [
'--character-set-server=utf8mb4', '--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci', '--collation-server=utf8mb4_general_ci',
@ -22,11 +23,11 @@ services:
phpmyadmin: phpmyadmin:
container_name: moneywhere_phpmyadmin container_name: moneywhere_phpmyadmin
image: phpmyadmin/phpmyadmin image: phpmyadmin/phpmyadmin
restart: always
links: links:
- mysql - mysql
environment: environment:
PMA_ARBITRARY: 1 PMA_ARBITRARY: 1
restart: always
ports: ports:
- "43741:80" - "43741:80"
@ -35,6 +36,7 @@ services:
links: links:
- mysql - mysql
image: markliu2018/moneywhere-api-user:latest image: markliu2018/moneywhere-api-user:latest
restart: always
env_file: api.env env_file: api.env
ports: ports:
- "43742:9092" - "43742:9092"
@ -44,6 +46,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user:latest image: markliu2018/moneywhere-fe-user:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:
@ -54,6 +57,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user-mobile:latest image: markliu2018/moneywhere-fe-user-mobile:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:

View File

@ -4,6 +4,7 @@ services:
moneywhere-api-user: moneywhere-api-user:
container_name: moneywhere_api container_name: moneywhere_api
image: markliu2018/moneywhere-api-user:latest image: markliu2018/moneywhere-api-user:latest
restart: always
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
env_file: api-no-mysql.env env_file: api-no-mysql.env
@ -15,6 +16,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user:latest image: markliu2018/moneywhere-fe-user:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:
@ -25,6 +27,7 @@ services:
links: links:
- moneywhere-api-user - moneywhere-api-user
image: markliu2018/moneywhere-fe-user-mobile:latest image: markliu2018/moneywhere-fe-user-mobile:latest
restart: always
environment: environment:
USER_API_HOST: http://moneywhere-api-user:9092 USER_API_HOST: http://moneywhere-api-user:9092
ports: ports:

View File

@ -4,10 +4,11 @@ services:
mysql: mysql:
container_name: moneywhere_mysql container_name: moneywhere_mysql
image: mysql:5.7 image: mysql:5.7
env_file: api.env
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: 111111 MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: moneywhere MYSQL_DATABASE: ${DB_NAME}
command: [ command: [
'--character-set-server=utf8mb4', '--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci', '--collation-server=utf8mb4_general_ci',

View File

@ -1,2 +1,23 @@
docker-compose -f docker-compose-hub.yml up -d docker hub with mysql 启动
docker-compose -f docker-compose-no-mysql.yml up -d docker compose --env-file api.env -f docker-compose-hub.yml up -d
docker hub no mysql 启动
docker-compose --env-file api-no-mysql -f docker-compose-hub-no-mysql.yml up -d
阿里云 with mysql 启动
docker compose --env-file api.env -f docker-compose-ali.yml up -d
阿里云 no mysql 启动
docker-compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml up -d
docker hub with mysql 升级
docker compose -f docker-compose-hub.yml pull && docker compose --env-file api.env -f docker-compose-hub.yml up -d
docker hub no mysql 升级
docker compose -f docker-compose-hub-no-mysql.yml pull && docker-compose --env-file api-no-mysql -f docker-compose-hub-no-mysql.yml up -d
阿里云 with mysql 升级
docker compose -f docker-compose-ali.yml pull && docker compose --env-file api.env -f docker-compose-ali.yml up -d
阿里云 no mysql 升级
docker compose -f docker-compose-ali-no-mysql.yml pull && docker-compose --env-file api-no-mysql.env -f docker-compose-ali-no-mysql.yml up -d