mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-29 23:09:19 +08:00
Compare commits
553 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db081e6a4c | |||
| 6b0a2c9464 | |||
| 775aba52bd | |||
| e1770173ef | |||
| c73ce45e9e | |||
| 7aefb7fa2b | |||
| baece7eb3a | |||
| 1b31a07b40 | |||
| 83ba487c61 | |||
| 8dc0b639a2 | |||
| 9a636a15de | |||
| 7b12a8755a | |||
| b67c244bbd | |||
| 0bd2c00088 | |||
| cb1487109a | |||
| c9d8625274 | |||
| d0b659ccea | |||
| c182001fcf | |||
| c8038213c7 | |||
| 40a7bb9d48 | |||
| 7e48d1a00f | |||
| a64e5a776a | |||
| 9dc798bc53 | |||
| c6ea841064 | |||
| 0e03c5f89e | |||
| 70502685ce | |||
| a2fe6ffc7a | |||
| 1c724aa89b | |||
| 5d307c16b4 | |||
| 96c264981e | |||
| 60c507ff10 | |||
| 33ee58904b | |||
| 0938b11f83 | |||
| c0d633bc34 | |||
| 7a9506f616 | |||
| 36afd67a2c | |||
| 59d1090a6d | |||
| f384bb2aff | |||
| 4411ba3482 | |||
| 379118e481 | |||
| 661b1a5e6a | |||
| fd2d5252c5 | |||
| 284e89d410 | |||
| d7a649f699 | |||
| c758628701 | |||
| 28614e4c13 | |||
| beb9a37649 | |||
| 0e9810e9ff | |||
| 0c5cec8413 | |||
| 6135ce0919 | |||
| fdd765f982 | |||
| 529821475e | |||
| f2b21cbce6 | |||
| 061ee3abd2 | |||
| e2c53754b5 | |||
| f328ebc300 | |||
| 135c2c36aa | |||
| 16cf98213c | |||
| 094911bab2 | |||
| 6ee90b60c3 | |||
| c80b625977 | |||
| cc4ae8648e | |||
| 4f7eead38c | |||
| 386a99edbd | |||
| 982506c2fb | |||
| 5767a0fadc | |||
| a01fec538e | |||
| d451c36b2d | |||
| 0ae8433436 | |||
| 863c90e8bd | |||
| 396a87ab71 | |||
| a60b584dca | |||
| 3cb3b6ba2d | |||
| 16fbf7c63e | |||
| b980c9e751 | |||
| 127d45abc9 | |||
| e99f441e50 | |||
| 186cfa7226 | |||
| 7627ebed5c | |||
| 1be159b47c | |||
| 4e3ab62f6c | |||
| 85cb95602d | |||
| ff917466eb | |||
| 1235715c22 | |||
| 1393e40eb9 | |||
| 442c838bda | |||
| ea5039d2ae | |||
| 8f2e9f5261 | |||
| e1147aff9e | |||
| f9b39e91ee | |||
| 4bf73b0a47 | |||
| 05ee20613b | |||
| 286163ce18 | |||
| f0976c9ade | |||
| 1ab7660f0d | |||
| 84c7b8827e | |||
| 5e1aa43793 | |||
| a9b71e5a96 | |||
| 08ed131e19 | |||
| 85e3a81419 | |||
| 818ed107c6 | |||
| 4f322254b0 | |||
| decd6a98be | |||
| 5ae35bfee1 | |||
| a6ba349cb6 | |||
| 3e3818d4b5 | |||
| 6661c5baac | |||
| e813016402 | |||
| 924aa8ecb5 | |||
| 64edd9b7ea | |||
| 4400423fca | |||
| 0554778c83 | |||
| 2bc6d77d10 | |||
| 7ac790e4d0 | |||
| 0732fe6171 | |||
| d7b3ea0a6e | |||
| 0a2b6605d7 | |||
| f559795ba3 | |||
| 6b8b5f7896 | |||
| 1bf4fa0d87 | |||
| d53507b7b6 | |||
| 787bfccc2c | |||
| 955bfe3f40 | |||
| 78d7588af7 | |||
| bbde362570 | |||
| 972dd5f531 | |||
| 464320a3ec | |||
| 2aa49f080e | |||
| 9dac12cf2b | |||
| d1f3266383 | |||
| 1e2a60c802 | |||
| ee9c3cbde3 | |||
| 235be5da0c | |||
| 29adb5de07 | |||
| 4618bf990d | |||
| 0a57830925 | |||
| 71a2090363 | |||
| e420871e1f | |||
| 01b2de80ae | |||
| cdd86349d0 | |||
| 45293152bb | |||
| 7bf7686314 | |||
| 5888dc3b5d | |||
| 3d9355848b | |||
| 7033b603ca | |||
| 71ad683614 | |||
| 1fdc4d06d1 | |||
| cff9ee39be | |||
| 458f872fe3 | |||
| ac99da044a | |||
| a6bd8e5205 | |||
| f9fdd540f9 | |||
| 1706f5df07 | |||
| 40fc3e6c08 | |||
| 2608ae58df | |||
| 0e62deed0a | |||
| e588091bf6 | |||
| eb49b27e16 | |||
| 4fd31e4367 | |||
| aaad0c03a6 | |||
| 1026a6b2b6 | |||
| f5ed0be023 | |||
| a7f44b6ce7 | |||
| 481f12af5e | |||
| 16a7bc63f2 | |||
| e8dc5ce085 | |||
| 98ce12d74e | |||
| edb09f2081 | |||
| 86fc0e4101 | |||
| fb72f4b1ae | |||
| 6bf0a3a804 | |||
| 4bcaa5eaca | |||
| 8ca6584299 | |||
| e86e8820f3 | |||
| 07c300f35f | |||
| b08936c27e | |||
| 0b4b408552 | |||
| 36e37052e0 | |||
| 9a3373a43d | |||
| 428e5a7a4e | |||
| 7445b84756 | |||
| fa5be03fc3 | |||
| 49b21fb577 | |||
| 1f7e788585 | |||
| 43ac9de714 | |||
| e80afa610d | |||
| 20a2cb3d3c | |||
| 26b3f742ce | |||
| 2ccbade642 | |||
| fc8523da46 | |||
| b67ad01d97 | |||
| cdf49b2e37 | |||
| 920a7cfdac | |||
| 023ec9e53e | |||
| 7c9b4576f0 | |||
| 4f2d543651 | |||
| 25aa6a4345 | |||
| 0b9d9fa8d7 | |||
| a01781d5b7 | |||
| b15ae542aa | |||
| b68f69dfc7 | |||
| 7d1cafc3d3 | |||
| 386c837f1a | |||
| be8c544da3 | |||
| a78e43bfe3 | |||
| 7b57b924ee | |||
| 46ee4e41a1 | |||
| f87eed1336 | |||
| e4964b050b | |||
| 83f128ddcc | |||
| 13b2aa675f | |||
| a98f89a4e7 | |||
| d42d4308e5 | |||
| 0608649961 | |||
| 3013af8e62 | |||
| 915118140f | |||
| a662414b7f | |||
| 112ce9b450 | |||
| 0f1208dba9 | |||
| 21dcb55c82 | |||
| 25871aea49 | |||
| 63d75bb68b | |||
| 8e95e8c4f8 | |||
| 2b0a997573 | |||
| 84df956293 | |||
| 1acf21371b | |||
| acee47e861 | |||
| 2dab70697c | |||
| b3f5c2f185 | |||
| 25a848c4e4 | |||
| ad814b6cbb | |||
| ac55951c74 | |||
| a0520ce5d8 | |||
| 6f20cdd905 | |||
| 6d45f0730c | |||
| 24288aa597 | |||
| 66f49feebb | |||
| b77bbe6a66 | |||
| 084fe0e00f | |||
| 7f449aed5b | |||
| 9cb30e0ec6 | |||
| 1d78b68831 | |||
| 0fbf882059 | |||
| 4d56dfdfa2 | |||
| 53cd4205e8 | |||
| a4e2e23fbe | |||
| 0e726a20ba | |||
| be01c4da0c | |||
| f190611bcc | |||
| c0a2abeae9 | |||
| 5d4600a080 | |||
| e6136cac08 | |||
| f2a35fb833 | |||
| 11342a54c9 | |||
| ab176b5b1d | |||
| 189911c77f | |||
| 4c9859a1ac | |||
| 01b1116017 | |||
| d3af2e6547 | |||
| b5a031be9f | |||
| c24b0e1425 | |||
| 4272955097 | |||
| 0a267f69e6 | |||
| 5d5788e67e | |||
| 10ec7e8708 | |||
| 233ecf8b5f | |||
| 156c6429d3 | |||
| d5e7d3298a | |||
| 837efc90b6 | |||
| 9394d340a2 | |||
| be820e8401 | |||
| 75629ba5ea | |||
| 7e428e8f94 | |||
| 5a69eb2dd3 | |||
| 5b5abd2601 | |||
| 7c302cb19c | |||
| 71c836ae1a | |||
| b2be663ba6 | |||
| f6533b2ca4 | |||
| a499112ece | |||
| df78d87ec5 | |||
| a9edd036e0 | |||
| b75507396b | |||
| 6f69653a8b | |||
| 14fd7444e8 | |||
| 8d66128009 | |||
| d9ecfddecd | |||
| 19da03dfa4 | |||
| 271934ef4b | |||
| 6f22b37e1d | |||
| ad2df2f36f | |||
| 99739810a0 | |||
| d2c1daf4e3 | |||
| a30c8953c8 | |||
| a6d676700d | |||
| 66aa690104 | |||
| 05b6fb4a7d | |||
| c1c72927c1 | |||
| d78bf6d1e1 | |||
| 86512f0dcb | |||
| f738113020 | |||
| 1be16380da | |||
| a9bb365760 | |||
| 10a0666de9 | |||
| cf8dc4e529 | |||
| ebed875c46 | |||
| 8ac36526a8 | |||
| dce0e370cf | |||
| 067d23e2bc | |||
| e494d21a57 | |||
| 0654ecc9bb | |||
| b235c71c76 | |||
| 07842b0fa7 | |||
| e0ad4e6e7b | |||
| 9be70d640e | |||
| 44a9724827 | |||
| 9065e8ed25 | |||
| e1c7c11bdf | |||
| 56436adf4d | |||
| 1a8197aef1 | |||
| e9f6521c6a | |||
| 07cdd8bbab | |||
| 53d7f60ebc | |||
| 819ebf0ede | |||
| 157f858975 | |||
| a1a79ea619 | |||
| 672de78c81 | |||
| d446bbb451 | |||
| 135973de09 | |||
| 9fddf6819b | |||
| 7f9812a488 | |||
| f3a16e1ecd | |||
| 11405adcf6 | |||
| c0d7f0f5fd | |||
| 68ad1e9645 | |||
| 4b0a95fc1b | |||
| fdb0ba4349 | |||
| 4a3f168720 | |||
| 05d83ebe8b | |||
| 9aaee04a69 | |||
| 3f5dd5bad8 | |||
| e53a895471 | |||
| bfc8314f52 | |||
| 199d2e8298 | |||
| 4c7d7fad1b | |||
| df58abfcdb | |||
| 710d37c640 | |||
| 56c63fb1a1 | |||
| 3e21c841be | |||
| 298763a4a7 | |||
| d6f8f9704c | |||
| f3e5b03af2 | |||
| 603f0d289a | |||
| e7f0979c9e | |||
| 9b69a5c8f2 | |||
| 99b445e7bc | |||
| a85bbc8ce8 | |||
| ea85628389 | |||
| bafd2f3b86 | |||
| bd7009732f | |||
| 051f73013c | |||
| 6484b796cd | |||
| 7a5a308c9b | |||
| 4709e536ee | |||
| 4eb5df3f28 | |||
| d3751da0e4 | |||
| de90205b66 | |||
| 5d54225f9d | |||
| a556cfcd40 | |||
| 405a60c4f8 | |||
| de528270a2 | |||
| ea0365b9da | |||
| f8ca38b7e3 | |||
| bfeb434920 | |||
| 7101ba472d | |||
| a314f2d1cb | |||
| 99e1c53a41 | |||
| b21cc930af | |||
| ccad06b7b6 | |||
| 7364dc1989 | |||
| 5b816b095d | |||
| 08a4b92f3a | |||
| 3c8a0bb011 | |||
| d6e14eafef | |||
| 15df8e0a08 | |||
| 42d9e7175f | |||
| 2aa7d6095d | |||
| 31aa75d745 | |||
| dfd2847c12 | |||
| db5f9572b1 | |||
| cb9db10052 | |||
| 66960b147a | |||
| 8ec4f2e814 | |||
| 081e34f953 | |||
| 2800eef199 | |||
| 08f3a79e6e | |||
| 1c528b0f04 | |||
| c5d144bcc4 | |||
| 9a9d6ac524 | |||
| 6ced618c1c | |||
| bb1babad11 | |||
| 1a93592253 | |||
| e52be45659 | |||
| e7e08a94a9 | |||
| d22c3867c1 | |||
| e52f65f690 | |||
| dfcfa643f0 | |||
| a986068cbb | |||
| af6915b1b0 | |||
| af46999a16 | |||
| 322ec26829 | |||
| 935f80cd8a | |||
| 8379652ad5 | |||
| decef23751 | |||
| c639cf7162 | |||
| 2785ab6913 | |||
| d92aca5b16 | |||
| 4cf00a4198 | |||
| f6b549678d | |||
| 978a7e209e | |||
| b06b8e4d2b | |||
| 3a3412486a | |||
| 624014572c | |||
| 24d917bb2d | |||
| 2a4fae4718 | |||
| 9f4a8952a4 | |||
| 029c020fe0 | |||
| 1f0040ceb6 | |||
| 76a3334f9d | |||
| 22d0d80bfe | |||
| de13f5edbd | |||
| 953e284566 | |||
| 1b3fbf56d0 | |||
| 83779a684b | |||
| d33e15a2bb | |||
| a9b60b8052 | |||
| 329d475106 | |||
| 2cbecf439e | |||
| 389271c00d | |||
| 8839c36917 | |||
| 3649846423 | |||
| f3858e8300 | |||
| 741cfec1ec | |||
| 9326b10d3a | |||
| 6d90cd59f2 | |||
| 5c503e71ed | |||
| cdf851d196 | |||
| bf09e49164 | |||
| d391a4d023 | |||
| 9182f15ee0 | |||
| be6811ddbd | |||
| 10d299d1b3 | |||
| 4989bb07f6 | |||
| 0d46349386 | |||
| 267e7c3b08 | |||
| cad689b337 | |||
| e54d5a13e8 | |||
| ac7619de55 | |||
| c75e258f81 | |||
| e4ed6dde0c | |||
| 9025d8bd90 | |||
| 2433e27eb5 | |||
| 2610a27894 | |||
| eba25f1bb8 | |||
| 59b625b7c0 | |||
| 0eeb2f6752 | |||
| cd7b484fc2 | |||
| 16b3ea8b7e | |||
| 942afd7fec | |||
| de271d5b76 | |||
| 7e826c70df | |||
| 162478563c | |||
| 8d0ae922b8 | |||
| 2200f757dc | |||
| 4f65882b5d | |||
| 5ba67af0e3 | |||
| efeb394f3e | |||
| 9a0ee3516b | |||
| 55a873d0ef | |||
| 0561f3e398 | |||
| 68d587e484 | |||
| c026754a68 | |||
| 32561b5616 | |||
| 6b30097bde | |||
| 7dc1f9b81b | |||
| 9964650014 | |||
| a705f6a8b7 | |||
| 151cf3daf2 | |||
| 5758f1701d | |||
| ac631f7c49 | |||
| e814d9ea63 | |||
| d7e88a3213 | |||
| 9b3dee6aa4 | |||
| 879ad86e0f | |||
| ed63b9f3cc | |||
| ef3f41bb69 | |||
| 4d9ed1a6cb | |||
| 4b8f6f1f66 | |||
| cf57f999c5 | |||
| fd9630ea84 | |||
| 9fed812872 | |||
| 41b7e5f32d | |||
| 3345b6e242 | |||
| 52a4577b4c | |||
| 267d93168d | |||
| 78895288d0 | |||
| 249d5e2788 | |||
| 488346979d | |||
| cadecdb3b8 | |||
| 9d9d3db701 | |||
| 5b216e6a3a | |||
| c03e26ee5e | |||
| bcc2f05aa5 | |||
| b18813689d | |||
| 79999edcea | |||
| 764b34d947 | |||
| 51fa675e90 | |||
| e000dc18aa | |||
| 1f81c7ba2d | |||
| c1811463cb | |||
| 7a1dc6da01 | |||
| 0a28bcfbe9 | |||
| 93f3dd14a5 | |||
| 6d82c9c3db | |||
| 3714873b7b | |||
| 5534c2a8f8 | |||
| cad23f1672 | |||
| 2bf50bb8c2 | |||
| 6ad50e4e04 | |||
| 1c5aae2301 | |||
| aed95ed4fc | |||
| 2a97801aae | |||
| c6aefa984d | |||
| 5e9f1ac00f | |||
| 0a83470019 | |||
| 0ed1f6c341 | |||
| e85463c4a1 | |||
| 31c18bf856 | |||
| ca1d36556b | |||
| 3085bc1443 | |||
| 7843d81c18 | |||
| 8155551464 | |||
| 168dd1d01f | |||
| 18e92ccbd3 | |||
| 2ad71fc4ac | |||
| 29380b93ef | |||
| 00d2ff810b | |||
| a99295f594 | |||
| cc8a2e5fce | |||
| 7137320f1a | |||
| 376c9bbdc7 | |||
| 49d57f46ae | |||
| 1a61598322 |
@@ -0,0 +1,4 @@
|
||||
USER=root
|
||||
PASSWORD=openIM123
|
||||
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||
DATA_DIR=./
|
||||
+396
-15
@@ -1,22 +1,403 @@
|
||||
bin
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# For the entire design of.gitignore, ignore git commits and ignore files
|
||||
#===============================================================================
|
||||
#
|
||||
|
||||
### OpenIM developer supplement ###
|
||||
logs
|
||||
.devcontainer
|
||||
components
|
||||
logs
|
||||
out-test
|
||||
.github
|
||||
.idea
|
||||
Dockerfile.cross
|
||||
|
||||
### Makefile ###
|
||||
tmp/
|
||||
bin/
|
||||
output/
|
||||
_output/
|
||||
|
||||
deploy/open_im_demo
|
||||
deploy/open_im_api
|
||||
deploy/open_im_msg_gateway
|
||||
deploy/open_im_msg_transfer
|
||||
deploy/open_im_push
|
||||
deploy/open_im_timer_task
|
||||
deploy/open_im_rpc_user
|
||||
deploy/open_im_rpc_friend
|
||||
deploy/open_im_rpc_group
|
||||
deploy/open_im_rpc_msg
|
||||
deploy/open_im_rpc_auth
|
||||
### OpenIM Config ###
|
||||
config/config.yaml
|
||||
./config/config.yaml
|
||||
.env
|
||||
./.env
|
||||
|
||||
### OpenIM deploy ###
|
||||
deploy/openim_demo
|
||||
deploy/openim-api
|
||||
deploy/openim-rpc-msg_gateway
|
||||
deploy/openim-msgtransfer
|
||||
deploy/openim-push
|
||||
deploy/openim_timer_task
|
||||
deploy/openim-rpc-user
|
||||
deploy/openim-rpc-friend
|
||||
deploy/openim-rpc-group
|
||||
deploy/openim-rpc-msg
|
||||
deploy/openim-rpc-auth
|
||||
deploy/Open-IM-SDK-Core
|
||||
|
||||
# files used by the developer
|
||||
.idea.md
|
||||
.todo.md
|
||||
.note.md
|
||||
|
||||
# ==============================================================================
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/go,git,vim,tags,test,emacs,backup,jetbrains
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,git,vim,tags,test,emacs,backup,jetbrains
|
||||
|
||||
### Backup ###
|
||||
*.bak
|
||||
*.gho
|
||||
*.ori
|
||||
*.orig
|
||||
*.tmp
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
# network security
|
||||
/network-security.data
|
||||
|
||||
### vscode ###
|
||||
.vscode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/vim,jetbrains,vscode,git,go,tags,backup,test
|
||||
|
||||
### Git ###
|
||||
# Created by git for backups. To disable backups in Git:
|
||||
# $ git config --global mergetool.keepBackup false
|
||||
|
||||
# Created by git when using merge tools for conflicts
|
||||
*.BACKUP.*
|
||||
*.BASE.*
|
||||
*.LOCAL.*
|
||||
*.REMOTE.*
|
||||
*_BACKUP_*.txt
|
||||
*_BASE_*.txt
|
||||
*_LOCAL_*.txt
|
||||
*_REMOTE_*.txt
|
||||
|
||||
### Go ###
|
||||
# If you prefer the allow list template instead of the deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
vendor/
|
||||
|
||||
# Go workspace file
|
||||
# go.work
|
||||
go.work.sum
|
||||
|
||||
### JetBrains ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### JetBrains Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||
.idea/**/sonarlint/
|
||||
|
||||
# SonarQube Plugin
|
||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||
.idea/**/sonarIssues.xml
|
||||
|
||||
# Markdown Navigator plugin
|
||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-navigator-enh.xml
|
||||
.idea/**/markdown-navigator/
|
||||
|
||||
# Cache file creation bug
|
||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||
.idea/$CACHE_FILE$
|
||||
|
||||
# CodeStream plugin
|
||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||
.idea/codestream.xml
|
||||
|
||||
# Azure Toolkit for IntelliJ plugin
|
||||
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
||||
.idea/**/azureSettings.xml
|
||||
|
||||
### Tags ###
|
||||
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
||||
TAGS
|
||||
.TAGS
|
||||
!TAGS/
|
||||
tags
|
||||
.tags
|
||||
!tags/
|
||||
gtags.files
|
||||
GTAGS
|
||||
GRTAGS
|
||||
GPATH
|
||||
GSYMS
|
||||
cscope.files
|
||||
cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
|
||||
|
||||
### Test ###
|
||||
### Ignore all files that could be used to test your code and
|
||||
### you wouldn't want to push
|
||||
|
||||
# Reference https://en.wikipedia.org/wiki/Metasyntactic_variable
|
||||
|
||||
# Most common
|
||||
*foo
|
||||
*bar
|
||||
*fubar
|
||||
*foobar
|
||||
*baz
|
||||
|
||||
# Less common
|
||||
*qux
|
||||
*quux
|
||||
*bongo
|
||||
*bazola
|
||||
*ztesch
|
||||
|
||||
# UK, Australia
|
||||
*wibble
|
||||
*wobble
|
||||
*wubble
|
||||
*flob
|
||||
*blep
|
||||
*blah
|
||||
*boop
|
||||
*beep
|
||||
|
||||
# Japanese
|
||||
*hoge
|
||||
*piyo
|
||||
*fuga
|
||||
*hogera
|
||||
*hogehoge
|
||||
|
||||
# Portugal, Spain
|
||||
*fulano
|
||||
*sicrano
|
||||
*beltrano
|
||||
*mengano
|
||||
*perengano
|
||||
*zutano
|
||||
|
||||
# France, Italy, the Netherlands
|
||||
*toto
|
||||
*titi
|
||||
*tata
|
||||
*tutu
|
||||
*pipppo
|
||||
*pluto
|
||||
*paperino
|
||||
*aap
|
||||
*noot
|
||||
*mies
|
||||
|
||||
# Other names that would make sense
|
||||
*tests
|
||||
*testsdir
|
||||
*testsfile
|
||||
*testsfiles
|
||||
*testdir
|
||||
*testfile
|
||||
*testfiles
|
||||
*testing
|
||||
*testingdir
|
||||
*testingfile
|
||||
*testingfiles
|
||||
*temp
|
||||
*tempdir
|
||||
*tempfile
|
||||
*tempfiles
|
||||
*tmp
|
||||
*tmpdir
|
||||
*tmpfile
|
||||
*tmpfiles
|
||||
*lol
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
!*.svg # comment out if you don't need vector files
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
# Auto-generated tag files
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/go,git,vim,tags,test,emacs,backup,jetbrains
|
||||
.idea
|
||||
dist/
|
||||
.env
|
||||
config/config.yaml
|
||||
|
||||
@@ -26,8 +26,6 @@ By deployment of the Open-IM-Server on the customer's server, developers can int
|
||||
- Supports multiple protocols
|
||||
|
||||
## Community
|
||||
|
||||
- Join the Telegram-OpenIM group: https://t.me/joinchat/zSJLPaHBNLZmODI1
|
||||
- 中文官网访问这里:[Open-IM中文开发文档](https://doc.rentsoft.cn/)
|
||||
|
||||
## Quick start
|
||||
@@ -36,75 +34,69 @@ By deployment of the Open-IM-Server on the customer's server, developers can int
|
||||
|
||||
> Open-IM relies on five open source high-performance components: ETCD, MySQL, MongoDB, Redis, and Kafka. Privatization deployment Before Open-IM-Server, please make sure that the above five components have been installed. If your server does not have the above components, you must first install Missing components. If you have the above components, it is recommended to use them directly. If not, it is recommended to use Docker-compose, no To install dependencies, one-click deployment, faster and more convenient.
|
||||
|
||||
#### Source code deployment
|
||||
#### Deploy using Docker
|
||||
|
||||
1. Install [Go environment](https://golang.org/doc/install). Make sure Go version is at least 1.15.
|
||||
1. Install [Go environment](https://golang.org/doc/install). Make sure Go version is at least 1.17
|
||||
|
||||
2. Clone the Open-IM project to your server.
|
||||
2. Clone the Open-IM project to your server
|
||||
|
||||
```
|
||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||
```
|
||||
|
||||
3. Build and start Service.
|
||||
3. Deploy
|
||||
|
||||
1. Shell authorization
|
||||
1. Modify env
|
||||
|
||||
```
|
||||
#cd Open-IM-server/script
|
||||
|
||||
chmod +x *.sh
|
||||
#cd Open-IM-server
|
||||
USER=root
|
||||
PASSWORD=openIM123 #Password with more than 8 digits, excluding special characters
|
||||
ENDPOINT=http://127.0.0.1:10005 #Replace 127.0.0.1 with Internet IP
|
||||
DATA_DIR=./
|
||||
```
|
||||
|
||||
2. Execute the build shell
|
||||
|
||||
2. Deploy && Start
|
||||
|
||||
```
|
||||
./build_all_service.sh
|
||||
chmod +x install_im_server.sh;
|
||||
./install_im_server.sh;
|
||||
```
|
||||
|
||||
3. Start service
|
||||
|
||||
```
|
||||
./start_all.sh
|
||||
```
|
||||
|
||||
|
||||
4. Check service
|
||||
|
||||
|
||||
```
|
||||
./check_all.sh
|
||||
cd script;
|
||||
./docker_check_service.sh./check_all.sh
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
#### Docker deployment
|
||||
#### Deploy using source code
|
||||
|
||||
All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
||||
1. Go 1.17 or above。
|
||||
2. Clone
|
||||
|
||||
1. [Install Docker](https://docs.docker.com/install/) 1.13 or above.
|
||||
```shell
|
||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||
cd cmd/Open-IM-SDK-Core
|
||||
git checkout main
|
||||
```
|
||||
|
||||
2. [Install Docker Compose](https://docs.docker.com/compose/install/) 1.22 or above.
|
||||
1. Set executable permissions
|
||||
|
||||
3. Clone the Open-IM project to your server.
|
||||
```shell
|
||||
cd ../../script/
|
||||
chmod +x *.sh
|
||||
```
|
||||
|
||||
```
|
||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||
```
|
||||
1. build
|
||||
|
||||
4. Start docker-compose with one click(Docker automatically pulls all images)
|
||||
```shell
|
||||
./batch_build_all_service.sh
|
||||
```
|
||||
|
||||
```
|
||||
cd Open-IM-Server
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
5. Check service
|
||||
|
||||
```
|
||||
./docker_check_service.sh
|
||||
./check_all.sh
|
||||
```
|
||||
|
||||

|
||||
all services build success
|
||||
|
||||
### CONFIGURATION INSTRUCTIONS
|
||||
|
||||
|
||||
+1
-1
Submodule cmd/Open-IM-SDK-Core updated: 1667b0f4e2...e731cb86ec
@@ -1,13 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_api
|
||||
NAME=open_im_api
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -16,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
+13
-3
@@ -15,6 +15,7 @@ import (
|
||||
"Open_IM/internal/api/user"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/utils"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -110,6 +111,8 @@ func main() {
|
||||
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
||||
//only for supergroup
|
||||
groupRouterGroup.POST("/invite_user_to_groups", group.InviteUserToGroups)
|
||||
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
||||
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
|
||||
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
|
||||
@@ -162,6 +165,11 @@ func main() {
|
||||
chatGroup.POST("/batch_send_msg", manage.ManagementBatchSendMsg)
|
||||
chatGroup.POST("/check_msg_is_send_success", manage.CheckMsgIsSendSuccess)
|
||||
chatGroup.POST("/set_msg_min_seq", apiChat.SetMsgMinSeq)
|
||||
|
||||
chatGroup.POST("/set_message_reaction_extensions", apiChat.SetMessageReactionExtensions)
|
||||
chatGroup.POST("/get_message_list_reaction_extensions", apiChat.GetMessageListReactionExtensions)
|
||||
chatGroup.POST("/add_message_reaction_extensions", apiChat.AddMessageReactionExtensions)
|
||||
chatGroup.POST("/delete_message_reaction_extensions", apiChat.DeleteMessageReactionExtensions)
|
||||
}
|
||||
//Conversation
|
||||
conversationGroup := r.Group("/conversation")
|
||||
@@ -169,8 +177,10 @@ func main() {
|
||||
conversationGroup.POST("/get_all_conversations", conversation.GetAllConversations)
|
||||
conversationGroup.POST("/get_conversation", conversation.GetConversation)
|
||||
conversationGroup.POST("/get_conversations", conversation.GetConversations)
|
||||
//deprecated
|
||||
conversationGroup.POST("/set_conversation", conversation.SetConversation)
|
||||
conversationGroup.POST("/batch_set_conversation", conversation.BatchSetConversations)
|
||||
//deprecated
|
||||
conversationGroup.POST("/set_recv_msg_opt", conversation.SetRecvMsgOpt)
|
||||
conversationGroup.POST("/modify_conversation_field", conversation.ModifyConversationField)
|
||||
}
|
||||
@@ -214,7 +224,7 @@ func main() {
|
||||
|
||||
organizationGroup.POST("/get_department_member", organization.GetDepartmentMember)
|
||||
organizationGroup.POST("/delete_user_in_department", organization.DeleteUserInDepartment)
|
||||
|
||||
organizationGroup.POST("/get_user_in_organization", organization.GetUserInOrganization)
|
||||
}
|
||||
|
||||
initGroup := r.Group("/init")
|
||||
@@ -222,7 +232,7 @@ func main() {
|
||||
initGroup.POST("/set_client_config", clientInit.SetClientInitConfig)
|
||||
initGroup.POST("/get_client_config", clientInit.GetClientInitConfig)
|
||||
}
|
||||
|
||||
go getcdv3.RegisterConf()
|
||||
go apiThird.MinioInit()
|
||||
defaultPorts := config.Config.Api.GinPort
|
||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10002 as port")
|
||||
@@ -231,7 +241,7 @@ func main() {
|
||||
if config.Config.Api.ListenIP != "" {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
fmt.Println("start api server, address: ", address, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion)
|
||||
err := r.Run(address)
|
||||
if err != nil {
|
||||
log.Error("", "api run failed ", address, err.Error())
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_cms_api
|
||||
NAME=open_im_cms_api
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -16,8 +28,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -25,6 +25,6 @@ func main() {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
fmt.Println("start cms api server, address: ", address, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start cms api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
router.Run(address)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_cron_task
|
||||
NAME=open_im_cron_task
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -2,10 +2,15 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/cron_task"
|
||||
"flag"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("start cronTask")
|
||||
cronTask.StartCronTask()
|
||||
var userID = flag.String("userID", "", "userID to clear msg and reset seq")
|
||||
var workingGroupID = flag.String("workingGroupID", "", "workingGroupID to clear msg and reset seq")
|
||||
flag.Parse()
|
||||
fmt.Println(time.Now(), "start cronTask", *userID, *workingGroupID)
|
||||
cronTask.StartCronTask(*userID, *workingGroupID)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_demo
|
||||
NAME=open_im_demo
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -16,8 +28,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -70,7 +70,7 @@ func main() {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
fmt.Println("start demo api server address: ", address, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start demo api server address: ", address, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
go register.OnboardingProcessRoutine()
|
||||
go register.ImportFriendRoutine()
|
||||
err := r.Run(address)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_msg_gateway
|
||||
NAME=open_im_msg_gateway
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -21,7 +21,7 @@ func main() {
|
||||
flag.Parse()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
gate.Init(*rpcPort, *wsPort)
|
||||
gate.Run(*prometheusPort)
|
||||
wg.Wait()
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_msg_transfer
|
||||
NAME=open_im_msg_transfer
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -16,8 +28,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -17,7 +17,7 @@ func main() {
|
||||
flag.Parse()
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
logic.Init()
|
||||
fmt.Println("start msg_transfer server ", "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
logic.Run(*prometheusPort)
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_push
|
||||
NAME=open_im_push
|
||||
BIN_DIR=../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -18,7 +18,7 @@ func main() {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
fmt.Println("start push rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start push rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
logic.Init(*rpcPort)
|
||||
logic.Run(*prometheusPort)
|
||||
wg.Wait()
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_admin_cms
|
||||
NAME=open_im_admin_cms
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.AdminCmsPrometheusPort[0], "adminCMSPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start cms rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start cms rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := rpcMessageCMS.NewAdminCMSServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_auth
|
||||
NAME=open_im_auth
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.AuthPrometheusPort[0], "authPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start auth rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start auth rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := rpcAuth.NewRpcAuthServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_cache
|
||||
NAME=open_im_cache
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -15,7 +15,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.CachePrometheusPort[0], "cachePrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start cache rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start cache rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := rpcCache.NewCacheServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_conversation
|
||||
NAME=open_im_conversation
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcConversation default listen port 11300")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.ConversationPrometheusPort[0], "conversationPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start conversation rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start conversation rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion)
|
||||
rpcServer := rpcConversation.NewRpcConversationServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_friend
|
||||
NAME=open_im_friend
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +28,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcFriendPort from cmd,default 12000 as port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.FriendPrometheusPort[0], "friendPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start friend rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start friend rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := friend.NewFriendServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_group
|
||||
NAME=open_im_group
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +28,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcGroupPort from cmd,default 16000 as port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.GroupPrometheusPort[0], "groupPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start group rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start group rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := group.NewGroupServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_msg
|
||||
NAME=open_im_msg
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessagePrometheusPort[0], "msgPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start msg rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start msg rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := msg.NewRpcChatServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_office
|
||||
NAME=open_im_office
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.OfficePrometheusPort[0], "officePrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start office rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start office rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := rpc.NewOfficeServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_organization
|
||||
NAME=open_im_organization
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcOrganizationPort from cmd,default 11200 as port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.OrganizationPrometheusPort[0], "organizationPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start organization rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start organization rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := organization.NewServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_user
|
||||
NAME=open_im_user
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
OS:= $(or $(os),linux)
|
||||
ARCH:=$(or $(arch),amd64)
|
||||
all: gotool build
|
||||
|
||||
ifeq ($(OS),windows)
|
||||
|
||||
BINARY_NAME=${NAME}.exe
|
||||
|
||||
else
|
||||
|
||||
BINARY_NAME=${NAME}
|
||||
|
||||
endif
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
@@ -15,8 +27,7 @@ gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
install:build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
|
||||
@@ -14,7 +14,7 @@ func main() {
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.UserPrometheusPort[0], "userPrometheusPort default listen port")
|
||||
flag.Parse()
|
||||
fmt.Println("start user rpc server, port: ", *rpcPort, "OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
fmt.Println("start user rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
||||
rpcServer := user.NewUserServer(*rpcPort)
|
||||
go func() {
|
||||
err := promePkg.StartPromeSrv(*prometheusPort)
|
||||
|
||||
+122
-69
@@ -9,13 +9,12 @@ etcd:
|
||||
etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可
|
||||
userName:
|
||||
password:
|
||||
|
||||
k8sMod: false #开启k8s模式 使用pod里面环境变量请求services调用服务 而并非etcd
|
||||
secret:
|
||||
|
||||
mysql:
|
||||
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
|
||||
dbMysqlUserName: root #mysql用户名,建议修改
|
||||
dbMysqlPassword: openIM # mysql密码,建议修改
|
||||
dbMysqlUserName: #mysql用户名,建议修改
|
||||
dbMysqlPassword: # mysql密码,建议修改
|
||||
dbMysqlDatabaseName: openIM_v2 #默认即可
|
||||
dbTableName: eMsg #默认即可
|
||||
dbMsgTableNum: 1
|
||||
@@ -34,10 +33,10 @@ mongo:
|
||||
dbDatabase: openIM #mongo db 默认即可
|
||||
dbSource: admin
|
||||
dbUserName: #mongo用户名,建议先不设置
|
||||
dbPassword: #mongo密码,建议先不设置
|
||||
dbPassword: #mongo密码,建议先不设置
|
||||
dbMaxPoolSize: 100
|
||||
dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改
|
||||
chatRecordsClearTime: "* * * * *" # 每天凌晨3点清除消息,该配置和linux定时任务一样, 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
|
||||
chatRecordsClearTime: "0 3 * * *" # 每天凌晨3点清除消息,该配置和linux定时任务一样, 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
|
||||
|
||||
redis:
|
||||
dbAddress: [ 127.0.0.1:16379 ] #redis地址 单机时,填写一个地址即可,使用redis集群时候,填写集群中多个节点地址(主从地址都可以填写,增加容灾能力),默认即可
|
||||
@@ -45,7 +44,7 @@ redis:
|
||||
dbMaxActive: 0
|
||||
dbIdleTimeout: 120
|
||||
dbUserName: #only redis version 6.0+ need username
|
||||
dbPassWord: openIM #redis密码 建议修改
|
||||
dbPassWord: #redis密码 建议修改
|
||||
enableCluster: false #如果外部redis以集群方式启动,需要打开此开关
|
||||
|
||||
kafka:
|
||||
@@ -63,12 +62,15 @@ kafka:
|
||||
ms2pschat:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "ms2ps_chat" #消息push
|
||||
msgtomodify:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "msg_to_modify"
|
||||
consumergroupid:
|
||||
msgToTransfer: mongo
|
||||
msgToMongo: mongo_ex
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
|
||||
msgToModify: modify
|
||||
|
||||
|
||||
#---------------Internal service configuration---------------------#
|
||||
@@ -113,44 +115,42 @@ sdk:
|
||||
#对象存储服务,以下配置二选一,目前支持两种,腾讯云和minio,二者配置好其中一种即可(如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器)
|
||||
credential: #腾讯cos,发送图片、视频、文件时需要,请自行申请后替换,必须修改
|
||||
tencent:
|
||||
appID: 1302656840
|
||||
region: ap-chengdu
|
||||
bucket: echat-1302656840
|
||||
secretID: AKIDGNYVChzIQinu7QEgtNp0hnNgqcV8vZTC1
|
||||
secretKey: kz15vW83qM6dBUWIq681eBZA0c0vlIbe1
|
||||
appID:
|
||||
region:
|
||||
bucket:
|
||||
secretID:
|
||||
secretKey:
|
||||
minio: #MinIO 发送图片、视频、文件时需要,请自行申请后替换,必须修改。 客户端初始化InitSDK,中 object_storage参数为minio
|
||||
bucket: openim # 存储内容桶
|
||||
appBucket: app # 存储app的桶
|
||||
location: us-east-1
|
||||
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
|
||||
endpoint: #minio外网ip 这个ip是给客户端访问的
|
||||
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
|
||||
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化,IM server连接minio走内网地址访问
|
||||
accessKeyID: user12345
|
||||
secretAccessKey: key12345
|
||||
accessKeyID:
|
||||
secretAccessKey:
|
||||
storageTime: 50 #文件在minio中保存的时间
|
||||
isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false
|
||||
ali: # ali oss
|
||||
regionID: "oss-cn-beijing"
|
||||
accessKeyID: ""
|
||||
accessKeySecret: ""
|
||||
stsEndpoint: "sts.cn-beijing.aliyun.com"
|
||||
ossEndpoint: "oss-cn-beijing.aliyuncs.com"
|
||||
bucket: "bucket1"
|
||||
finalHost: "http://bucket1.oss-cn-beijing.aliyuncs.com"
|
||||
stsDurationSeconds: 3600
|
||||
OssRoleArn: "acs:ram::xxx:role/xxx"
|
||||
regionID:
|
||||
accessKeyID:
|
||||
accessKeySecret:
|
||||
stsEndpoint:
|
||||
ossEndpoint:
|
||||
bucket:
|
||||
finalHost:
|
||||
stsDurationSeconds:
|
||||
OssRoleArn:
|
||||
aws:
|
||||
accessKeyID: 1 #AssumeRole用户关联的accessKeyID
|
||||
accessKeySecret: 2 #AssumeRole用户关联的accessKeySecrect
|
||||
region: ap-southeast-1 #分区
|
||||
bucket: ouyang #桶
|
||||
finalHost: ouyang.s3.ap-southeast-1.amazonaws.com #对外Host
|
||||
roleArn: arn:aws:iam::192209831083:role/AWS_S3_FOR_OUYANG #RoleArn
|
||||
externalId: AssumeRoleExtend #角色扩展Id
|
||||
roleSessionName: Required-AWS-ID-OPENIM #角色SESSION名称
|
||||
accessKeyID: #AssumeRole用户关联的accessKeyID
|
||||
accessKeySecret: #AssumeRole用户关联的accessKeySecrect
|
||||
region: #分区
|
||||
bucket: #桶
|
||||
finalHost: #对外Host
|
||||
roleArn: #RoleArn
|
||||
externalId: #角色扩展Id
|
||||
roleSessionName: #角色SESSION名称
|
||||
|
||||
dtm:
|
||||
serverURL: 127.0.0.1:10007
|
||||
|
||||
rpcport: #rpc服务端口 默认即可
|
||||
openImUserPort: [ 10110 ]
|
||||
@@ -216,28 +216,41 @@ longconnsvr:
|
||||
push:
|
||||
tpns: #腾讯推送,暂未测试 暂不要使用
|
||||
ios:
|
||||
accessID: 1600018281
|
||||
secretKey: 3cd68a77a95b89e5089a1aca523f318f
|
||||
accessID:
|
||||
secretKey:
|
||||
android:
|
||||
accessID: 111
|
||||
secretKey: 111
|
||||
enable: false
|
||||
accessID:
|
||||
secretKey:
|
||||
enable: false # true or false (bool)
|
||||
jpns: #极光推送 在极光后台申请后,修改以下四项,必须修改
|
||||
appKey: cf47465a368f24c659608e7e
|
||||
masterSecret: 02204efe3f3832947a236ee5
|
||||
pushUrl: "https://api.jpush.cn/v3/push"
|
||||
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
|
||||
enable: true
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushUrl:
|
||||
pushIntent:
|
||||
enable: false # true or false (bool)
|
||||
getui: #个推推送
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
pushUrl:
|
||||
masterSecret: ""
|
||||
appKey: ""
|
||||
intent: ""
|
||||
enable: false
|
||||
enable: # true or false (bool)
|
||||
channelID: ""
|
||||
channelName: ""
|
||||
channel:
|
||||
HW:
|
||||
category:
|
||||
XM:
|
||||
channelID:
|
||||
OPPO:
|
||||
channelID:
|
||||
fcm: #firebase cloud message 消息推送
|
||||
serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
|
||||
serviceAccount: #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
|
||||
enable: false
|
||||
mob: #袤博推送
|
||||
appKey: #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
|
||||
pushUrl:
|
||||
scheme:
|
||||
appSecret:
|
||||
enable: false
|
||||
|
||||
|
||||
@@ -248,7 +261,7 @@ manager:
|
||||
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
|
||||
appSysNotificationName: "系统通知"
|
||||
|
||||
secret: tuoyun
|
||||
secret:
|
||||
# 多端互踢策略
|
||||
# 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线
|
||||
multiloginpolicy: 1
|
||||
@@ -266,11 +279,11 @@ singleMessageHasReadReceiptEnable: true
|
||||
|
||||
#token config
|
||||
tokenpolicy:
|
||||
accessSecret: "open_im_server" #token生成相关,默认即可
|
||||
accessSecret: #token生成相关,默认即可
|
||||
# Token effective time day as a unit
|
||||
accessExpire: 90 #token过期时间(天) 默认即可
|
||||
accessExpire: #token过期时间(天) 默认即可
|
||||
messageverify:
|
||||
friendVerify: false
|
||||
friendVerify:
|
||||
|
||||
# c2c:
|
||||
# callbackBeforeSendMsg:
|
||||
@@ -305,7 +318,10 @@ callback:
|
||||
callbackAfterSendGroupMsg:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackWordFilter:
|
||||
callbackAfterConsumeGroupMsg:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackMsgModify:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true
|
||||
@@ -330,6 +346,26 @@ callback:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续离线推送
|
||||
callbackBeforeAddFriend:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续
|
||||
callbackBeforeCreateGroup:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续
|
||||
callbackBeforeMemberJoinGroup:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续
|
||||
callbackBeforeSetGroupMemberInfo:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续
|
||||
callbackSetMessageReactionExtensions:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续
|
||||
|
||||
|
||||
notification:
|
||||
@@ -651,6 +687,19 @@ notification:
|
||||
defaultTips:
|
||||
tips: "Remove a blocked user"
|
||||
|
||||
friendInfoUpdated:
|
||||
conversation:
|
||||
reliabilityLevel: 2
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
switch: true
|
||||
title: "friend info updated"
|
||||
desc: "friend info updated"
|
||||
ext: "friend info updated"
|
||||
defaultTips:
|
||||
tips: "friend info updated"
|
||||
|
||||
|
||||
#####################user#########################
|
||||
userInfoUpdated:
|
||||
conversation:
|
||||
@@ -726,18 +775,18 @@ demo:
|
||||
#demo对外服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
openImDemoPort: [ 10004 ]
|
||||
alismsverify: #阿里云短信配置,在阿里云申请成功后修改以下四项,enable为true则必须修改,阿里云为默认短信验证方式
|
||||
accessKeyId: LTAI5tJPkn4HuuePdiLdGqe7
|
||||
accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV
|
||||
signName: 托云信息技术
|
||||
verificationCodeTemplateCode: SMS_226810164
|
||||
accessKeyId:
|
||||
accessKeySecret:
|
||||
signName:
|
||||
verificationCodeTemplateCode:
|
||||
enable: false
|
||||
tencentsms: #腾讯云短信配置,在腾讯云申请成功后,修改以下选项,enable为true则必须修改
|
||||
appID: 2400000648
|
||||
region: "ap-singapore"
|
||||
secretID: IKIDra4JPGsFMDwQedMq42lESQBgwwgBQQAe
|
||||
secretKey: HI6fz4uUotjJdiX6QUIrAE2buxlKdgU2
|
||||
signName: ""
|
||||
verificationCodeTemplateCode: 2902877
|
||||
appID:
|
||||
region:
|
||||
secretID:
|
||||
secretKey:
|
||||
signName:
|
||||
verificationCodeTemplateCode:
|
||||
enable: true
|
||||
superCode: 666666 #超级验证码,建议修改掉,收不到短信验证码时可以用此替代
|
||||
needInvitationCode: false
|
||||
@@ -745,11 +794,11 @@ demo:
|
||||
codeTTL: 60
|
||||
useSuperCode: true
|
||||
mail: #仅支持qq邮箱,具体操作参考 https://service.mail.qq.com/cgi-bin/help?subtype=1&id=28&no=1001256 必须修改
|
||||
title: "openIM"
|
||||
senderMail: "765567899@qq.com"
|
||||
senderAuthorizationCode: "gxyausfoevlzbfag"
|
||||
smtpAddr: "smtp.qq.com"
|
||||
smtpPort: 25 #需开放此端口 出口方向
|
||||
title:
|
||||
senderMail:
|
||||
senderAuthorizationCode:
|
||||
smtpAddr:
|
||||
smtpPort: #需开放此端口 出口方向
|
||||
testDepartMentID: 001
|
||||
imAPIURL: http://127.0.0.1:10002
|
||||
onboardProcess: false # 是否开启注册流程
|
||||
@@ -758,6 +807,10 @@ demo:
|
||||
joinDepartmentGroups: false # 注册是否加部门群
|
||||
oaNotification: false # 注册是否发送OA通知
|
||||
|
||||
workMoment:
|
||||
onlyFriendCanSee: false
|
||||
|
||||
|
||||
rtc:
|
||||
signalTimeout: 35
|
||||
|
||||
@@ -777,4 +830,4 @@ prometheus:
|
||||
conversationPrometheusPort: [ 20230 ]
|
||||
cachePrometheusPort: [ 20240 ]
|
||||
realTimeCommPrometheusPort: [ 21300 ]
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 端口数量和 script/path_info.cfg msg_transfer_service_num保持一致
|
||||
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 端口数量和 script/path_info.cfg msg_transfer_service_num保持一致
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
upstream im_msg_gateway{
|
||||
server 127.0.0.1:10001; #IM消息服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_api{
|
||||
server 127.0.0.1:10002; #IM群组用户api服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_jssdk_gateway{
|
||||
server 127.0.0.1:10003; #IM jssdk服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_demo{
|
||||
server 127.0.0.1:10004; #IM demo登录注册服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream storage {
|
||||
server 127.0.0.1:10005; #MinIO服务器地址 暂时支持1台
|
||||
}
|
||||
upstream im_admin{
|
||||
server 127.0.0.1:10006; #IM admin服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_grafana{
|
||||
server 127.0.0.1:10007; #IM 统计服务器地址 docker-compose启动所在机器
|
||||
}
|
||||
upstream im_chat{
|
||||
server 127.0.0.1:10008; #IM 商业版登录注册服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_complete_admin{
|
||||
server 127.0.0.1:10009; #IM 商业版admin地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_organization{
|
||||
server 127.0.0.1:10010; #IM 商业版组织架构服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
upstream im_open_rtc{
|
||||
server 127.0.0.1:7880; #rtc 音视频通话 服务器地址 根据部署情况可指定多台
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
server_name web.rentsoft.cn; #1 web im 端 域名
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/conf.d/ssl/web.rentsoft.cn.crt; #2 证书
|
||||
ssl_certificate_key /etc/nginx/conf.d/ssl/web.rentsoft.cn.key; #3 证书
|
||||
ssl_session_timeout 5m;
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/wasm;
|
||||
gzip_vary off;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
error_page 405 =200 $uri;
|
||||
|
||||
default_type application/wasm;
|
||||
location /{ #web demo
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-Ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
root /data1/online/Pc-Web-Demo/build/; # web im静态资源存放路径
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
location /msg_gateway { #10001 ws
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_msg_gateway/;
|
||||
}
|
||||
location ^~/api/ { #10002 api
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_api/;
|
||||
}
|
||||
location /jssdk_gateway { #10003 jssdk
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_jssdk_gateway/;
|
||||
}
|
||||
location ^~/demo/ { # 10004 demo
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_demo/;
|
||||
}
|
||||
location ^~/admin/ { #10006 admin
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_admin/;
|
||||
}
|
||||
location ^~/grafana/ { #10007 prometheus
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_grafana/;
|
||||
}
|
||||
location ^~/chat/ { #10008 chat login
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_chat/;
|
||||
}
|
||||
location ^~/complete_admin/ { #10009 admin
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_complete_admin/;
|
||||
}
|
||||
location ^~/organization/ { #10010 organization
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_organization/;
|
||||
}
|
||||
location ^~/open_rtc/ { #7880 rtc
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_pass http://im_open_rtc/;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name web.rentsoft.cn ; #1 web im 端 域名
|
||||
rewrite ^(.*)$ https://${server_name}$1 permanent;
|
||||
}
|
||||
|
||||
server {
|
||||
ssl_session_timeout 5m;
|
||||
listen 443;
|
||||
server_name storage.rentsoft.cn; #1 MinIO存储域名
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/conf.d/ssl/storage.rentsoft.cn.crt; #证书
|
||||
ssl_certificate_key /etc/nginx/conf.d/ssl/storage.rentsoft.cn.key; #证书
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary off;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
location / {
|
||||
proxy_pass http://storage;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_http_version 1.1;
|
||||
client_max_body_size 8000M;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
server_name admin.rentsoft.cn; #后台管理域名
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/conf.d/ssl/admin.rentsoft.cn.crt; # 证书
|
||||
ssl_certificate_key /etc/nginx/conf.d/ssl/admin.rentsoft.cn.key; #证书
|
||||
ssl_session_timeout 5m;
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary off;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-Ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
root /data1/online/Open-IM-Admin/dist/; #管理后台web静态资源存放路径
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name admin.rentsoft.cn; #管理后台 域名
|
||||
rewrite ^(.*)$ https://${server_name}$1 permanent;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
etcd:
|
||||
userName:
|
||||
password:
|
||||
secret: openIM123 # etcd 配置密钥
|
||||
|
||||
mysql:
|
||||
dbMysqlUserName: root #mysql用户名
|
||||
dbMysqlPassword: openIM123 # mysql密码
|
||||
|
||||
mongo:
|
||||
dbUserName: root #mongo用户名
|
||||
dbPassword: openIM123 #mongo密码
|
||||
|
||||
redis:
|
||||
dbUserName:
|
||||
dbPassWord: openIM123 #redis密码
|
||||
|
||||
kafka:
|
||||
SASLUserName:
|
||||
SASLPassword:
|
||||
|
||||
credential:
|
||||
minio:
|
||||
endpoint: http://127.0.0.1:10005 #发图片视频文件需要填写
|
||||
accessKeyID: root
|
||||
secretAccessKey: openIM123
|
||||
|
||||
secret: tuoyun #建议修改
|
||||
|
||||
tokenpolicy:
|
||||
accessSecret: "open_im_server" #token生成相关 建议修改
|
||||
accessExpire: 90 #token过期时间(天) 默认即可
|
||||
|
||||
messageverify:
|
||||
friendVerify: false #发送消息是否验证好友关系 false表示不验证好友关系
|
||||
|
||||
push:
|
||||
getui:
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
masterSecret: "" #需添加
|
||||
appKey: "" #需添加
|
||||
enable: false #true启动个推推送
|
||||
|
||||
+22
-22
@@ -79,11 +79,11 @@ cmsapi:
|
||||
|
||||
credential:
|
||||
tencent:
|
||||
appID: 1302656840
|
||||
region: ap-chengdu
|
||||
bucket: echat-1302656840
|
||||
secretID: AKIDGNYVChzIQinu7QEgtNp0hnNgqcV8vZTC
|
||||
secretKey: kz15vW83qM6dBUWIq681eBZA0c0vlIbe
|
||||
appID:
|
||||
region:
|
||||
bucket:
|
||||
secretID:
|
||||
secretKey:
|
||||
|
||||
|
||||
rpcport:
|
||||
@@ -131,16 +131,16 @@ longconnsvr:
|
||||
push:
|
||||
tpns:
|
||||
ios:
|
||||
accessID: 1600018281
|
||||
secretKey: 3cd68a77a95b89e5089a1aca523f318f
|
||||
accessID:
|
||||
secretKey:
|
||||
android:
|
||||
accessID: 111
|
||||
secretKey: 111
|
||||
accessID:
|
||||
secretKey:
|
||||
jpns:
|
||||
appKey: cf47465a368f24c659608e7e
|
||||
masterSecret: 02204efe3f3832947a236ee5
|
||||
pushUrl: "https://api.jpush.cn/v3/push"
|
||||
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushUrl:
|
||||
pushIntent:
|
||||
manager:
|
||||
appManagerUid: ["openIM123456","openIM654321"]
|
||||
secrets: ["openIM1","openIM2"]
|
||||
@@ -168,16 +168,16 @@ demoswitch: true
|
||||
demo:
|
||||
openImDemoPort: [ 42233 ]
|
||||
alismsverify:
|
||||
accessKeyId: LTAI5tJPkn4HuuePdiLdGqe71
|
||||
accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV1
|
||||
signName: OpenIM Corporation
|
||||
verificationCodeTemplateCode: SMS_2268101641
|
||||
accessKeyId:
|
||||
accessKeySecret:
|
||||
signName:
|
||||
verificationCodeTemplateCode:
|
||||
superCode: 666666
|
||||
mail:
|
||||
title: "openIM"
|
||||
senderMail: "1765567899@qq.com"
|
||||
senderAuthorizationCode: "1gxyausfoevlzbfag"
|
||||
smtpAddr: "smtp.qq.com"
|
||||
smtpPort: 25
|
||||
title:
|
||||
senderMail:
|
||||
senderAuthorizationCode:
|
||||
smtpAddr:
|
||||
smtpPort:
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_admin_cms $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config", "/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: admin-cms
|
||||
image: openim/admin_cms:v2.3.0release
|
||||
image: openim/admin_cms:v2.3.8
|
||||
# imagePullPolicy: Always #每次启动都重新拉取镜像
|
||||
ports:
|
||||
- containerPort: 10200
|
||||
@@ -25,11 +25,18 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_api $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: openim/api:v2.3.0release
|
||||
image: openim/api:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10002
|
||||
@@ -25,11 +25,17 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_auth $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: auth
|
||||
image: openim/auth:v2.3.0release
|
||||
image: openim/auth:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10160
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -2,7 +2,7 @@
|
||||
source ./path_info.cfg
|
||||
|
||||
# images version
|
||||
version=v2.2.0
|
||||
version=v2.3.8
|
||||
git pull
|
||||
cd ../script/; ./build_all_service.sh
|
||||
cd ../deploy_k8s/
|
||||
|
||||
Vendored
+2
-1
@@ -12,7 +12,8 @@ ADD ./open_im_cache $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
|
||||
Vendored
+10
-4
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: cache
|
||||
image: openim/cache:v2.3.0release
|
||||
image: openim/cache:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10240
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_cms_api $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: cms-api
|
||||
image: openim/cms_api:v2.3.0release
|
||||
image: openim/cms_api:v2.3.8
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10006
|
||||
@@ -25,11 +25,17 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_conversation $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: conversation
|
||||
image: openim/conversation:v2.3.0release
|
||||
image: openim/conversation:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10230
|
||||
@@ -24,13 +24,19 @@ spec:
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_demo $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: demo
|
||||
image: openim/demo:v2.3.0release
|
||||
image: openim/demo:v2.3.8
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10004
|
||||
@@ -25,11 +25,17 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: friend
|
||||
image: openim/friend:v2.3.0release
|
||||
image: openim/friend:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10120
|
||||
@@ -25,11 +25,17 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_friend $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: group
|
||||
image: openim/group:v2.3.0release
|
||||
image: openim/group:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10150
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_group $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
6. 将rpcRegisterIP修改为空, 此地址为每个rpc注册到ETCD的地址, 置空每个rpc将会将pod地址注册到ETCD, 才能正确rpc请求(重要)
|
||||
7. 如果使用minio作为对象存储, 还需要修改minio的地址
|
||||
8. 其他如果使用离线推送,需要修改push离线推送配置
|
||||
9. 修改demo中的imAPIURL字段为openIM api的ingress或者service地址, 需要让demo的pod能正确请求到(重要)
|
||||
10. 其他非必须配置修改, 如短信,推送等
|
||||
|
||||
|
||||
### 2. 项目根目录创建im configMap到k8s openim namespace
|
||||
1. 为open-IM项目创建单独命名空间
|
||||
```
|
||||
kubectl create namespace openim
|
||||
```
|
||||
2. 在项目根目录通过config/config.yaml
|
||||
2. 修改config.yaml后在项目根目录创建configmap, config/usualConfig.yaml只需要挂载不需要修改配置
|
||||
```
|
||||
kubectl -n openim create configmap config --from-file=config/config.yaml
|
||||
kubectl -n openim create configmap openim-config --from-file=config/config.yaml
|
||||
kubectl -n openim create configmap openim-usualconfig --from-file=config/usualConfig.yaml
|
||||
```
|
||||
查看configmap
|
||||
```
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: msg
|
||||
image: openim/msg:v2.3.0release
|
||||
image: openim/msg:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10130
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_msg $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: msg-gateway
|
||||
image: openim/msg_gateway:v2.3.0release
|
||||
image: openim/msg_gateway:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- name: rpc-port
|
||||
@@ -28,11 +28,17 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_msg_gateway $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: msg-transfer
|
||||
image: openim/msg_transfer:v2.3.0release
|
||||
image: openim/msg_transfer:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: config
|
||||
@@ -23,10 +23,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_msg_transfer $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: office
|
||||
image: openim/office:v2.3.0release
|
||||
image: openim/office:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10210
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_office $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: organization
|
||||
image: openim/organization:v2.3.0release
|
||||
image: openim/organization:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10220
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_organization $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: push
|
||||
image: openim/push:v2.3.0release
|
||||
image: openim/push:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10170
|
||||
@@ -25,10 +25,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -12,7 +12,8 @@ ADD ./open_im_push $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: sdk-server
|
||||
image: openim/sdk_server:v2.3.0release
|
||||
image: openim/sdk_server:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10003
|
||||
@@ -29,7 +29,7 @@ spec:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
command: ["/Open-IM-Server/main"]
|
||||
args: ["-openIM_ws_address", "ws_addr", "-sdk_ws_port", "10001", "-openIM_api_address", "api_address", "-openIM_log_level", "6"]
|
||||
args: ["-openIM_ws_address", "ws_addr", "-sdk_ws_port", "10003", "-openIM_api_address", "api_address", "-openIM_log_level", "6"]
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_sdk_server $WORKDIR/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: user
|
||||
image: openim/user:v2.3.0release
|
||||
image: openim/user:v2.3.8
|
||||
# imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: config
|
||||
@@ -23,10 +23,16 @@ spec:
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
value: "/Open-IM-Server"
|
||||
- name: USUAL_CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: openim-config
|
||||
projected:
|
||||
sources:
|
||||
- configMap:
|
||||
name: openim-config
|
||||
- configMap:
|
||||
name: openim-usualconfig
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
@@ -11,7 +11,8 @@ ADD ./open_im_user $WORKDIR/cmd/main
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y --no-install-recommends ca-certificates curl
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
|
||||
+52
-33
@@ -1,6 +1,5 @@
|
||||
version: "3"
|
||||
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||
|
||||
version: "3"
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
@@ -9,10 +8,10 @@ services:
|
||||
- 23306:33060
|
||||
container_name: mysql
|
||||
volumes:
|
||||
- ./components/mysql/data:/var/lib/mysql
|
||||
- ${DATA_DIR}/components/mysql/data:/var/lib/mysql
|
||||
- /etc/localtime:/etc/localtime
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: openIM
|
||||
MYSQL_ROOT_PASSWORD: ${PASSWORD}
|
||||
restart: always
|
||||
|
||||
mongodb:
|
||||
@@ -20,21 +19,22 @@ services:
|
||||
ports:
|
||||
- 37017:27017
|
||||
container_name: mongo
|
||||
command: --wiredTigerCacheSizeGB 1
|
||||
command: --wiredTigerCacheSizeGB 1 --auth
|
||||
volumes:
|
||||
- ./components/mongodb/data/db:/data/db
|
||||
- ./components/mongodb/data/logs:/data/logs
|
||||
- ./components/mongodb/data/conf:/etc/mongo
|
||||
# - ./script/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
|
||||
- ${DATA_DIR}/components/mongodb/data/db:/data/db
|
||||
- ${DATA_DIR}/components/mongodb/data/logs:/data/logs
|
||||
- ${DATA_DIR}/components/mongodb/data/conf:/etc/mongo
|
||||
- ./script/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
# cache
|
||||
- wiredTigerCacheSizeGB=1
|
||||
# - MONGO_USERNAME=openIM
|
||||
# - MONGO_PASSWORD=openIM
|
||||
# - MONGO_INITDB_ROOT_USERNAME=root
|
||||
# - MONGO_INITDB_ROOT_PASSWORD=root
|
||||
# - MONGO_INITDB_DATABASE=openIM
|
||||
- MONGO_INITDB_ROOT_USERNAME=${USER}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${PASSWORD}
|
||||
- MONGO_INITDB_DATABASE=openIM
|
||||
- MONGO_USERNAME=${USER}
|
||||
- MONGO_PASSWORD=${PASSWORD}
|
||||
#
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
@@ -43,15 +43,15 @@ services:
|
||||
- 16379:6379
|
||||
container_name: redis
|
||||
volumes:
|
||||
- ./components/redis/data:/data
|
||||
- ${DATA_DIR}/components/redis/data:/data
|
||||
#redis config file
|
||||
- ./components/redis/config/redis.conf:/usr/local/redis/config/redis.conf
|
||||
- ${DATA_DIR}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
sysctls:
|
||||
net.core.somaxconn: 1024
|
||||
command: redis-server --requirepass openIM --appendonly yes
|
||||
command: redis-server --requirepass ${PASSWORD} --appendonly yes
|
||||
|
||||
|
||||
zookeeper:
|
||||
@@ -108,19 +108,20 @@ services:
|
||||
- /mnt/data:/data
|
||||
- /mnt/config:/root/.minio
|
||||
environment:
|
||||
MINIO_ROOT_USER: user12345
|
||||
MINIO_ROOT_PASSWORD: key12345
|
||||
MINIO_ROOT_USER: ${USER}
|
||||
MINIO_ROOT_PASSWORD: ${PASSWORD}
|
||||
restart: always
|
||||
command: minio server /data --console-address ':9090'
|
||||
|
||||
|
||||
open_im_server:
|
||||
image: openim/open_im_server:v2.3.2
|
||||
image: openim/open_im_server:v2.3.8
|
||||
container_name: open_im_server
|
||||
volumes:
|
||||
- ./logs:/Open-IM-Server/logs
|
||||
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||
- ./db/sdk:/Open-IM-Server/db/sdk
|
||||
- ./config/usualConfig.yaml:/Open-IM-Server/config/usualConfig.yaml
|
||||
- ${DATA_DIR}/db/sdk:/Open-IM-Server/db/sdk
|
||||
- ./script:/Open-IM-Server/script
|
||||
restart: always
|
||||
depends_on:
|
||||
@@ -137,14 +138,36 @@ services:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
open_im_enterprise:
|
||||
image: openim/open_im_enterprise:v1.0.3
|
||||
container_name: open_im_enterprise
|
||||
volumes:
|
||||
- ./logs:/Open-IM-Enterprise/logs
|
||||
- ./docker-compose_cfg/config.yaml:/Open-IM-Enterprise/config/config.yaml
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
- mongodb
|
||||
- redis
|
||||
- etcd
|
||||
- minio
|
||||
- open_im_server
|
||||
network_mode: "host"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
environment:
|
||||
CONFIG_NAME: "/Open-IM-Enterprise"
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
volumes:
|
||||
- ./docker-compose_cfg/prometheus-compose.yml:/etc/prometheus/prometheus.yml
|
||||
# - ./components/prometheus_data:/prometheus
|
||||
container_name: prometheus
|
||||
ports:
|
||||
- 9091:9091
|
||||
# ports:
|
||||
# - 9091:9091
|
||||
depends_on:
|
||||
- open_im_server
|
||||
command: --web.listen-address=:9091 --config.file="/etc/prometheus/prometheus.yml"
|
||||
@@ -153,20 +176,17 @@ services:
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
volumes:
|
||||
# - ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json
|
||||
# - ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
|
||||
- ./docker-compose_cfg/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
|
||||
- ./docker-compose_cfg/grafana.ini:/etc/grafana/grafana.ini
|
||||
# - ./docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
# - ./components/grafana:/var/lib/grafana
|
||||
- ./docker-compose_cfg/grafana.db:/var/lib/grafana/grafana.db
|
||||
- ./docker-compose_cfg/node-exporter-full_rev1.json:/var/lib/grafana/dashboards/node-exporter-full_rev1.json
|
||||
container_name: grafana
|
||||
ports:
|
||||
- 10007:10007
|
||||
# ports:
|
||||
# - 10007:10007
|
||||
depends_on:
|
||||
- prometheus
|
||||
network_mode: "host"
|
||||
privileged: true
|
||||
user: root
|
||||
# -rw-r-----
|
||||
|
||||
node-exporter:
|
||||
image: quay.io/prometheus/node-exporter
|
||||
@@ -174,4 +194,3 @@ services:
|
||||
restart: always
|
||||
ports:
|
||||
- "9100:9100"
|
||||
# command: --collector.ENTER-THE-NAME-OF-COLLECTOR
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#---------------Infrastructure configuration---------------------#
|
||||
etcd:
|
||||
etcdSchema: openim #默认即可
|
||||
etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可
|
||||
userName:
|
||||
password:
|
||||
secret: openIM123
|
||||
|
||||
mysql:
|
||||
dbMysqlDatabaseName: admin_chat # 数据库名字 默认即可
|
||||
|
||||
# 默认管理员账号
|
||||
admin:
|
||||
defaultAccount:
|
||||
account: [ "admin1", "admin2" ]
|
||||
defaultPassword: [ "password1", "password2" ]
|
||||
openIMUserID: [ "openIM123456", "openIMAdmin" ]
|
||||
faceURL: [ "", "" ]
|
||||
nickname: [ "admin1", "admin2" ]
|
||||
level: [ 1, 100 ]
|
||||
|
||||
|
||||
adminapi:
|
||||
openImAdminApiPort: [ 10009 ] #管理后台api服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
chatapi:
|
||||
openImChatApiPort: [ 10008 ] #登录注册,默认即可,需要开放此端口或做nginx转发
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
rpcport: # rpc服务端口 默认即可
|
||||
openImAdminPort: [ 30200 ]
|
||||
openImChatPort: [ 30300 ]
|
||||
|
||||
|
||||
rpcregistername: #rpc注册服务名,默认即可
|
||||
openImChatName: Chat
|
||||
openImAdminCMSName: Admin
|
||||
|
||||
chat:
|
||||
codeTTL: 300 #短信验证码有效时间(秒)
|
||||
superVerificationCode: 666666 # 超级验证码
|
||||
alismsverify: #阿里云短信配置,在阿里云申请成功后修改以下四项
|
||||
accessKeyId:
|
||||
accessKeySecret:
|
||||
signName:
|
||||
verificationCodeTemplateCode:
|
||||
|
||||
|
||||
oss:
|
||||
tempDir: enterprise-temp # 临时密钥上传的目录
|
||||
dataDir: enterprise-data # 最终存放目录
|
||||
aliyun:
|
||||
endpoint: https://oss-cn-chengdu.aliyuncs.com
|
||||
accessKeyID: ""
|
||||
accessKeySecret: ""
|
||||
bucket: ""
|
||||
tencent:
|
||||
BucketURL: ""
|
||||
serviceURL: https://cos.COS_REGION.myqcloud.com
|
||||
secretID: ""
|
||||
secretKey: ""
|
||||
sessionToken: ""
|
||||
bucket: ""
|
||||
use: "minio"
|
||||
@@ -24,12 +24,11 @@ require (
|
||||
github.com/go-playground/validator/v10 v10.11.0
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||
github.com/jinzhu/copier v0.3.4
|
||||
github.com/jinzhu/gorm v1.9.16
|
||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||
github.com/lestrrat-go/strftime v1.0.4 // indirect
|
||||
|
||||
@@ -249,8 +249,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0=
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@@ -368,8 +368,6 @@ github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZ
|
||||
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
|
||||
github.com/jinzhu/copier v0.3.4 h1:mfU6jI9PtCeUjkjQ322dlff9ELjGDu975C2p/nrubVI=
|
||||
github.com/jinzhu/copier v0.3.4/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
||||
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
|
||||
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd script ;
|
||||
chmod +x *.sh ;
|
||||
./env_check.sh;
|
||||
cd .. ;
|
||||
docker-compose up -d;
|
||||
cd script ;
|
||||
./docker_check_service.sh
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
internet_ip=`curl ifconfig.me -s`
|
||||
echo $internet_ip
|
||||
|
||||
source .env
|
||||
echo $MINIO_ENDPOINT
|
||||
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" .env
|
||||
|
||||
fi
|
||||
|
||||
cd script ;
|
||||
chmod +x *.sh ;
|
||||
./init_pwd.sh
|
||||
./env_check.sh;
|
||||
cd .. ;
|
||||
docker-compose up -d;
|
||||
cd script ;
|
||||
./docker_check_service.sh
|
||||
@@ -199,7 +199,6 @@ func ForceLogout(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.ForceLogoutReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
func SetClientInitConfig(c *gin.Context) {
|
||||
@@ -62,11 +61,10 @@ func GetClientInitConfig(c *gin.Context) {
|
||||
}
|
||||
config, err := imdb.GetClientInitConfig()
|
||||
if err != nil {
|
||||
if !gorm.IsRecordNotFoundError(err) {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
|
||||
}
|
||||
resp.Data.DiscoverPageURL = config.DiscoverPageURL
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp ", resp)
|
||||
|
||||
@@ -370,6 +370,47 @@ func InviteUserToGroup(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
func InviteUserToGroups(c *gin.Context) {
|
||||
params := api.InviteUserToGroupsReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.InviteUserToGroupsReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.InviteUserToGroups(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp := api.InviteUserToGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroups api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 创建群组
|
||||
// @Description 创建群组
|
||||
|
||||
@@ -38,6 +38,7 @@ func SetOptions(options map[string]bool, value bool) {
|
||||
|
||||
func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
var newContent string
|
||||
options := make(map[string]bool, 5)
|
||||
var err error
|
||||
switch params.ContentType {
|
||||
case constant.Text:
|
||||
@@ -52,13 +53,20 @@ func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
fallthrough
|
||||
case constant.File:
|
||||
fallthrough
|
||||
case constant.CustomNotTriggerConversation:
|
||||
fallthrough
|
||||
case constant.CustomOnlineOnly:
|
||||
fallthrough
|
||||
case constant.AtText:
|
||||
fallthrough
|
||||
case constant.AdvancedRevoke:
|
||||
utils.SetSwitchFromOptions(options, constant.IsUnreadCount, false)
|
||||
newContent = utils.StructToJsonString(params.Content)
|
||||
case constant.Revoke:
|
||||
utils.SetSwitchFromOptions(options, constant.IsUnreadCount, false)
|
||||
newContent = params.Content["revokeMsgClientID"].(string)
|
||||
default:
|
||||
}
|
||||
options := make(map[string]bool, 5)
|
||||
if params.IsOnlineOnly {
|
||||
SetOptions(options, false)
|
||||
}
|
||||
@@ -138,12 +146,6 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
data = VideoElem{}
|
||||
case constant.File:
|
||||
data = FileElem{}
|
||||
//case constant.AtText:
|
||||
// data = AtElem{}
|
||||
//case constant.Merger:
|
||||
// data =
|
||||
//case constant.Card:
|
||||
//case constant.Location:
|
||||
case constant.Custom:
|
||||
data = CustomElem{}
|
||||
case constant.Revoke:
|
||||
@@ -157,20 +159,22 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
data = CustomElem{}
|
||||
case constant.CustomOnlineOnly:
|
||||
data = CustomElem{}
|
||||
case constant.AtText:
|
||||
data = AtElem{}
|
||||
//case constant.HasReadReceipt:
|
||||
//case constant.Typing:
|
||||
//case constant.Quote:
|
||||
default:
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||
log.Error(c.PostForm("operationID"), "contentType err", c.PostForm("content"))
|
||||
return
|
||||
}
|
||||
if err := mapstructure.WeakDecode(params.Content, &data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "content to Data struct err", err.Error())
|
||||
return
|
||||
} else if err := validate.Struct(data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "data args validate err", err.Error())
|
||||
return
|
||||
}
|
||||
@@ -178,12 +182,13 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
token := c.Request.Header.Get("token")
|
||||
claims, err := token_verify.ParseToken(token, params.OperationID)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "parse token failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||
log.NewError(params.OperationID, "parse token failed", err.Error(), token)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""})
|
||||
log.NewError(params.OperationID, "not authorized", token)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
|
||||
}
|
||||
@@ -191,13 +196,13 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
case constant.SingleChatType:
|
||||
if len(params.RecvID) == 0 {
|
||||
log.NewError(params.OperationID, "recvID is a null string")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
case constant.GroupChatType, constant.SuperGroupChatType:
|
||||
if len(params.GroupID) == 0 {
|
||||
log.NewError(params.OperationID, "groupID is a null string")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -468,9 +473,13 @@ type FileElem struct {
|
||||
FileSize int64 `mapstructure:"fileSize"`
|
||||
}
|
||||
type AtElem struct {
|
||||
Text string `mapstructure:"text"`
|
||||
AtUserList []string `mapstructure:"atUserList"`
|
||||
IsAtSelf bool `mapstructure:"isAtSelf"`
|
||||
Text string `mapstructure:"text"`
|
||||
AtUserList []string `mapstructure:"atUserList"`
|
||||
AtUsersInfo []struct {
|
||||
AtUserID string `json:"atUserID,omitempty"`
|
||||
GroupNickname string `json:"groupNickname,omitempty"`
|
||||
} `json:"atUsersInfo,omitempty"`
|
||||
IsAtSelf bool `mapstructure:"isAtSelf"`
|
||||
}
|
||||
type LocationElem struct {
|
||||
Description string `mapstructure:"description"`
|
||||
@@ -503,9 +512,10 @@ type OANotificationElem struct {
|
||||
Ex string `mapstructure:"ex" json:"ex"`
|
||||
}
|
||||
type MessageRevoked struct {
|
||||
RevokerID string `mapstructure:"notificationName" json:"revokerID" validate:"required"`
|
||||
RevokerRole int32 `mapstructure:"notificationName" json:"revokerRole" validate:"required"`
|
||||
ClientMsgID string `mapstructure:"notificationName" json:"clientMsgID" validate:"required"`
|
||||
RevokerNickname string `mapstructure:"notificationName" json:"revokerNickname"`
|
||||
SessionType int32 `mapstructure:"notificationName" json:"sessionType" validate:"required"`
|
||||
RevokerID string `mapstructure:"revokerID" json:"revokerID" validate:"required"`
|
||||
RevokerRole int32 `mapstructure:"revokerRole" json:"revokerRole" validate:"required"`
|
||||
ClientMsgID string `mapstructure:"clientMsgID" json:"clientMsgID" validate:"required"`
|
||||
RevokerNickname string `mapstructure:"revokerNickname" json:"revokerNickname"`
|
||||
SessionType int32 `mapstructure:"sessionType" json:"sessionType" validate:"required"`
|
||||
Seq uint32 `mapstructure:"seq" json:"seq" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ func DelSuperGroupMsg(c *gin.Context) {
|
||||
)
|
||||
rpcReq := &rpc.DelSuperGroupMsgReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.NewError("", "args err:", err.Error())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
utils.CopyStructFields(rpcReq, &req)
|
||||
@@ -91,7 +92,7 @@ func DelSuperGroupMsg(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + rpcReq.OpUserID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
options := make(map[string]bool, 5)
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
package msg
|
||||
|
||||
import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/msg"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SetMessageReactionExtensions(c *gin.Context) {
|
||||
var (
|
||||
req api.SetMessageReactionExtensionsReq
|
||||
resp api.SetMessageReactionExtensionsResp
|
||||
reqPb rpc.SetMessageReactionExtensionsReq
|
||||
)
|
||||
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo, reqPb.OpUserIDPlatformID = token_verify.GetUserIDAndPlatformIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := rpc.NewMsgClient(grpcConn)
|
||||
respPb, err := msgClient.SetMessageReactionExtensions(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrServer.ErrCode, "errMsg": constant.ErrServer.ErrMsg + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrCode = respPb.ErrCode
|
||||
resp.ErrMsg = respPb.ErrMsg
|
||||
resp.Data.ResultKeyValue = respPb.Result
|
||||
resp.Data.MsgFirstModifyTime = reqPb.MsgFirstModifyTime
|
||||
resp.Data.IsReact = reqPb.IsReact
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
||||
|
||||
func GetMessageListReactionExtensions(c *gin.Context) {
|
||||
var (
|
||||
req api.GetMessageListReactionExtensionsReq
|
||||
resp api.GetMessageListReactionExtensionsResp
|
||||
reqPb rpc.GetMessageListReactionExtensionsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := rpc.NewMsgClient(grpcConn)
|
||||
respPb, err := msgClient.GetMessageListReactionExtensions(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrServer.ErrCode, "errMsg": constant.ErrServer.ErrMsg + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrCode = respPb.ErrCode
|
||||
resp.ErrMsg = respPb.ErrMsg
|
||||
resp.Data = respPb.SingleMessageResult
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func AddMessageReactionExtensions(c *gin.Context) {
|
||||
var (
|
||||
req api.AddMessageReactionExtensionsReq
|
||||
resp api.AddMessageReactionExtensionsResp
|
||||
reqPb rpc.AddMessageReactionExtensionsReq
|
||||
)
|
||||
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo, reqPb.OpUserIDPlatformID = token_verify.GetUserIDAndPlatformIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := rpc.NewMsgClient(grpcConn)
|
||||
respPb, err := msgClient.AddMessageReactionExtensions(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrServer.ErrCode, "errMsg": constant.ErrServer.ErrMsg + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrCode = respPb.ErrCode
|
||||
resp.ErrMsg = respPb.ErrMsg
|
||||
resp.Data.ResultKeyValue = respPb.Result
|
||||
resp.Data.MsgFirstModifyTime = respPb.MsgFirstModifyTime
|
||||
resp.Data.IsReact = respPb.IsReact
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func DeleteMessageReactionExtensions(c *gin.Context) {
|
||||
var (
|
||||
req api.DeleteMessageReactionExtensionsReq
|
||||
resp api.DeleteMessageReactionExtensionsResp
|
||||
reqPb rpc.DeleteMessageListReactionExtensionsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := rpc.NewMsgClient(grpcConn)
|
||||
respPb, err := msgClient.DeleteMessageReactionExtensions(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": constant.ErrServer.ErrCode, "errMsg": constant.ErrServer.ErrMsg + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrCode = respPb.ErrCode
|
||||
resp.ErrMsg = respPb.ErrMsg
|
||||
resp.Data = respPb.Result
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func SendMsg(c *gin.Context) {
|
||||
}
|
||||
client := pbChat.NewMsgClient(etcdConn)
|
||||
|
||||
log.Info("", "", "api SendMsg call, api call rpc...")
|
||||
log.Info(params.OperationID, "", "api SendMsg call, api call rpc...")
|
||||
|
||||
reply, err := client.SendMsg(context.Background(), pbData)
|
||||
if err != nil {
|
||||
|
||||
@@ -657,3 +657,40 @@ func DeleteUserInDepartment(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func GetUserInOrganization(c *gin.Context) {
|
||||
req := api.GetUserInOrganizationReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
err, _ := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
reqPb := &rpc.GetUserInOrganizationReq{OperationID: req.OperationID, UserIDList: req.UserIDList}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
respPb, err := client.GetUserInOrganization(context.Background(), reqPb)
|
||||
if err != nil {
|
||||
errMsg := "rpc DeleteUserInDepartment failed " + err.Error() + reqPb.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
apiResp := api.GetUserInOrganizationResp{CommResp: api.CommResp{ErrCode: respPb.ErrCode, ErrMsg: respPb.ErrMsg}, OrganizationUserList: respPb.OrganizationUsers}
|
||||
apiResp.Data = jsonData.JsonDataList(apiResp.OrganizationUserList)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func GetUsersPublicInfo(c *gin.Context) {
|
||||
params := api.GetUsersInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.GetUserInfoReq{}
|
||||
@@ -176,7 +176,7 @@ func GetUsersPublicInfo(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -388,7 +388,8 @@ func GetSelfUserInfo(c *gin.Context) {
|
||||
func GetUsersOnlineStatus(c *gin.Context) {
|
||||
params := api.GetUsersOnlineStatusReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbRelay.GetUsersOnlineStatusReq{}
|
||||
@@ -400,7 +401,7 @@ func GetUsersOnlineStatus(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,40 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func GetUserToken(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetUserTokenRequest
|
||||
resp apiStruct.GetUserTokenResponse
|
||||
reqPb pbAdmin.GetUserTokenReq
|
||||
respPb *pbAdmin.GetUserTokenResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.UserID = req.UserID
|
||||
reqPb.PlatformID = req.PlatFormID
|
||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(reqPb.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbAdmin.NewAdminCMSClient(etcdConn)
|
||||
respPb, err := client.GetUserToken(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp.Token = respPb.Token
|
||||
resp.ExpTime = respPb.ExpTime
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": respPb.CommonResp.ErrCode, "errMsg": respPb.CommonResp.ErrMsg, "data": resp})
|
||||
}
|
||||
|
||||
// register
|
||||
func AdminLogin(c *gin.Context) {
|
||||
var (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -20,6 +21,11 @@ func JWTAuth() gin.HandlerFunc {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": errInfo})
|
||||
return
|
||||
} else {
|
||||
if !utils.IsContain(userID, config.Config.Manager.AppManagerUid) {
|
||||
c.Abort()
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "user is not admin"})
|
||||
return
|
||||
}
|
||||
log.NewInfo("0", utils.GetSelfFuncName(), "failed: ", errInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,18 @@ import (
|
||||
func NewGinRouter() *gin.Engine {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
baseRouter := gin.New()
|
||||
baseRouter.Use()
|
||||
baseRouter.Use(gin.Recovery())
|
||||
baseRouter.Use(middleware.CorsHandler())
|
||||
if config.Config.Prometheus.Enable {
|
||||
baseRouter.GET("/metrics", promePkg.PrometheusHandler())
|
||||
}
|
||||
router := baseRouter.Group("/cms")
|
||||
router.Use(middleware.CorsHandler())
|
||||
adminRouterGroup := router.Group("/admin")
|
||||
{
|
||||
adminRouterGroup.POST("/login", admin.AdminLogin)
|
||||
adminRouterGroup.Use(middleware.JWTAuth())
|
||||
adminRouterGroup.POST("/get_user_token", admin.GetUserToken)
|
||||
|
||||
adminRouterGroup.POST("/add_user_register_add_friend_id", admin.AddUserRegisterAddFriendIDList)
|
||||
adminRouterGroup.POST("/reduce_user_register_reduce_friend_id", admin.ReduceUserRegisterAddFriendIDList)
|
||||
adminRouterGroup.POST("/get_user_register_reduce_friend_id_list", admin.GetUserRegisterAddFriendIDList)
|
||||
@@ -62,6 +64,8 @@ func NewGinRouter() *gin.Engine {
|
||||
}
|
||||
userRouterGroup := r2.Group("/user")
|
||||
{
|
||||
userRouterGroup.POST("/get_user_id_by_email_phone", user.GetUserIDByEmailAndPhoneNumber)
|
||||
|
||||
userRouterGroup.POST("/add_user", user.AddUser)
|
||||
userRouterGroup.POST("/unblock_user", user.UnblockUser)
|
||||
userRouterGroup.POST("/block_user", user.BlockUser)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbAdminCms "Open_IM/pkg/proto/admin_cms"
|
||||
commonPb "Open_IM/pkg/proto/sdk_ws"
|
||||
pb "Open_IM/pkg/proto/user"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -158,3 +159,38 @@ func GetBlockUsers(c *gin.Context) {
|
||||
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", resp)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": respPb.CommonResp.ErrCode, "errMsg": respPb.CommonResp.ErrMsg, "data": resp})
|
||||
}
|
||||
|
||||
func GetUserIDByEmailAndPhoneNumber(c *gin.Context) {
|
||||
var (
|
||||
req cms_api_struct.GetUserIDByEmailAndPhoneNumberRequest
|
||||
resp cms_api_struct.GetUserIDByEmailAndPhoneNumberResponse
|
||||
reqPb pbAdminCms.GetUserIDByEmailAndPhoneNumberReq
|
||||
respPb *pbAdminCms.GetUserIDByEmailAndPhoneNumberResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "ShouldBindQuery failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.Email = req.Email
|
||||
reqPb.PhoneNumber = req.PhoneNumber
|
||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||
log.NewError(reqPb.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbAdminCms.NewAdminCMSClient(etcdConn)
|
||||
respPb, err := client.GetUserIDByEmailAndPhoneNumber(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "rpc failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp.UserIDList = respPb.UserIDList
|
||||
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", resp)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": respPb.CommonResp.ErrCode, "errMsg": respPb.CommonResp.ErrMsg, "data": resp})
|
||||
}
|
||||
|
||||
+119
-74
@@ -7,34 +7,34 @@ import (
|
||||
"Open_IM/pkg/common/log"
|
||||
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
goRedis "github.com/go-redis/redis/v8"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"math"
|
||||
)
|
||||
|
||||
const oldestList = 0
|
||||
const newestList = -1
|
||||
|
||||
func ResetUserGroupMinSeq(operationID, groupID string, userIDList []string) error {
|
||||
var delMsgIDList [][2]interface{}
|
||||
minSeq, err := deleteMongoMsg(operationID, groupID, oldestList, &delMsgIDList)
|
||||
var delStruct delMsgRecursionStruct
|
||||
minSeq, err := deleteMongoMsg(operationID, groupID, oldestList, &delStruct)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), groupID, "deleteMongoMsg failed")
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
if minSeq == 0 {
|
||||
return nil
|
||||
}
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "delMsgIDList:", delMsgIDList, "minSeq", minSeq)
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "delMsgIDList:", delStruct, "minSeq", minSeq)
|
||||
for _, userID := range userIDList {
|
||||
userMinSeq, err := db.DB.GetGroupUserMinSeq(groupID, userID)
|
||||
if err != nil && err != goRedis.Nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "GetGroupUserMinSeq failed", groupID, userID, err.Error())
|
||||
continue
|
||||
}
|
||||
if userMinSeq > uint64(minSeq) {
|
||||
err = db.DB.SetGroupUserMinSeq(groupID, userID, userMinSeq)
|
||||
} else {
|
||||
if userMinSeq < uint64(minSeq) {
|
||||
err = db.DB.SetGroupUserMinSeq(groupID, userID, uint64(minSeq))
|
||||
}
|
||||
if err != nil {
|
||||
@@ -45,26 +45,36 @@ func ResetUserGroupMinSeq(operationID, groupID string, userIDList []string) erro
|
||||
}
|
||||
|
||||
func DeleteMongoMsgAndResetRedisSeq(operationID, userID string) error {
|
||||
var delMsgIDList [][2]interface{}
|
||||
minSeq, err := deleteMongoMsg(operationID, userID, oldestList, &delMsgIDList)
|
||||
var delStruct delMsgRecursionStruct
|
||||
minSeq, err := deleteMongoMsg(operationID, userID, oldestList, &delStruct)
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
if minSeq == 0 {
|
||||
return nil
|
||||
}
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "delMsgIDMap: ", delMsgIDList, "minSeq", minSeq)
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "delMsgIDStruct: ", delStruct, "minSeq", minSeq)
|
||||
|
||||
userCurrentMinSeq, err := db.DB.GetUserMinSeq(userID)
|
||||
if err != nil && err != goRedis.Nil {
|
||||
return err
|
||||
}
|
||||
userCurrentMaxSeq, err := db.DB.GetUserMaxSeq(userID)
|
||||
if err != nil && err != goRedis.Nil {
|
||||
return err
|
||||
}
|
||||
if userCurrentMinSeq > userCurrentMaxSeq {
|
||||
minSeq = uint32(userCurrentMaxSeq)
|
||||
}
|
||||
|
||||
err = db.DB.SetUserMinSeq(userID, minSeq)
|
||||
return err
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
|
||||
func delMongoMsgs(operationID string, delMsgIDList *[][2]interface{}) error {
|
||||
if len(*delMsgIDList) > 0 {
|
||||
var IDList []string
|
||||
for _, v := range *delMsgIDList {
|
||||
IDList = append(IDList, v[0].(string))
|
||||
}
|
||||
err := db.DB.DelMongoMsgs(IDList)
|
||||
// del list
|
||||
func delMongoMsgsPhysical(uidList []string) error {
|
||||
if len(uidList) > 0 {
|
||||
err := db.DB.DelMongoMsgs(uidList)
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "DelMongoMsgs failed")
|
||||
}
|
||||
@@ -72,93 +82,128 @@ func delMongoMsgs(operationID string, delMsgIDList *[][2]interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// recursion
|
||||
func deleteMongoMsg(operationID string, ID string, index int64, delMsgIDList *[][2]interface{}) (uint32, error) {
|
||||
// 从最旧的列表开始找
|
||||
type delMsgRecursionStruct struct {
|
||||
minSeq uint32
|
||||
delUidList []string
|
||||
}
|
||||
|
||||
func (d *delMsgRecursionStruct) getSetMinSeq() uint32 {
|
||||
return d.minSeq
|
||||
}
|
||||
|
||||
// index 0....19(del) 20...69
|
||||
// seq 70
|
||||
// set minSeq 21
|
||||
// recursion 删除list并且返回设置的最小seq
|
||||
func deleteMongoMsg(operationID string, ID string, index int64, delStruct *delMsgRecursionStruct) (uint32, error) {
|
||||
// find from oldest list
|
||||
msgs, err := db.DB.GetUserMsgListByIndex(ID, index)
|
||||
if err != nil || msgs.UID == "" {
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "GetUserMsgListByIndex failed", err.Error(), index, ID)
|
||||
if err == db.ErrMsgListNotExist {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "ID:", ID, "index:", index, err.Error())
|
||||
} else {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "GetUserMsgListByIndex failed", err.Error(), index, ID)
|
||||
}
|
||||
}
|
||||
return getDelMaxSeqByIDList(*delMsgIDList), delMongoMsgs(operationID, delMsgIDList)
|
||||
// 获取报错,或者获取不到了,物理删除并且返回seq
|
||||
err = delMongoMsgsPhysical(delStruct.delUidList)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return delStruct.getSetMinSeq(), nil
|
||||
}
|
||||
log.NewDebug(operationID, "ID:", ID, "index:", index, "uid:", msgs.UID, "len:", len(msgs.Msg))
|
||||
if len(msgs.Msg) > db.GetSingleGocMsgNum() {
|
||||
log.NewWarn(operationID, utils.GetSelfFuncName(), "msgs too large", len(msgs.Msg), msgs.UID)
|
||||
}
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "get msgs: ", msgs.UID)
|
||||
for i, msg := range msgs.Msg {
|
||||
// 找到列表中不需要删除的消息了
|
||||
if utils.GetCurrentTimestampByMill() < msg.SendTime+int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000 {
|
||||
if err := delMongoMsgs(operationID, delMsgIDList); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
minSeq := getDelMaxSeqByIDList(*delMsgIDList)
|
||||
if i > 0 {
|
||||
msgPb := &server_api_params.MsgData{}
|
||||
err = proto.Unmarshal(msg.Msg, msgPb)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), ID, index)
|
||||
} else {
|
||||
err = db.DB.ReplaceMsgToBlankByIndex(msgs.UID, i-1)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), msgs.UID, i)
|
||||
return minSeq, nil
|
||||
}
|
||||
minSeq = msgPb.Seq
|
||||
}
|
||||
}
|
||||
return minSeq, nil
|
||||
}
|
||||
}
|
||||
if len(msgs.Msg) > 0 {
|
||||
msgPb := &server_api_params.MsgData{}
|
||||
err = proto.Unmarshal(msgs.Msg[len(msgs.Msg)-1].Msg, msgPb)
|
||||
if msgs.Msg[len(msgs.Msg)-1].SendTime+(int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000) < utils.GetCurrentTimestampByMill() && msgListIsFull(msgs) {
|
||||
delStruct.delUidList = append(delStruct.delUidList, msgs.UID)
|
||||
lastMsgPb := &server_api_params.MsgData{}
|
||||
err = proto.Unmarshal(msgs.Msg[len(msgs.Msg)-1].Msg, lastMsgPb)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), len(msgs.Msg)-1, msgs.UID)
|
||||
return 0, utils.Wrap(err, "proto.Unmarshal failed")
|
||||
}
|
||||
*delMsgIDList = append(*delMsgIDList, [2]interface{}{msgs.UID, msgPb.Seq})
|
||||
delStruct.minSeq = lastMsgPb.Seq + 1
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), msgs.UID, "add to delUidList", "minSeq", lastMsgPb.Seq+1)
|
||||
} else {
|
||||
var hasMarkDelFlag bool
|
||||
for index, msg := range msgs.Msg {
|
||||
if msg.SendTime == 0 {
|
||||
continue
|
||||
}
|
||||
msgPb := &server_api_params.MsgData{}
|
||||
err = proto.Unmarshal(msg.Msg, msgPb)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), len(msgs.Msg)-1, msgs.UID)
|
||||
return 0, utils.Wrap(err, "proto.Unmarshal failed")
|
||||
}
|
||||
if utils.GetCurrentTimestampByMill() > msg.SendTime+(int64(config.Config.Mongo.DBRetainChatRecords)*24*60*60*1000) {
|
||||
msgPb.Status = constant.MsgDeleted
|
||||
bytes, _ := proto.Marshal(msgPb)
|
||||
msgs.Msg[index].Msg = bytes
|
||||
msgs.Msg[index].SendTime = 0
|
||||
hasMarkDelFlag = true
|
||||
} else {
|
||||
if err := delMongoMsgsPhysical(delStruct.delUidList); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if hasMarkDelFlag {
|
||||
log.NewInfo(operationID, ID, "hasMarkDelFlag", "index:", index, "msgPb:", msgPb, msgs.UID)
|
||||
if err := db.DB.UpdateOneMsgList(msgs); err != nil {
|
||||
return delStruct.getSetMinSeq(), utils.Wrap(err, "")
|
||||
}
|
||||
}
|
||||
return msgPb.Seq, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
// 没有找到 代表需要全部删除掉 继续递归查找下一个比较旧的列表
|
||||
seq, err := deleteMongoMsg(operationID, utils.GetSelfFuncName(), index+1, delMsgIDList)
|
||||
if err != nil {
|
||||
return 0, utils.Wrap(err, "deleteMongoMsg failed")
|
||||
}
|
||||
return seq, nil
|
||||
log.NewDebug(operationID, ID, "continue to", delStruct)
|
||||
// 继续递归 index+1
|
||||
seq, err := deleteMongoMsg(operationID, ID, index+1, delStruct)
|
||||
return seq, utils.Wrap(err, "deleteMongoMsg failed")
|
||||
}
|
||||
|
||||
func getDelMaxSeqByIDList(delMsgIDList [][2]interface{}) uint32 {
|
||||
if len(delMsgIDList) == 0 {
|
||||
return 0
|
||||
func msgListIsFull(chat *db.UserChat) bool {
|
||||
index, _ := strconv.Atoi(strings.Split(chat.UID, ":")[1])
|
||||
if index == 0 {
|
||||
if len(chat.Msg) >= 4999 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return delMsgIDList[len(delMsgIDList)-1][1].(uint32)
|
||||
if len(chat.Msg) >= 5000 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func checkMaxSeqWithMongo(operationID, ID string, diffusionType int) error {
|
||||
var maxSeq uint64
|
||||
var seqRedis uint64
|
||||
var err error
|
||||
if diffusionType == constant.WriteDiffusion {
|
||||
maxSeq, err = db.DB.GetUserMaxSeq(ID)
|
||||
seqRedis, err = db.DB.GetUserMaxSeq(ID)
|
||||
} else {
|
||||
maxSeq, err = db.DB.GetGroupMaxSeq(ID)
|
||||
seqRedis, err = db.DB.GetGroupMaxSeq(ID)
|
||||
}
|
||||
if err != nil {
|
||||
if err == goRedis.Nil {
|
||||
return nil
|
||||
|
||||
} else {
|
||||
return utils.Wrap(err, "GetUserMaxSeq failed")
|
||||
}
|
||||
return utils.Wrap(err, "GetUserMaxSeq failed")
|
||||
}
|
||||
msg, err := db.DB.GetNewestMsg(ID)
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "GetNewestMsg failed")
|
||||
}
|
||||
msgPb := &server_api_params.MsgData{}
|
||||
err = proto.Unmarshal(msg.Msg, msgPb)
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "")
|
||||
if msg == nil {
|
||||
return nil
|
||||
}
|
||||
if math.Abs(float64(msgPb.Seq-uint32(maxSeq))) > 10 {
|
||||
log.NewWarn(operationID, utils.GetSelfFuncName(), maxSeq, msgPb.Seq, "redis maxSeq is different with msg.Seq")
|
||||
if math.Abs(float64(msg.Seq-uint32(seqRedis))) > 10 {
|
||||
log.NewWarn(operationID, utils.GetSelfFuncName(), "seqMongo, seqRedis", msg.Seq, seqRedis, ID, "redis maxSeq is different with msg.Seq > 10", "status: ", msg.Status, msg.SendTime)
|
||||
} else {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "seqMongo, seqRedis", msg.Seq, seqRedis, ID, "seq and msg OK", "status:", msg.Status, msg.SendTime)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package cronTask
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db"
|
||||
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
redisClient *redis.Client
|
||||
mongoClient *mongo.Collection
|
||||
)
|
||||
|
||||
func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *db.UserChat {
|
||||
chat := &db.UserChat{UID: userID + ":" + strconv.Itoa(int(index))}
|
||||
for i := startSeq; i <= stopSeq; i++ {
|
||||
msg := server_api_params.MsgData{
|
||||
SendID: "sendID1",
|
||||
RecvID: "recvID1",
|
||||
GroupID: "",
|
||||
ClientMsgID: "xxx",
|
||||
ServerMsgID: "xxx",
|
||||
SenderPlatformID: 1,
|
||||
SenderNickname: "testNickName",
|
||||
SenderFaceURL: "testFaceURL",
|
||||
SessionType: 1,
|
||||
MsgFrom: 100,
|
||||
ContentType: 101,
|
||||
Content: []byte("testFaceURL"),
|
||||
Seq: uint32(i),
|
||||
SendTime: time.Now().Unix(),
|
||||
CreateTime: time.Now().Unix(),
|
||||
Status: 1,
|
||||
}
|
||||
bytes, _ := proto.Marshal(&msg)
|
||||
var sendTime int64
|
||||
if i <= delSeq {
|
||||
sendTime = 10000
|
||||
} else {
|
||||
sendTime = utils.GetCurrentTimestampByMill()
|
||||
}
|
||||
chat.Msg = append(chat.Msg, db.MsgInfo{SendTime: int64(sendTime), Msg: bytes})
|
||||
}
|
||||
return chat
|
||||
}
|
||||
|
||||
func SetUserMaxSeq(userID string, seq int) error {
|
||||
return redisClient.Set(context.Background(), "REDIS_USER_INCR_SEQ"+userID, seq, 0).Err()
|
||||
}
|
||||
|
||||
func GetUserMinSeq(userID string) (uint64, error) {
|
||||
key := "REDIS_USER_MIN_SEQ:" + userID
|
||||
seq, err := redisClient.Get(context.Background(), key).Result()
|
||||
return uint64(utils.StringToInt(seq)), err
|
||||
}
|
||||
|
||||
func CreateChat(userChat *db.UserChat) error {
|
||||
_, err := mongoClient.InsertOne(context.Background(), userChat)
|
||||
return err
|
||||
}
|
||||
|
||||
func DelChat(uid string, index int) error {
|
||||
_, err := mongoClient.DeleteOne(context.Background(), bson.M{"uid": uid + ":" + strconv.Itoa(index)})
|
||||
return err
|
||||
}
|
||||
|
||||
func TestDeleteMongoMsgAndResetRedisSeq(t *testing.T) {
|
||||
operationID := getCronTaskOperationID()
|
||||
redisClient = redis.NewClient(&redis.Options{
|
||||
Addr: "127.0.0.1:16379",
|
||||
Password: "openIM123", // no password set
|
||||
DB: 0, // use default DB
|
||||
})
|
||||
mongoUri := fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin",
|
||||
"root", "openIM123", "127.0.0.1:37017",
|
||||
"openIM", 100)
|
||||
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(mongoUri))
|
||||
mongoClient = client.Database("openIM").Collection("msg")
|
||||
testUID1 := "test_del_id1"
|
||||
err = DelChat(testUID1, 0)
|
||||
err = SetUserMaxSeq(testUID1, 600)
|
||||
userChat := GenUserChat(1, 600, 200, 0, testUID1)
|
||||
err = CreateChat(userChat)
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID1); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID1)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID1, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID1)
|
||||
}
|
||||
minSeq, err := GetUserMinSeq(testUID1)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID1, err.Error())
|
||||
}
|
||||
if minSeq != 201 {
|
||||
t.Error("test1 is not the same", "minSeq:", minSeq, "targetSeq", 201)
|
||||
}
|
||||
|
||||
testUID2 := "test_del_id2"
|
||||
err = DelChat(testUID2, 0)
|
||||
err = DelChat(testUID2, 1)
|
||||
err = SetUserMaxSeq(testUID2, 7000)
|
||||
userChat = GenUserChat(1, 4999, 5000, 0, testUID2)
|
||||
userChat2 := GenUserChat(5000, 7000, 6000, 1, testUID2)
|
||||
err = CreateChat(userChat)
|
||||
err = CreateChat(userChat2)
|
||||
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID2); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID2)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID2, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID2)
|
||||
}
|
||||
minSeq, err = GetUserMinSeq(testUID2)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID2, err.Error())
|
||||
}
|
||||
if minSeq != 6001 {
|
||||
t.Error("test2 is not the same", "minSeq:", minSeq, "targetSeq", 6001)
|
||||
}
|
||||
|
||||
testUID3 := "test_del_id3"
|
||||
err = DelChat(testUID3, 0)
|
||||
err = SetUserMaxSeq(testUID3, 4999)
|
||||
userChat = GenUserChat(1, 4999, 5000, 0, testUID3)
|
||||
err = CreateChat(userChat)
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID3); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID3)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID3, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID3)
|
||||
}
|
||||
minSeq, err = GetUserMinSeq(testUID3)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID3, err.Error())
|
||||
}
|
||||
if minSeq != 5000 {
|
||||
t.Error("test3 is not the same", "minSeq:", minSeq, "targetSeq", 5000)
|
||||
}
|
||||
|
||||
testUID4 := "test_del_id4"
|
||||
err = DelChat(testUID4, 0)
|
||||
err = DelChat(testUID4, 1)
|
||||
err = DelChat(testUID4, 2)
|
||||
err = SetUserMaxSeq(testUID4, 12000)
|
||||
userChat = GenUserChat(1, 4999, 5000, 0, testUID4)
|
||||
userChat2 = GenUserChat(5000, 9999, 10000, 1, testUID4)
|
||||
userChat3 := GenUserChat(10000, 12000, 11000, 2, testUID4)
|
||||
err = CreateChat(userChat)
|
||||
err = CreateChat(userChat2)
|
||||
err = CreateChat(userChat3)
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID4); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID4)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID4, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID4)
|
||||
}
|
||||
minSeq, err = GetUserMinSeq(testUID4)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID4, err.Error())
|
||||
}
|
||||
if minSeq != 11001 {
|
||||
t.Error("test4 is not the same", "minSeq:", minSeq, "targetSeq", 11001)
|
||||
}
|
||||
|
||||
testUID5 := "test_del_id5"
|
||||
err = DelChat(testUID5, 0)
|
||||
err = DelChat(testUID5, 1)
|
||||
err = SetUserMaxSeq(testUID5, 9999)
|
||||
userChat = GenUserChat(1, 4999, 5000, 0, testUID5)
|
||||
userChat2 = GenUserChat(5000, 9999, 10000, 1, testUID5)
|
||||
err = CreateChat(userChat)
|
||||
err = CreateChat(userChat2)
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID5); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID4)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID5, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID5)
|
||||
}
|
||||
minSeq, err = GetUserMinSeq(testUID5)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID5, err.Error())
|
||||
}
|
||||
if minSeq != 10000 {
|
||||
t.Error("test5 is not the same", "minSeq:", minSeq, "targetSeq", 10000)
|
||||
}
|
||||
|
||||
testUID6 := "test_del_id6"
|
||||
err = DelChat(testUID5, 0)
|
||||
err = DelChat(testUID5, 1)
|
||||
err = DelChat(testUID5, 2)
|
||||
err = DelChat(testUID5, 3)
|
||||
userChat = GenUserChat(1, 4999, 5000, 0, testUID6)
|
||||
userChat2 = GenUserChat(5000, 9999, 10000, 1, testUID6)
|
||||
userChat3 = GenUserChat(10000, 14999, 13000, 2, testUID6)
|
||||
userChat4 := GenUserChat(15000, 19999, 0, 3, testUID6)
|
||||
err = CreateChat(userChat)
|
||||
err = CreateChat(userChat2)
|
||||
err = CreateChat(userChat3)
|
||||
err = CreateChat(userChat4)
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, testUID6); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID6)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, testUID6, constant.WriteDiffusion); err != nil {
|
||||
t.Error("checkMaxSeqWithMongo failed", testUID6)
|
||||
}
|
||||
minSeq, err = GetUserMinSeq(testUID6)
|
||||
if err != nil {
|
||||
t.Error("err is not nil", testUID6, err.Error())
|
||||
}
|
||||
if minSeq != 13001 {
|
||||
t.Error("test3 is not the same", "minSeq:", minSeq, "targetSeq", 13001)
|
||||
}
|
||||
}
|
||||
@@ -8,70 +8,94 @@ import (
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"fmt"
|
||||
"github.com/robfig/cron/v3"
|
||||
"time"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
)
|
||||
|
||||
const cronTaskOperationID = "cronTaskOperationID-"
|
||||
|
||||
func StartCronTask() {
|
||||
func StartCronTask(userID, workingGroupID string) {
|
||||
log.NewPrivateLog("cron")
|
||||
log.NewInfo(utils.OperationIDGenerator(), "start cron task")
|
||||
c := cron.New()
|
||||
fmt.Println("config", config.Config.Mongo.ChatRecordsClearTime)
|
||||
_, err := c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, func() {
|
||||
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
|
||||
fmt.Println("cron config", config.Config.Mongo.ChatRecordsClearTime)
|
||||
if userID != "" {
|
||||
operationID := getCronTaskOperationID()
|
||||
log.NewInfo(operationID, "====================== start del cron task ======================")
|
||||
userIDList, err := im_mysql_model.SelectAllUserID()
|
||||
if err == nil {
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "userIDList: ", userIDList)
|
||||
for _, userID := range userIDList {
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, userID); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), userID)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, userID, constant.WriteDiffusion); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), userID, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
|
||||
workingGroupIDList, err := im_mysql_model.GetGroupIDListByGroupType(constant.WorkingGroup)
|
||||
if err == nil {
|
||||
for _, groupID := range workingGroupIDList {
|
||||
userIDList, err = rocksCache.GetGroupMemberIDListFromCache(groupID)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID)
|
||||
continue
|
||||
}
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "groupID:", groupID, "userIDList:", userIDList)
|
||||
if err := ResetUserGroupMinSeq(operationID, groupID, userIDList); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID, userIDList)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, groupID, constant.ReadDiffusion); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), groupID, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(operationID, "====================== start del cron finished ======================")
|
||||
})
|
||||
StartClearMsg(operationID, []string{userID})
|
||||
}
|
||||
if workingGroupID != "" {
|
||||
operationID := getCronTaskOperationID()
|
||||
StartClearWorkingGroupMsg(operationID, []string{workingGroupID})
|
||||
}
|
||||
if userID != "" || workingGroupID != "" {
|
||||
fmt.Println("clear msg finished")
|
||||
return
|
||||
}
|
||||
c := cron.New()
|
||||
_, err := c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, ClearAll)
|
||||
if err != nil {
|
||||
fmt.Println("start cron failed", err.Error())
|
||||
fmt.Println("start cron failed", err.Error(), config.Config.Mongo.ChatRecordsClearTime)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.Start()
|
||||
fmt.Println("start cron task success")
|
||||
for {
|
||||
time.Sleep(time.Second)
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func getCronTaskOperationID() string {
|
||||
return cronTaskOperationID + utils.OperationIDGenerator()
|
||||
}
|
||||
|
||||
func ClearAll() {
|
||||
operationID := getCronTaskOperationID()
|
||||
log.NewInfo(operationID, "====================== start del cron task ======================")
|
||||
var err error
|
||||
userIDList, err := im_mysql_model.SelectAllUserID()
|
||||
if err == nil {
|
||||
StartClearMsg(operationID, userIDList)
|
||||
} else {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
|
||||
// working group msg clear
|
||||
workingGroupIDList, err := im_mysql_model.GetGroupIDListByGroupType(constant.WorkingGroup)
|
||||
if err == nil {
|
||||
StartClearWorkingGroupMsg(operationID, workingGroupIDList)
|
||||
} else {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
|
||||
log.NewInfo(operationID, "====================== start del cron finished ======================")
|
||||
}
|
||||
|
||||
func StartClearMsg(operationID string, userIDList []string) {
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "userIDList: ", userIDList)
|
||||
for _, userID := range userIDList {
|
||||
if err := DeleteMongoMsgAndResetRedisSeq(operationID, userID); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), userID)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, userID, constant.WriteDiffusion); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), userID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func StartClearWorkingGroupMsg(operationID string, workingGroupIDList []string) {
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "workingGroupIDList: ", workingGroupIDList)
|
||||
for _, groupID := range workingGroupIDList {
|
||||
userIDList, err := rocksCache.GetGroupMemberIDListFromCache(groupID)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID)
|
||||
continue
|
||||
}
|
||||
log.NewDebug(operationID, utils.GetSelfFuncName(), "groupID:", groupID, "workingGroupIDList:", userIDList)
|
||||
if err := ResetUserGroupMinSeq(operationID, groupID, userIDList); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID, userIDList)
|
||||
}
|
||||
if err := checkMaxSeqWithMongo(operationID, groupID, constant.ReadDiffusion); err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), groupID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user