commit
eafb088853
@ -0,0 +1,40 @@
|
||||
# Version logging for OpenIM
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||
|
||||
<!-- END MUNGE: GENERATED_TOC -->
|
||||
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
|
||||
<a name="v3.3.1"></a>
|
||||
## [v3.3.1] - 2023-09-13
|
||||
|
||||
<a name="v3.3.1-beta.0"></a>
|
||||
## [v3.3.1-beta.0] - 2023-09-11
|
||||
|
||||
<a name="v3.3.0-rc.1"></a>
|
||||
## [v3.3.0-rc.1] - 2023-09-11
|
||||
|
||||
<a name="v3.3.0-rc.12"></a>
|
||||
## [v3.3.0-rc.12] - 2023-09-11
|
||||
|
||||
<a name="v3.3.0"></a>
|
||||
## [v3.3.0] - 2023-09-09
|
||||
|
||||
<a name="v3.3.0-rc.0"></a>
|
||||
## v3.3.0-rc.0 - 2023-09-07
|
||||
### Reverts
|
||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
||||
|
||||
### Pull Requests
|
||||
- Merge branch 'tuoyun'
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.3.1...HEAD
|
||||
[v3.3.1]: https://github.com/openimsdk/open-im-server/compare/v3.3.1-beta.0...v3.3.1
|
||||
[v3.3.1-beta.0]: https://github.com/openimsdk/open-im-server/compare/v3.3.0-rc.1...v3.3.1-beta.0
|
||||
[v3.3.0-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.3.0-rc.12...v3.3.0-rc.1
|
||||
[v3.3.0-rc.12]: https://github.com/openimsdk/open-im-server/compare/v3.3.0...v3.3.0-rc.12
|
||||
[v3.3.0]: https://github.com/openimsdk/open-im-server/compare/v3.3.0-rc.0...v3.3.0
|
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
@ -1,215 +1,504 @@
|
||||
# OpenIM enviroment
|
||||
|
||||
|
||||
## How to change the configuration
|
||||
|
||||
|
||||
**Modify the configuration files:**
|
||||
|
||||
Three ways to modify the configuration:
|
||||
|
||||
#### **1. Recommended using environment variables:**
|
||||
<!-- vscode-markdown-toc -->
|
||||
|
||||
* 1. [OpenIM Deployment Guide](#OpenIMDeploymentGuide)
|
||||
* 1.1. [Deployment Strategies](#DeploymentStrategies)
|
||||
* 1.2. [Source Code Deployment](#SourceCodeDeployment)
|
||||
* 1.3. [Docker Compose Deployment](#DockerComposeDeployment)
|
||||
* 1.4. [Environment Variable Configuration](#EnvironmentVariableConfiguration)
|
||||
* 1.4.1. [[1. Recommended using environment variables:](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#1-recommended-using-environment-variables)](#1.Recommendedusingenvironmentvariables:https:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.md1-recommended-using-environment-variables)
|
||||
* 1.4.2. [[Additional Configuration](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#additional-configuration)](#AdditionalConfigurationhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdadditional-configuration)
|
||||
* 1.4.3. [[Security Considerations](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#security-considerations)](#SecurityConsiderationshttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdsecurity-considerations)
|
||||
* 1.4.4. [[Data Management](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#data-management)](#DataManagementhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mddata-management)
|
||||
* 1.4.5. [[Monitoring and Logging](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#monitoring-and-logging)](#MonitoringandLogginghttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdmonitoring-and-logging)
|
||||
* 1.4.6. [[Troubleshooting](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#troubleshooting)](#Troubleshootinghttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdtroubleshooting)
|
||||
* 1.4.7. [[Conclusion](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#conclusion)](#Conclusionhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdconclusion)
|
||||
* 1.4.8. [[Additional Resources](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#additional-resources)](#AdditionalResourceshttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdadditional-resources)
|
||||
* 2. [Further Configuration](#FurtherConfiguration)
|
||||
* 2.1. [Image Registry Configuration](#ImageRegistryConfiguration)
|
||||
* 2.2. [OpenIM Docker Network Configuration](#OpenIMDockerNetworkConfiguration)
|
||||
* 2.3. [OpenIM Configuration](#OpenIMConfiguration)
|
||||
* 2.4. [OpenIM Chat Configuration](#OpenIMChatConfiguration)
|
||||
* 2.5. [Zookeeper Configuration](#ZookeeperConfiguration)
|
||||
* 2.6. [MySQL Configuration](#MySQLConfiguration)
|
||||
* 2.7. [MongoDB Configuration](#MongoDBConfiguration)
|
||||
* 2.8. [Tencent Cloud COS Configuration](#TencentCloudCOSConfiguration)
|
||||
* 2.9. [Alibaba Cloud OSS Configuration](#AlibabaCloudOSSConfiguration)
|
||||
* 2.10. [Redis Configuration](#RedisConfiguration)
|
||||
* 2.11. [Kafka Configuration](#KafkaConfiguration)
|
||||
* 2.12. [OpenIM Web Configuration](#OpenIMWebConfiguration)
|
||||
* 2.13. [RPC Configuration](#RPCConfiguration)
|
||||
* 2.14. [Prometheus Configuration](#PrometheusConfiguration)
|
||||
* 2.15. [Grafana Configuration](#GrafanaConfiguration)
|
||||
* 2.16. [RPC Port Configuration Variables](#RPCPortConfigurationVariables)
|
||||
* 2.17. [RPC Register Name Configuration](#RPCRegisterNameConfiguration)
|
||||
* 2.18. [Log Configuration](#LogConfiguration)
|
||||
* 2.19. [Additional Configuration Variables](#AdditionalConfigurationVariables)
|
||||
* 2.20. [Prometheus Configuration](#PrometheusConfiguration-1)
|
||||
* 2.20.1. [General Configuration](#GeneralConfiguration)
|
||||
* 2.20.2. [Service-Specific Prometheus Ports](#Service-SpecificPrometheusPorts)
|
||||
|
||||
<!-- vscode-markdown-toc-config
|
||||
numbering=true
|
||||
autoSave=true
|
||||
/vscode-markdown-toc-config -->
|
||||
<!-- /vscode-markdown-toc -->
|
||||
|
||||
|
||||
## 1. <a name='OpenIMDeploymentGuide'></a>OpenIM Deployment Guide
|
||||
|
||||
Welcome to the OpenIM Deployment Guide! OpenIM offers a versatile and robust instant messaging server, and deploying it can be achieved through various methods. This guide will walk you through the primary deployment strategies, ensuring you can set up OpenIM in a way that best suits your needs.
|
||||
|
||||
### 1.1. <a name='DeploymentStrategies'></a>Deployment Strategies
|
||||
|
||||
OpenIM provides multiple deployment methods, each tailored to different use cases and technical preferences:
|
||||
|
||||
1. **[Source Code Deployment Guide](https://doc.rentsoft.cn/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
2. **[Docker Deployment Guide](https://doc.rentsoft.cn/guides/gettingStarted/dockerCompose)**
|
||||
3. **[Kubernetes Deployment Guide](https://github.com/openimsdk/open-im-server/tree/main/deployments)**
|
||||
|
||||
While the first two methods will be our main focus, it's worth noting that the third method, Kubernetes deployment, is also viable and can be rendered via the `environment.sh` script variables.
|
||||
|
||||
### 1.2. <a name='SourceCodeDeployment'></a>Source Code Deployment
|
||||
|
||||
In the source code deployment method, the configuration generation process involves executing `make init`, which fundamentally runs the script `./scripts/init-config.sh`. This script utilizes variables defined in the [`environment.sh`](https://github.com/openimsdk/open-im-server/blob/main/scripts/install/environment.sh) script to render the [`openim.yaml`](https://github.com/openimsdk/open-im-server/blob/main/deployments/templates/openim.yaml) template file, subsequently generating the [`config.yaml`](https://github.com/openimsdk/open-im-server/blob/main/config/config.yaml) configuration file.
|
||||
|
||||
### 1.3. <a name='DockerComposeDeployment'></a>Docker Compose Deployment
|
||||
|
||||
Docker deployment offers a slightly more intricate template. Within the [openim-server](https://github.com/openimsdk/openim-docker/tree/main/openim-server) directory, multiple subdirectories correspond to various versions, each aligning with `openim-chat` as illustrated below:
|
||||
|
||||
| openim-server | openim-chat |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| [main](https://github.com/openimsdk/openim-docker/tree/main/openim-server/main) | [main](https://github.com/openimsdk/openim-docker/tree/main/openim-chat/main) |
|
||||
| [release-v3.2](https://github.com/openimsdk/openim-docker/tree/main/openim-server/release-v3.3) | [release-v3.2](https://github.com/openimsdk/openim-docker/tree/main/openim-chat/release-v1.3) |
|
||||
| [release-v3.2](https://github.com/openimsdk/openim-docker/tree/main/openim-server/release-v3.2) | [release-v3.2](https://github.com/openimsdk/openim-docker/tree/main/openim-chat/release-v1.2) |
|
||||
|
||||
Configuration file modifications can be made by specifying corresponding environment variables, for instance:
|
||||
|
||||
```bash
|
||||
export PASSWORD="openIM123" # Set password
|
||||
export USER="root" # Set username
|
||||
# Choose chat version and server version https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md, eg: main, release-v*.*
|
||||
export CHAT_BRANCH="main"
|
||||
export SERVER_BRANCH="main"
|
||||
#... Other environment variables
|
||||
# MONGO_USERNAME: This sets the MongoDB username
|
||||
# MONGO_PASSWORD: Set the MongoDB password
|
||||
# MONGO_DATABASE: Sets the MongoDB database name
|
||||
# MINIO_ENDPOINT: set the MinIO service address
|
||||
# API_URL: under network environment, set OpenIM Server API address
|
||||
export API_URL="http://127.0.0.1:10002"
|
||||
export CHAT_BRANCH="main"
|
||||
export SERVER_BRANCH="main"
|
||||
```
|
||||
|
||||
Next, update the configuration using `make init`:
|
||||
These variables are stored within the [`environment.sh`](https://github.com/OpenIMSDK/openim-docker/blob/main/scripts/install/environment.sh) configuration:
|
||||
|
||||
```bash
|
||||
make init
|
||||
readonly CHAT_BRANCH=${CHAT_BRANCH:-'main'}
|
||||
readonly SERVER_BRANCH=${SERVER_BRANCH:-'main'}
|
||||
```
|
||||
|
||||
#### **2. Modify the automation script:**
|
||||
Setting a variable, e.g., `export CHAT_BRANCH="release-v1.3"`, will prioritize `CHAT_BRANCH="release-v1.3"` as the variable value. Ultimately, the chosen image version is determined, and rendering is achieved through `make init` (or `./scripts/init-config.sh`).
|
||||
|
||||
```bash
|
||||
scripts/install/environment.sh
|
||||
```
|
||||
> Note: Direct modifications to the `config.yaml` file are also permissible without utilizing `make init`.
|
||||
|
||||
Next, update the configuration using `make init`:
|
||||
### 1.4. <a name='EnvironmentVariableConfiguration'></a>Environment Variable Configuration
|
||||
|
||||
```bash
|
||||
make init
|
||||
```
|
||||
For convenience, configuration through modifying environment variables is recommended:
|
||||
|
||||
#### 3. Modify `config.yaml` and `.env` files (but will be overwritten when using `make init` again).
|
||||
#### 1.4.1. <a name='1.Recommendedusingenvironmentvariables:https:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.md1-recommended-using-environment-variables'></a>[1. Recommended using environment variables:](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#1-recommended-using-environment-variables)
|
||||
|
||||
The `config/config.yaml` file has detailed configuration instructions for the storage components.
|
||||
+ PASSWORD
|
||||
|
||||
+ **Description**: Password for mysql, mongodb, redis, and minio.
|
||||
+ **Default**: `openIM123`
|
||||
+ Notes:
|
||||
+ Minimum password length: 8 characters.
|
||||
+ Special characters are not allowed.
|
||||
|
||||
The config file is available via [environment.sh](https://github.com/openimsdk/open-im-server/blob/main/scripts/install/environment.sh) configuration [openim.yaml](https://github.com/openimsdk/open-im-server/blob/main/deployments/templates/openim.yaml) template, and then through the `make init` to automatically generate a new configuration.
|
||||
```bash
|
||||
export PASSWORD="openIM123"
|
||||
```
|
||||
|
||||
+ USER
|
||||
|
||||
## Environment variable
|
||||
+ **Description**: Username for mysql, mongodb, redis, and minio.
|
||||
+ **Default**: `root`
|
||||
|
||||
By setting the environment variable below, You can then refresh the configuration using `make init` or `./scripts/init-config.sh`
|
||||
```bash
|
||||
export USER="root"
|
||||
```
|
||||
|
||||
##### MINIO
|
||||
+ API_URL
|
||||
|
||||
+ [MINIO DOCS](https://min.io/docs/minio/kubernetes/upstream/index.html)
|
||||
+ **Description**: API address.
|
||||
+ **Note**: If the server has an external IP, it will be automatically obtained. For internal networks, set this variable to the IP serving internally.
|
||||
|
||||
apiURL is the address of the api, the access address of the app, use s3 must be configured
|
||||
```
|
||||
export API_URL="http://ip:10002"
|
||||
```
|
||||
|
||||
#### Overview
|
||||
+ DATA_DIR
|
||||
|
||||
MinIO is an object storage server that is API compatible with Amazon S3. It's best suited for storing unstructured data such as photos, videos, log files, backups, and container/VM images. In this guide, we'll walk through the process of configuring MinIO with custom settings.
|
||||
+ **Description**: Data mount directory for components.
|
||||
+ **Default**: `/data/openim`
|
||||
|
||||
#### Default Configuration
|
||||
```bash
|
||||
export DATA_DIR="/data/openim"
|
||||
```
|
||||
|
||||
Configuration can be achieved by modifying the default variables in the `./scripts/install/environment.sh` file. However, for more flexibility and dynamic adjustments, setting environment variables is recommended.
|
||||
#### 1.4.2. <a name='AdditionalConfigurationhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdadditional-configuration'></a>[Additional Configuration](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#additional-configuration)
|
||||
|
||||
#### Setting Up the Environment Variables
|
||||
##### [MinIO Access and Secret Key](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#minio-access-and-secret-key)
|
||||
|
||||
##### IP Configuration
|
||||
To secure your MinIO server, you should set up an access key and secret key. These credentials are used to authenticate requests to your MinIO server.
|
||||
|
||||
By default, the system generates the public IP of the machine. To manually set a public or local IP address, use:
|
||||
```bash
|
||||
export MINIO_ACCESS_KEY="YourAccessKey"
|
||||
export MINIO_SECRET_KEY="YourSecretKey"
|
||||
```
|
||||
|
||||
##### [MinIO Browser](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#minio-browser)
|
||||
|
||||
MinIO comes with an embedded web-based object browser. You can control the availability of the MinIO browser by setting the `MINIO_BROWSER` environment variable.
|
||||
|
||||
```bash
|
||||
export IP=127.0.0.1
|
||||
export MINIO_BROWSER="on"
|
||||
```
|
||||
|
||||
##### API URL
|
||||
#### 1.4.3. <a name='SecurityConsiderationshttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdsecurity-considerations'></a>[Security Considerations](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#security-considerations)
|
||||
|
||||
This is the address your application uses to communicate with MinIO. By default, it uses the public IP. However, you can adjust it to a public domain or another IP.
|
||||
##### [TLS/SSL Configuration](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#tls-ssl-configuration)
|
||||
|
||||
For secure communication, it's recommended to enable TLS/SSL for your MinIO server. You can do this by providing the path to the SSL certificate and key files.
|
||||
|
||||
```bash
|
||||
export API_URL=127.0.0.1:10002
|
||||
export MINIO_CERTS_DIR="/path/to/certs/directory"
|
||||
```
|
||||
|
||||
##### MinIO Endpoint Configuration
|
||||
#### 1.4.4. <a name='DataManagementhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mddata-management'></a>[Data Management](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#data-management)
|
||||
|
||||
##### [Data Retention Policy](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#data-retention-policy)
|
||||
|
||||
This is the primary address MinIO uses for communications:
|
||||
You may want to set up a data retention policy to automatically delete objects after a specified period.
|
||||
|
||||
```bash
|
||||
export MINIO_ENDPOINT="127.0.0.1"
|
||||
export MINIO_RETENTION_DAYS="30"
|
||||
```
|
||||
|
||||
##### MinIO Sign Endpoint
|
||||
#### 1.4.5. <a name='MonitoringandLogginghttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdmonitoring-and-logging'></a>[Monitoring and Logging](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#monitoring-and-logging)
|
||||
|
||||
For direct external access to stored content:
|
||||
##### [Audit Logging](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#audit-logging)
|
||||
|
||||
Enable audit logging to keep track of access and changes to your data.
|
||||
|
||||
```bash
|
||||
export MINIO_SIGN_ENDPOINT=127.0.0.1:10005
|
||||
export MINIO_AUDIT="on"
|
||||
```
|
||||
|
||||
##### Modifying MinIO's Port
|
||||
#### 1.4.6. <a name='Troubleshootinghttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdtroubleshooting'></a>[Troubleshooting](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#troubleshooting)
|
||||
|
||||
##### [Debug Mode](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#debug-mode)
|
||||
|
||||
If you need to adjust MinIO's port from the default:
|
||||
In case of issues, you may enable debug mode to get more detailed logs to assist in troubleshooting.
|
||||
|
||||
```bash
|
||||
export MINIO_PORT="10005"
|
||||
export MINIO_DEBUG="on"
|
||||
```
|
||||
|
||||
#### Applying the Configuration
|
||||
#### 1.4.7. <a name='Conclusionhttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdconclusion'></a>[Conclusion](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#conclusion)
|
||||
|
||||
After setting your desired environment variables, restart the MinIO server to apply the changes.
|
||||
With the environment variables configured as per your requirements, your MinIO server should be ready to securely store and manage your object data. Ensure to verify the setup and monitor the logs for any unusual activities or errors. Regularly update the MinIO server and review your configuration to adapt to any changes or improvements in the MinIO system.
|
||||
|
||||
#### Verification
|
||||
#### 1.4.8. <a name='AdditionalResourceshttps:github.comopenimsdkopen-im-serverblobmaindocscontribenvironment.mdadditional-resources'></a>[Additional Resources](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md#additional-resources)
|
||||
|
||||
It's crucial to verify the configurations by checking the connectivity between your application and MinIO using the set API URL and ensuring that the data can be directly accessed using the `signEndpoint`.
|
||||
+ [MinIO Client Quickstart Guide](https://docs.min.io/docs/minio-client-quickstart-guide)
|
||||
+ [MinIO Admin Complete Guide](https://docs.min.io/docs/minio-admin-complete-guide)
|
||||
+ [MinIO Docker Quickstart Guide](https://docs.min.io/docs/minio-docker-quickstart-guide)
|
||||
|
||||
Feel free to explore the MinIO documentation for more advanced configurations and usage scenarios.
|
||||
|
||||
## Configuration Details
|
||||
|
||||
###### Zookeeper
|
||||
|
||||
- **Purpose**: Used for RPC service discovery and registration, cluster support.
|
||||
|
||||
```bash
|
||||
zookeeper:
|
||||
schema: openim # Not recommended to modify
|
||||
address: [ 127.0.0.1:2181 ] # Address
|
||||
username: # Username
|
||||
password: # Password
|
||||
```
|
||||
## 2. <a name='FurtherConfiguration'></a>Further Configuration
|
||||
|
||||
###### MySQL
|
||||
### 2.1. <a name='ImageRegistryConfiguration'></a>Image Registry Configuration
|
||||
|
||||
- **Purpose**: Used for storing users, relationships, and groups. Supports master-slave database.
|
||||
**Description**: The image registry configuration allows users to select an image address for use. The default is set to use GITHUB images, but users can opt for Docker Hub or Ali Cloud, especially beneficial for Chinese users due to its local proximity.
|
||||
|
||||
```bash
|
||||
mysql:
|
||||
address: [ 127.0.0.1:13306 ] # Address
|
||||
username: root # Username
|
||||
password: openIM123 # Password
|
||||
database: openIM_v2 # Not recommended to modify
|
||||
maxOpenConn: 1000 # Maximum connection
|
||||
maxIdleConn: 100 # Maximum idle connection
|
||||
maxLifeTime: 60 # Max time a connection can be reused (seconds)
|
||||
logLevel: 4 # Log level (1=silent, 2=error, 3=warn, 4=info)
|
||||
slowThreshold: 500 # Slow statement threshold (milliseconds)
|
||||
```
|
||||
| Parameter | Default Value | Description |
|
||||
| ---------------- | --------------------- | ------------------------------------------------------------ |
|
||||
| `IMAGE_REGISTRY` | `"ghcr.io/openimsdk"` | The registry from which Docker images will be pulled. Other options include `"openim"` and `"registry.cn-hangzhou.aliyuncs.com/openimsdk"`. |
|
||||
|
||||
###### Mongo
|
||||
### 2.2. <a name='OpenIMDockerNetworkConfiguration'></a>OpenIM Docker Network Configuration
|
||||
|
||||
- **Purpose**: Used for storing offline messages. Supports mongo sharded clusters.
|
||||
**Description**: This section configures the Docker network subnet and generates IP addresses for various services within the defined subnet.
|
||||
|
||||
```bash
|
||||
mongo:
|
||||
uri: # Use this value directly if not empty
|
||||
address: [ 127.0.0.1:37017 ] # Address
|
||||
database: openIM # Default mongo db
|
||||
username: root # Username
|
||||
password: openIM123 # Password
|
||||
maxPoolSize: 100 # Maximum connections
|
||||
```
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------------------- | ----------------- | ------------------------------------------------------------ |
|
||||
| `DOCKER_BRIDGE_SUBNET` | `'172.28.0.0/16'` | The subnet for the Docker network. |
|
||||
| `DOCKER_BRIDGE_GATEWAY` | Generated IP | The gateway IP address within the Docker subnet. |
|
||||
| `[SERVICE]_NETWORK_ADDRESS` | Generated IP | The network IP address for a specific service (e.g., MYSQL, MONGO, REDIS, etc.) within the Docker subnet. |
|
||||
|
||||
###### Redis
|
||||
### 2.3. <a name='OpenIMConfiguration'></a>OpenIM Configuration
|
||||
|
||||
- **Purpose**: Used for storing message sequence numbers, latest messages, user tokens, and MySQL cache. Supports cluster deployment.
|
||||
**Description**: OpenIM configuration involves setting up directories for data, installation, configuration, and logs. It also involves configuring the OpenIM server address and ports for WebSocket and API.
|
||||
|
||||
```bash
|
||||
redis:
|
||||
address: [ 127.0.0.1:16379 ] # Address
|
||||
username: # Username
|
||||
password: openIM123 # Password
|
||||
```
|
||||
| Parameter | Default Value | Description |
|
||||
| ----------------------- | ------------------------ | ----------------------------------------- |
|
||||
| `OPENIM_DATA_DIR` | `"/data/openim"` | Directory for OpenIM data. |
|
||||
| `OPENIM_INSTALL_DIR` | `"/opt/openim"` | Directory where OpenIM is installed. |
|
||||
| `OPENIM_CONFIG_DIR` | `"/etc/openim"` | Directory for OpenIM configuration files. |
|
||||
| `OPENIM_LOG_DIR` | `"/var/log/openim"` | Directory for OpenIM logs. |
|
||||
| `OPENIM_SERVER_ADDRESS` | Docker Bridge Gateway IP | OpenIM server address. |
|
||||
| `OPENIM_WS_PORT` | `'10001'` | Port for OpenIM WebSocket. |
|
||||
| `API_OPENIM_PORT` | `'10002'` | Port for OpenIM API. |
|
||||
|
||||
###### Kafka
|
||||
### 2.4. <a name='OpenIMChatConfiguration'></a>OpenIM Chat Configuration
|
||||
|
||||
- **Purpose**: Used for message queues for decoupling. Supports cluster deployment.
|
||||
**Description**: Configuration for OpenIM chat, including data directory, server address, and ports for API and chat functionalities.
|
||||
|
||||
```bash
|
||||
kafka:
|
||||
username: # Username
|
||||
password: # Password
|
||||
addr: [ 127.0.0.1:9092 ] # Address
|
||||
topics:
|
||||
latestMsgToRedis: "latestMsgToRedis"
|
||||
offlineMsgToMongo: "offlineMsgToMongoMysql"
|
||||
msgToPush: "msgToPush"
|
||||
msgToModify: "msgToModify"
|
||||
consumerGroupID:
|
||||
msgToRedis: redis
|
||||
msgToMongo: mongo
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
msgToModify: modify
|
||||
```
|
||||
| Parameter | Example Value | Description |
|
||||
| ----------------------- | -------------------------- | ------------------------------- |
|
||||
| `OPENIM_CHAT_DATA_DIR` | `"./openim-chat/[BRANCH]"` | Directory for OpenIM chat data. |
|
||||
| `OPENIM_CHAT_ADDRESS` | Docker Bridge Gateway IP | OpenIM chat service address. |
|
||||
| `OPENIM_CHAT_API_PORT` | `"10008"` | Port for OpenIM chat API. |
|
||||
| `OPENIM_ADMIN_API_PORT` | `"10009"` | Port for OpenIM Admin API. |
|
||||
| `OPENIM_ADMIN_PORT` | `"30200"` | Port for OpenIM chat Admin. |
|
||||
| `OPENIM_CHAT_PORT` | `"30300"` | Port for OpenIM chat. |
|
||||
|
||||
### 2.5. <a name='ZookeeperConfiguration'></a>Zookeeper Configuration
|
||||
|
||||
**Description**: Configuration for Zookeeper, including schema, port, address, and credentials.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| -------------------- | ------------------------ | ----------------------- |
|
||||
| `ZOOKEEPER_SCHEMA` | `"openim"` | Schema for Zookeeper. |
|
||||
| `ZOOKEEPER_PORT` | `"12181"` | Port for Zookeeper. |
|
||||
| `ZOOKEEPER_ADDRESS` | Docker Bridge Gateway IP | Address for Zookeeper. |
|
||||
| `ZOOKEEPER_USERNAME` | `""` | Username for Zookeeper. |
|
||||
| `ZOOKEEPER_PASSWORD` | `""` | Password for Zookeeper. |
|
||||
|
||||
### 2.6. <a name='MySQLConfiguration'></a>MySQL Configuration
|
||||
|
||||
## Config options
|
||||
**Description**: Configuration for MySQL, including port, address, and credentials.
|
||||
|
||||
...
|
||||
| Parameter | Example Value | Description |
|
||||
| ---------------- | ------------------------ | ------------------- |
|
||||
| `MYSQL_PORT` | `"13306"` | Port for MySQL. |
|
||||
| `MYSQL_ADDRESS` | Docker Bridge Gateway IP | Address for MySQL. |
|
||||
| `MYSQL_USERNAME` | User-defined | Username for MySQL. |
|
||||
| `MYSQL_PASSWORD` | User-defined | Password for MySQL. |
|
||||
|
||||
## Use the default values
|
||||
Note: The configurations for other services (e.g., MONGO, REDIS, KAFKA, etc.) follow a similar pattern to MySQL and can be documented in a similar manner.
|
||||
|
||||
A method to revert to the default value:
|
||||
### 2.7. <a name='MongoDBConfiguration'></a>MongoDB Configuration
|
||||
|
||||
```bash
|
||||
export IP=127.0.0.1
|
||||
```
|
||||
This section involves setting up MongoDB, including its port, address, and credentials.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| -------------- | -------------- | ----------------------- |
|
||||
| MONGO_PORT | "27017" | Port used by MongoDB. |
|
||||
| MONGO_ADDRESS | [Generated IP] | IP address for MongoDB. |
|
||||
| MONGO_USERNAME | [User Defined] | Username for MongoDB. |
|
||||
| MONGO_PASSWORD | [User Defined] | Password for MongoDB. |
|
||||
|
||||
### 2.8. <a name='TencentCloudCOSConfiguration'></a>Tencent Cloud COS Configuration
|
||||
|
||||
This section involves setting up Tencent Cloud COS, including its bucket URL and credentials.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ----------------- | ------------------------------------------------------------ | ------------------------------------ |
|
||||
| COS_BUCKET_URL | "[https://temp-1252357374.cos.ap-chengdu.myqcloud.com](https://temp-1252357374.cos.ap-chengdu.myqcloud.com/)" | Tencent Cloud COS bucket URL. |
|
||||
| COS_SECRET_ID | [User Defined] | Secret ID for Tencent Cloud COS. |
|
||||
| COS_SECRET_KEY | [User Defined] | Secret key for Tencent Cloud COS. |
|
||||
| COS_SESSION_TOKEN | [User Defined] | Session token for Tencent Cloud COS. |
|
||||
| COS_PUBLIC_READ | "false" | Public read access. |
|
||||
|
||||
### 2.9. <a name='AlibabaCloudOSSConfiguration'></a>Alibaba Cloud OSS Configuration
|
||||
|
||||
This section involves setting up Alibaba Cloud OSS, including its endpoint, bucket name, and credentials.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------------- | ------------------------------------------------------------ | ---------------------------------------- |
|
||||
| OSS_ENDPOINT | "[https://oss-cn-chengdu.aliyuncs.com](https://oss-cn-chengdu.aliyuncs.com/)" | Endpoint URL for Alibaba Cloud OSS. |
|
||||
| OSS_BUCKET | "demo-9999999" | Bucket name for Alibaba Cloud OSS. |
|
||||
| OSS_BUCKET_URL | "[https://demo-9999999.oss-cn-chengdu.aliyuncs.com](https://demo-9999999.oss-cn-chengdu.aliyuncs.com/)" | Bucket URL for Alibaba Cloud OSS. |
|
||||
| OSS_ACCESS_KEY_ID | [User Defined] | Access key ID for Alibaba Cloud OSS. |
|
||||
| OSS_ACCESS_KEY_SECRET | [User Defined] | Access key secret for Alibaba Cloud OSS. |
|
||||
| OSS_SESSION_TOKEN | [User Defined] | Session token for Alibaba Cloud OSS. |
|
||||
| OSS_PUBLIC_READ | "false" | Public read access. |
|
||||
|
||||
### 2.10. <a name='RedisConfiguration'></a>Redis Configuration
|
||||
|
||||
This section involves setting up Redis, including its port, address, and credentials.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| -------------- | -------------------------- | --------------------- |
|
||||
| REDIS_PORT | "16379" | Port used by Redis. |
|
||||
| REDIS_ADDRESS | "${DOCKER_BRIDGE_GATEWAY}" | IP address for Redis. |
|
||||
| REDIS_USERNAME | [User Defined] | Username for Redis. |
|
||||
| REDIS_PASSWORD | "${PASSWORD}" | Password for Redis. |
|
||||
|
||||
### 2.11. <a name='KafkaConfiguration'></a>Kafka Configuration
|
||||
|
||||
This section involves setting up Kafka, including its port, address, credentials, and topics.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ---------------------------- | -------------------------- | ----------------------------------- |
|
||||
| KAFKA_USERNAME | [User Defined] | Username for Kafka. |
|
||||
| KAFKA_PASSWORD | [User Defined] | Password for Kafka. |
|
||||
| KAFKA_PORT | "19094" | Port used by Kafka. |
|
||||
| KAFKA_ADDRESS | "${DOCKER_BRIDGE_GATEWAY}" | IP address for Kafka. |
|
||||
| KAFKA_LATESTMSG_REDIS_TOPIC | "latestMsgToRedis" | Topic for latest message to Redis. |
|
||||
| KAFKA_OFFLINEMSG_MONGO_TOPIC | "offlineMsgToMongoMysql" | Topic for offline message to Mongo. |
|
||||
| KAFKA_MSG_PUSH_TOPIC | "msgToPush" | Topic for message to push. |
|
||||
| KAFKA_CONSUMERGROUPID_REDIS | "redis" | Consumer group ID to Redis. |
|
||||
| KAFKA_CONSUMERGROUPID_MONGO | "mongo" | Consumer group ID to Mongo. |
|
||||
| KAFKA_CONSUMERGROUPID_MYSQL | "mysql" | Consumer group ID to MySQL. |
|
||||
| KAFKA_CONSUMERGROUPID_PUSH | "push" | Consumer group ID to push. |
|
||||
|
||||
Note: Ensure to replace placeholder values (like [User Defined], `${DOCKER_BRIDGE_GATEWAY}`, and `${PASSWORD}`) with actual values before deploying the configuration.
|
||||
|
||||
|
||||
|
||||
### 2.12. <a name='OpenIMWebConfiguration'></a>OpenIM Web Configuration
|
||||
|
||||
This section involves setting up OpenIM Web, including its port, address, and dist path.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| -------------------- | -------------------------- | ------------------------- |
|
||||
| OPENIM_WEB_PORT | "11001" | Port used by OpenIM Web. |
|
||||
| OPENIM_WEB_ADDRESS | "${DOCKER_BRIDGE_GATEWAY}" | Address for OpenIM Web. |
|
||||
| OPENIM_WEB_DIST_PATH | "/app/dist" | Dist path for OpenIM Web. |
|
||||
|
||||
### 2.13. <a name='RPCConfiguration'></a>RPC Configuration
|
||||
|
||||
Configuration for RPC, including the register and listen IP.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------- | -------------- | -------------------- |
|
||||
| RPC_REGISTER_IP | [User Defined] | Register IP for RPC. |
|
||||
| RPC_LISTEN_IP | "0.0.0.0" | Listen IP for RPC. |
|
||||
|
||||
### 2.14. <a name='PrometheusConfiguration'></a>Prometheus Configuration
|
||||
|
||||
Setting up Prometheus, including its port and address.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ------------------ | -------------------------- | ------------------------ |
|
||||
| PROMETHEUS_PORT | "19090" | Port used by Prometheus. |
|
||||
| PROMETHEUS_ADDRESS | "${DOCKER_BRIDGE_GATEWAY}" | Address for Prometheus. |
|
||||
|
||||
### 2.15. <a name='GrafanaConfiguration'></a>Grafana Configuration
|
||||
|
||||
Configuration for Grafana, including its port and address.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------- | -------------------------- | --------------------- |
|
||||
| GRAFANA_PORT | "3000" | Port used by Grafana. |
|
||||
| GRAFANA_ADDRESS | "${DOCKER_BRIDGE_GATEWAY}" | Address for Grafana. |
|
||||
|
||||
### 2.16. <a name='RPCPortConfigurationVariables'></a>RPC Port Configuration Variables
|
||||
|
||||
Configuration for various RPC ports. Note: For launching multiple programs, just fill in multiple ports separated by commas. Try not to have spaces.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------------------- | ------------- | ----------------------------------- |
|
||||
| OPENIM_USER_PORT | '10110' | OpenIM User Service Port. |
|
||||
| OPENIM_FRIEND_PORT | '10120' | OpenIM Friend Service Port. |
|
||||
| OPENIM_MESSAGE_PORT | '10130' | OpenIM Message Service Port. |
|
||||
| OPENIM_MESSAGE_GATEWAY_PORT | '10140' | OpenIM Message Gateway Service Port |
|
||||
| OPENIM_GROUP_PORT | '10150' | OpenIM Group Service Port. |
|
||||
| OPENIM_AUTH_PORT | '10160' | OpenIM Authorization Service Port. |
|
||||
| OPENIM_PUSH_PORT | '10170' | OpenIM Push Service Port. |
|
||||
| OPENIM_CONVERSATION_PORT | '10180' | OpenIM Conversation Service Port. |
|
||||
| OPENIM_THIRD_PORT | '10190' | OpenIM Third-Party Service Port. |
|
||||
|
||||
### 2.17. <a name='RPCRegisterNameConfiguration'></a>RPC Register Name Configuration
|
||||
|
||||
This section involves setting up the RPC Register Names for various OpenIM services.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| --------------------------- | ---------------- | ----------------------------------- |
|
||||
| OPENIM_USER_NAME | "User" | OpenIM User Service Name |
|
||||
| OPENIM_FRIEND_NAME | "Friend" | OpenIM Friend Service Name |
|
||||
| OPENIM_MSG_NAME | "Msg" | OpenIM Message Service Name |
|
||||
| OPENIM_PUSH_NAME | "Push" | OpenIM Push Service Name |
|
||||
| OPENIM_MESSAGE_GATEWAY_NAME | "MessageGateway" | OpenIM Message Gateway Service Name |
|
||||
| OPENIM_GROUP_NAME | "Group" | OpenIM Group Service Name |
|
||||
| OPENIM_AUTH_NAME | "Auth" | OpenIM Authorization Service Name |
|
||||
| OPENIM_CONVERSATION_NAME | "Conversation" | OpenIM Conversation Service Name |
|
||||
| OPENIM_THIRD_NAME | "Third" | OpenIM Third-Party Service Name |
|
||||
|
||||
### 2.18. <a name='LogConfiguration'></a>Log Configuration
|
||||
|
||||
This section involves configuring the log settings, including storage location, rotation time, and log level.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ------------------------- | ------------------------ | --------------------------------- |
|
||||
| LOG_STORAGE_LOCATION | ""${OPENIM_ROOT}"/logs/" | Location for storing logs |
|
||||
| LOG_ROTATION_TIME | "24" | Log rotation time (in hours) |
|
||||
| LOG_REMAIN_ROTATION_COUNT | "2" | Number of log rotations to retain |
|
||||
| LOG_REMAIN_LOG_LEVEL | "6" | Log level to retain |
|
||||
| LOG_IS_STDOUT | "false" | Output log to standard output |
|
||||
| LOG_IS_JSON | "false" | Log in JSON format |
|
||||
| LOG_WITH_STACK | "false" | Include stack info in logs |
|
||||
|
||||
### 2.19. <a name='AdditionalConfigurationVariables'></a>Additional Configuration Variables
|
||||
|
||||
This section involves setting up additional configuration variables for Websocket, Push Notifications, and Chat.
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ----------------------- | ----------------- | ---------------------------------- |
|
||||
| WEBSOCKET_MAX_CONN_NUM | "100000" | Maximum Websocket connections |
|
||||
| WEBSOCKET_MAX_MSG_LEN | "4096" | Maximum Websocket message length |
|
||||
| WEBSOCKET_TIMEOUT | "10" | Websocket timeout |
|
||||
| PUSH_ENABLE | "getui" | Push notification enable status |
|
||||
| GETUI_PUSH_URL | [Generated URL] | GeTui Push Notification URL |
|
||||
| GETUI_MASTER_SECRET | [User Defined] | GeTui Master Secret |
|
||||
| GETUI_APP_KEY | [User Defined] | GeTui Application Key |
|
||||
| GETUI_INTENT | [User Defined] | GeTui Push Intent |
|
||||
| GETUI_CHANNEL_ID | [User Defined] | GeTui Channel ID |
|
||||
| GETUI_CHANNEL_NAME | [User Defined] | GeTui Channel Name |
|
||||
| FCM_SERVICE_ACCOUNT | "x.json" | FCM Service Account |
|
||||
| JPNS_APP_KEY | [User Defined] | JPNS Application Key |
|
||||
| JPNS_MASTER_SECRET | [User Defined] | JPNS Master Secret |
|
||||
| JPNS_PUSH_URL | [User Defined] | JPNS Push Notification URL |
|
||||
| JPNS_PUSH_INTENT | [User Defined] | JPNS Push Intent |
|
||||
| MANAGER_USERID_1 | "openIM123456" | Administrator ID 1 |
|
||||
| MANAGER_USERID_2 | "openIM654321" | Administrator ID 2 |
|
||||
| MANAGER_USERID_3 | "openIMAdmin" | Administrator ID 3 |
|
||||
| NICKNAME_1 | "system1" | Nickname 1 |
|
||||
| NICKNAME_2 | "system2" | Nickname 2 |
|
||||
| NICKNAME_3 | "system3" | Nickname 3 |
|
||||
| MULTILOGIN_POLICY | "1" | Multi-login Policy |
|
||||
| CHAT_PERSISTENCE_MYSQL | "true" | Chat Persistence in MySQL |
|
||||
| MSG_CACHE_TIMEOUT | "86400" | Message Cache Timeout |
|
||||
| GROUP_MSG_READ_RECEIPT | "true" | Group Message Read Receipt Enable |
|
||||
| SINGLE_MSG_READ_RECEIPT | "true" | Single Message Read Receipt Enable |
|
||||
| RETAIN_CHAT_RECORDS | "365" | Retain Chat Records (in days) |
|
||||
| CHAT_RECORDS_CLEAR_TIME | [Cron Expression] | Chat Records Clear Time |
|
||||
| MSG_DESTRUCT_TIME | [Cron Expression] | Message Destruct Time |
|
||||
| SECRET | "${PASSWORD}" | Secret Key |
|
||||
| TOKEN_EXPIRE | "90" | Token Expiry Time |
|
||||
| FRIEND_VERIFY | "false" | Friend Verification Enable |
|
||||
| IOS_PUSH_SOUND | "xxx" | iOS |
|
||||
|
||||
|
||||
|
||||
### 2.20. <a name='PrometheusConfiguration-1'></a>Prometheus Configuration
|
||||
|
||||
This section involves configuring Prometheus, including enabling/disabling it and setting up ports for various services.
|
||||
|
||||
#### 2.20.1. <a name='GeneralConfiguration'></a>General Configuration
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ------------------- | ------------- | ----------------------------- |
|
||||
| `PROMETHEUS_ENABLE` | "false" | Whether to enable Prometheus. |
|
||||
|
||||
#### 2.20.2. <a name='Service-SpecificPrometheusPorts'></a>Service-Specific Prometheus Ports
|
||||
|
||||
| Service | Parameter | Default Port Value | Description |
|
||||
| ------------------------ | ------------------------ | ---------------------------- | -------------------------------------------------- |
|
||||
| User Service | `USER_PROM_PORT` | '20110' | Prometheus port for the User service. |
|
||||
| Friend Service | `FRIEND_PROM_PORT` | '20120' | Prometheus port for the Friend service. |
|
||||
| Message Service | `MESSAGE_PROM_PORT` | '20130' | Prometheus port for the Message service. |
|
||||
| Message Gateway | `MSG_GATEWAY_PROM_PORT` | '20140' | Prometheus port for the Message Gateway. |
|
||||
| Group Service | `GROUP_PROM_PORT` | '20150' | Prometheus port for the Group service. |
|
||||
| Auth Service | `AUTH_PROM_PORT` | '20160' | Prometheus port for the Auth service. |
|
||||
| Push Service | `PUSH_PROM_PORT` | '20170' | Prometheus port for the Push service. |
|
||||
| Conversation Service | `CONVERSATION_PROM_PORT` | '20230' | Prometheus port for the Conversation service. |
|
||||
| RTC Service | `RTC_PROM_PORT` | '21300' | Prometheus port for the RTC service. |
|
||||
| Third Service | `THIRD_PROM_PORT` | '21301' | Prometheus port for the Third service. |
|
||||
| Message Transfer Service | `MSG_TRANSFER_PROM_PORT` | '21400, 21401, 21402, 21403' | Prometheus ports for the Message Transfer service. |
|
||||
|
After Width: | Height: | Size: 65 KiB |
@ -0,0 +1,145 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/third"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
utils2 "github.com/OpenIMSDK/tools/utils"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
||||
relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||
)
|
||||
|
||||
func genLogID() string {
|
||||
const dataLen = 10
|
||||
data := make([]byte, dataLen)
|
||||
rand.Read(data)
|
||||
chars := []byte("0123456789")
|
||||
for i := 0; i < len(data); i++ {
|
||||
if i == 0 {
|
||||
data[i] = chars[1:][data[i]%9]
|
||||
} else {
|
||||
data[i] = chars[data[i]%10]
|
||||
}
|
||||
}
|
||||
return string(data)
|
||||
}
|
||||
|
||||
func (t *thirdServer) UploadLogs(ctx context.Context, req *third.UploadLogsReq) (*third.UploadLogsResp, error) {
|
||||
var DBlogs []*relationtb.Log
|
||||
userID := ctx.Value(constant.OpUserID).(string)
|
||||
platform := constant.PlatformID2Name[int(req.Platform)]
|
||||
for _, fileURL := range req.FileURLs {
|
||||
log := relationtb.Log{
|
||||
Version: req.Version,
|
||||
SystemType: req.SystemType,
|
||||
Platform: platform,
|
||||
UserID: userID,
|
||||
CreateTime: time.Now(),
|
||||
Url: fileURL.URL,
|
||||
FileName: fileURL.Filename,
|
||||
}
|
||||
for i := 0; i < 20; i++ {
|
||||
id := genLogID()
|
||||
logs, err := t.thirdDatabase.GetLogs(ctx, []string{id}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(logs) == 0 {
|
||||
log.LogID = id
|
||||
break
|
||||
}
|
||||
}
|
||||
if log.LogID == "" {
|
||||
return nil, errs.ErrData.Wrap("Log id gen error")
|
||||
}
|
||||
DBlogs = append(DBlogs, &log)
|
||||
}
|
||||
err := t.thirdDatabase.UploadLogs(ctx, DBlogs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &third.UploadLogsResp{}, nil
|
||||
}
|
||||
|
||||
func (t *thirdServer) DeleteLogs(ctx context.Context, req *third.DeleteLogsReq) (*third.DeleteLogsResp, error) {
|
||||
if err := authverify.CheckAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userID := ""
|
||||
logs, err := t.thirdDatabase.GetLogs(ctx, req.LogIDs, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var logIDs []string
|
||||
for _, log := range logs {
|
||||
logIDs = append(logIDs, log.LogID)
|
||||
}
|
||||
if ids := utils2.Single(req.LogIDs, logIDs); len(ids) > 0 {
|
||||
return nil, errs.ErrRecordNotFound.Wrap(fmt.Sprintf("logIDs not found%#v", ids))
|
||||
}
|
||||
err = t.thirdDatabase.DeleteLogs(ctx, req.LogIDs, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &third.DeleteLogsResp{}, nil
|
||||
}
|
||||
|
||||
func dbToPbLogInfos(logs []*relationtb.Log) []*third.LogInfo {
|
||||
db2pbForLogInfo := func(log *relationtb.Log) *third.LogInfo {
|
||||
return &third.LogInfo{
|
||||
Filename: log.FileName,
|
||||
UserID: log.UserID,
|
||||
Platform: utils.StringToInt32(log.Platform),
|
||||
Url: log.Url,
|
||||
CreateTime: log.CreateTime.UnixMilli(),
|
||||
LogID: log.LogID,
|
||||
SystemType: log.SystemType,
|
||||
Version: log.Version,
|
||||
Ex: log.Ex,
|
||||
}
|
||||
}
|
||||
return utils.Slice(logs, db2pbForLogInfo)
|
||||
}
|
||||
|
||||
func (t *thirdServer) SearchLogs(ctx context.Context, req *third.SearchLogsReq) (*third.SearchLogsResp, error) {
|
||||
if err := authverify.CheckAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var (
|
||||
resp third.SearchLogsResp
|
||||
userIDs []string
|
||||
)
|
||||
if req.StartTime > req.EndTime {
|
||||
return nil, errs.ErrArgs.Wrap("startTime>endTime")
|
||||
}
|
||||
total, logs, err := t.thirdDatabase.SearchLogs(ctx, req.Keyword, time.UnixMilli(req.StartTime), time.UnixMilli(req.EndTime), req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pbLogs := dbToPbLogInfos(logs)
|
||||
for _, log := range logs {
|
||||
userIDs = append(userIDs, log.UserID)
|
||||
}
|
||||
users, err := t.thirdDatabase.FindUsers(ctx, userIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
IDtoName := make(map[string]string)
|
||||
for _, user := range users {
|
||||
IDtoName[user.UserID] = user.Nickname
|
||||
}
|
||||
for _, pbLog := range pbLogs {
|
||||
pbLog.Nickname = IDtoName[pbLog.UserID]
|
||||
}
|
||||
resp.LogsInfos = pbLogs
|
||||
resp.Total = total
|
||||
return &resp, nil
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
pbuser "github.com/OpenIMSDK/protocol/user"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/mcontext"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
|
||||
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/http"
|
||||
)
|
||||
|
||||
func CallbackBeforeUpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) error {
|
||||
if !config.Config.Callback.CallbackBeforeUpdateUserInfo.Enable {
|
||||
return nil
|
||||
}
|
||||
cbReq := &cbapi.CallbackBeforeUpdateUserInfoReq{
|
||||
CallbackCommand: constant.CallbackBeforeUpdateUserInfoCommand,
|
||||
OperationID: mcontext.GetOperationID(ctx),
|
||||
UserID: req.UserInfo.UserID,
|
||||
FaceURL: &req.UserInfo.FaceURL,
|
||||
Nickname: &req.UserInfo.Nickname,
|
||||
}
|
||||
resp := &cbapi.CallbackBeforeUpdateUserInfoResp{}
|
||||
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeUpdateUserInfo); err != nil {
|
||||
if err == errs.ErrCallbackContinue {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
utils.NotNilReplace(&req.UserInfo.FaceURL, resp.FaceURL)
|
||||
utils.NotNilReplace(&req.UserInfo.Ex, resp.Ex)
|
||||
utils.NotNilReplace(&req.UserInfo.Nickname, resp.Nickname)
|
||||
return nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package callbackstruct
|
||||
|
||||
type CallbackBeforeUpdateUserInfoReq struct {
|
||||
CallbackCommand `json:"callbackCommand"`
|
||||
OperationID string `json:"operationID"`
|
||||
UserID string `json:"userID"`
|
||||
Nickname *string `json:"nickName"`
|
||||
FaceURL *string `json:"faceURL"`
|
||||
Ex *string `json:"ex"`
|
||||
}
|
||||
type CallbackBeforeUpdateUserInfoResp struct {
|
||||
CommonCallbackResp
|
||||
Nickname *string `json:"nickName"`
|
||||
FaceURL *string `json:"faceURL"`
|
||||
Ex *string `json:"ex"`
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/ormutil"
|
||||
"gorm.io/gorm"
|
||||
|
||||
relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||
)
|
||||
|
||||
type LogGorm struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func (l *LogGorm) Create(ctx context.Context, log []*relationtb.Log) error {
|
||||
return errs.Wrap(l.db.WithContext(ctx).Create(log).Error)
|
||||
}
|
||||
|
||||
func (l *LogGorm) Search(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*relationtb.Log, error) {
|
||||
db := l.db.WithContext(ctx).Where("create_time >= ?", start)
|
||||
if end.UnixMilli() != 0 {
|
||||
db = l.db.WithContext(ctx).Where("create_time <= ?", end)
|
||||
}
|
||||
return ormutil.GormSearch[relationtb.Log](db, []string{"user_id"}, keyword, pageNumber, showNumber)
|
||||
}
|
||||
|
||||
func (l *LogGorm) Delete(ctx context.Context, logIDs []string, userID string) error {
|
||||
if userID == "" {
|
||||
return errs.Wrap(l.db.WithContext(ctx).Where("log_id in ?", logIDs).Delete(&relationtb.Log{}).Error)
|
||||
}
|
||||
return errs.Wrap(l.db.WithContext(ctx).Where("log_id in ? and user_id=?", logIDs, userID).Delete(&relationtb.Log{}).Error)
|
||||
}
|
||||
|
||||
func (l *LogGorm) Get(ctx context.Context, logIDs []string, userID string) ([]*relationtb.Log, error) {
|
||||
var logs []*relationtb.Log
|
||||
if userID == "" {
|
||||
return logs, errs.Wrap(l.db.WithContext(ctx).Where("log_id in ?", logIDs).Find(&logs).Error)
|
||||
}
|
||||
return logs, errs.Wrap(l.db.WithContext(ctx).Where("log_id in ? and user_id=?", logIDs, userID).Find(&logs).Error)
|
||||
}
|
||||
|
||||
func NewLogGorm(db *gorm.DB) relationtb.LogInterface {
|
||||
db.AutoMigrate(&relationtb.Log{})
|
||||
return &LogGorm{db: db}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package cos // import "github.com/openimsdk/open-im-server/v3/pkg/common/db/s3/cos"
|
@ -0,0 +1,13 @@
|
||||
package cos
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/tencentyun/cos-go-sdk-v5"
|
||||
)
|
||||
|
||||
//go:linkname newRequest github.com/tencentyun/cos-go-sdk-v5.(*Client).newRequest
|
||||
func newRequest(c *cos.Client, ctx context.Context, baseURL *url.URL, uri, method string, body interface{}, optQuery interface{}, optHeader interface{}) (req *http.Request, err error)
|
@ -1,15 +0,0 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package minio // import "github.com/openimsdk/open-im-server/v3/pkg/common/db/s3/minio"
|
@ -0,0 +1,11 @@
|
||||
package minio
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
)
|
||||
|
||||
//go:linkname makeTargetURL github.com/minio/minio-go/v7.(*Client).makeTargetURL
|
||||
func makeTargetURL(client *minio.Client, bucketName, objectName, bucketLocation string, isVirtualHostStyle bool, queryValues url.Values) (*url.URL, error)
|
@ -0,0 +1,39 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package oss
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/aliyun/aliyun-oss-go-sdk/oss"
|
||||
)
|
||||
|
||||
//go:linkname signHeader github.com/aliyun/aliyun-oss-go-sdk/oss.Conn.signHeader
|
||||
func signHeader(c oss.Conn, req *http.Request, canonicalizedResource string)
|
||||
|
||||
//go:linkname getURLParams github.com/aliyun/aliyun-oss-go-sdk/oss.Conn.getURLParams
|
||||
func getURLParams(c oss.Conn, params map[string]interface{}) string
|
||||
|
||||
//go:linkname getURL github.com/aliyun/aliyun-oss-go-sdk/oss.urlMaker.getURL
|
||||
func getURL(um urlMaker, bucket, object, params string) *url.URL
|
||||
|
||||
type urlMaker struct {
|
||||
Scheme string
|
||||
NetLoc string
|
||||
Type int
|
||||
IsProxy bool
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Log struct {
|
||||
LogID string `gorm:"column:log_id;primary_key;type:char(64)"`
|
||||
Platform string `gorm:"column:platform;type:varchar(32)"`
|
||||
UserID string `gorm:"column:user_id;type:char(64)"`
|
||||
CreateTime time.Time `gorm:"index:,sort:desc"`
|
||||
Url string `gorm:"column:url;type varchar(255)"`
|
||||
FileName string `gorm:"column:filename;type varchar(255)"`
|
||||
SystemType string `gorm:"column:system_type;type varchar(255)"`
|
||||
Version string `gorm:"column:version;type varchar(255)"`
|
||||
Ex string `gorm:"column:ex;type varchar(255)"`
|
||||
}
|
||||
|
||||
type LogInterface interface {
|
||||
Create(ctx context.Context, log []*Log) error
|
||||
Search(ctx context.Context, keyword string, start time.Time, end time.Time, pageNumber int32, showNumber int32) (uint32, []*Log, error)
|
||||
Delete(ctx context.Context, logID []string, userID string) error
|
||||
Get(ctx context.Context, logIDs []string, userID string) ([]*Log, error)
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
// Copyright © 2023 OpenIM. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package data_conversion
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/IBM/sarama"
|
||||
)
|
||||
|
||||
var (
|
||||
topic = "latestMsgToRedis"
|
||||
addr = "127.0.0.1:9092"
|
||||
)
|
||||
|
||||
var (
|
||||
consumer sarama.Consumer
|
||||
producer sarama.SyncProducer
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Producer
|
||||
config := sarama.NewConfig() // Instantiate a sarama Config
|
||||
config.Producer.Return.Successes = true // Whether to enable the successes channel to be notified after the message is sent successfully
|
||||
config.Producer.Return.Errors = true
|
||||
config.Producer.RequiredAcks = sarama.WaitForAll // Set producer Message Reply level 0 1 all
|
||||
config.Producer.Partitioner = sarama.NewHashPartitioner // Set the hash-key automatic hash partition. When sending a message, you must specify the key value of the message. If there is no key, the partition will be selected randomly
|
||||
|
||||
client, err := sarama.NewSyncProducer([]string{addr}, config)
|
||||
if err != nil {
|
||||
fmt.Println("producer closed, err:", err)
|
||||
}
|
||||
producer = client
|
||||
|
||||
// Consumer
|
||||
consumerT, err := sarama.NewConsumer([]string{addr}, sarama.NewConfig())
|
||||
if err != nil {
|
||||
fmt.Printf("fail to start consumer, err:%v\n", err)
|
||||
}
|
||||
consumer = consumerT
|
||||
}
|
||||
|
||||
func SendMessage() {
|
||||
// construct a message
|
||||
msg := &sarama.ProducerMessage{}
|
||||
msg.Topic = topic
|
||||
msg.Value = sarama.StringEncoder("this is a test log")
|
||||
|
||||
// Send a message
|
||||
pid, offset, err := producer.SendMessage(msg)
|
||||
if err != nil {
|
||||
fmt.Println("send msg failed, err:", err)
|
||||
}
|
||||
fmt.Printf("pid:%v offset:%v\n", pid, offset)
|
||||
}
|
||||
|
||||
func GetMessage() {
|
||||
partitionList, err := consumer.Partitions(topic) // Get all partitions according to topic
|
||||
if err != nil {
|
||||
fmt.Printf("fail to get list of partition:err%v\n", err)
|
||||
}
|
||||
fmt.Println(partitionList)
|
||||
for partition := range partitionList { // iterate over all partitions
|
||||
// Create a corresponding partition consumer for each partition
|
||||
pc, err := consumer.ConsumePartition(topic, int32(partition), sarama.OffsetNewest)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to start consumer for partition %d,err:%v\n", partition, err)
|
||||
}
|
||||
// Asynchronously consume information from each partition
|
||||
go func(sarama.PartitionConsumer) {
|
||||
for msg := range pc.Messages() {
|
||||
fmt.Printf("Partition:%d Offset:%d Key:%v Value:%v", msg.Partition, msg.Offset, msg.Key, msg.Value)
|
||||
}
|
||||
}(pc)
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue