openimsdk / openim-docker

openim-docker configuration for deploying OpenIM. Provides a build solution for a stable distribution, as well as a docker compose deployment strategy
https://openim.io
Apache License 2.0
36 stars 46 forks source link

Bug: Mysql cannot change userame root #64

Closed AndrewZuo01 closed 4 months ago

AndrewZuo01 commented 7 months ago

What happened?

I change the user name in .env file, then when I register user it has error

What did you expect to happen?

it shouldn't have error

How can we reproduce it (as minimally and precisely as possible)?

change the user name root to root1 in .env file, then register user at port 11001

Anything else we need to know?

No response

version

```console $ {name} version # paste output here ```

Cloud provider

OS version

```console # On Linux: $ cat /etc/os-release # paste output here $ uname -a # paste output here # On Windows: C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture # paste output here ```

Install tools

cubxxw commented 7 months ago

fix docker-compose file, add:

version: '3.1'

services:
  mysql:
    image: mysql:latest
    environment:
    user: "1000:1000"  # 指定非 root 用户的 UID 和 GID

volumes:
  my-db:
kubbot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


fix docker-compose file, add:


version: '3.1'

services: mysql: image: mysql:latest environment: user: "1000:1000" # Specify the UID and GID of the non-root user

volumes: my-db:

cubxxw commented 7 months ago

bug i use `user: "1000:100"

smile@smile:/data/workspaces/openim-docker$ docker logs openim-chat -f
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
=======>SCRIPTS_ROOT=/openim/openim-chat/scripts
=======>OPENIM_ROOT=/openim/openim-chat/scripts/..
=======>pwd=/openim/openim-chat/scripts
=======>bin_dir=/openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
=======>logs_dir=/openim/openim-chat/scripts/../logs
=======>sdk_db_dir=
Generating configuration file...
Configuration file generated.
/openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64/chat-api -port 10008 --config_folder_path /openim/openim-chat/scripts/../config/config.yaml
/openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64/admin-api -port 10009 --config_folder_path /openim/openim-chat/scripts/../config/config.yaml
/openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64/admin-rpc -port 30200 --config_folder_path /openim/openim-chat/scripts/../config/config.yaml
/openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64/chat-rpc -port 30300 --config_folder_path /openim/openim-chat/scripts/../config/config.yaml
# Start Chat check_all.sh 16:14:00, For local deployments, use ./check_all.sh --print-screen
goroutine 1 [running]:
main.main()
        github.com/OpenIMSDK/chat/cmd/rpc/chat-rpc/main.go:65 +0x53e
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
10008 port has been listening, belongs service is openImChatApiPort
openImAdminApiPort service does not start normally, not initiated port is 30200
please check /openim/openim-chat/scripts/../logs/openIM.log 
10008 port has been listening, belongs service is openImChatApiPort
openImAdminApiPort service does not start normally, not initiated port is 30200
please check /openim/openim-chat/scripts/../logs/openIM.log 
^C
cubxxw commented 7 months ago
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :10009

2024/01/03 16:13:13 github.com/OpenIMSDK/chat/pkg/common/dbconn/gorm.go:37
[error] failed to initialize database, got error dial tcp 172.28.0.1:13306: connect: connection refused

2024/01/03 16:13:14 github.com/OpenIMSDK/chat/pkg/common/dbconn/gorm.go:37
[error] failed to initialize database, got error dial tcp 172.28.0.1:13306: connect: connection refused

2024/01/03 16:13:43 github.com/OpenIMSDK/chat/pkg/common/dbconn/gorm.go:40
[error] failed to initialize database, got error dial tcp 172.28.0.1:13306: connect: connection refused
panic: failed to open initial database connection with DSN root1:openIM123@tcp(172.28.0.1:13306)/mysql?charset=utf8mb4&parseTime=true&loc=Local: dial tcp 172.28.0.1:13306: connect: connection refused

goroutine 1 [running]:
main.main()
        github.com/OpenIMSDK/chat/cmd/rpc/admin-rpc/main.go:69 +0x59e

2024/01/03 16:13:44 github.com/OpenIMSDK/chat/pkg/common/dbconn/gorm.go:40
[error] failed to initialize database, got error dial tcp 172.28.0.1:13306: connect: connection refused
panic: failed to open initial database connection with DSN root1:openIM123@tcp(172.28.0.1:13306)/mysql?charset=utf8mb4&parseTime=true&loc=Local: dial tcp 172.28.0.1:13306: connect: connection refused

goroutine 1 [running]:
main.main()
        github.com/OpenIMSDK/chat/cmd/rpc/chat-rpc/main.go:65 +0x53e
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
10008 port has been listening, belongs service is openImChatApiPort
openImAdminApiPort service does not start normally, not initiated port is 30200
please check /openim/openim-chat/scripts/../logs/openIM.log 
10008 port has been listening, belongs service is openImChatApiPort
openImAdminApiPort service does not start normally, not initiated port is 30200
please check /openim/openim-chat/scripts/../logs/openIM.log 
================> Architecture: x86_64
================> BIN_DIR: /openim/openim-chat/scripts/..//openim/openim-chat/scripts/../_output/bin/platforms/linux/amd64
10008 port has been listening, belongs service is openImChatApiPort
openImAdminApiPort service does not start normally, not initiated port is 30200
please check /openim/openim-chat/scripts/../logs/openIM.log 
kubbot commented 5 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

skiffer-git commented 4 months ago

The Docker deployment plan has been fully upgraded. Please refer to the README for the new scheme. The new scheme is simpler to use and supports Linux, Windows, and Mac.