mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-05 20:11:14 +08:00
Fix(main): fix openim config from mongo password env upgrade openim build CICD (#1689)
* fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
parent
e0244d9ca7
commit
8aac6c6f81
15
.github/workflows/openimci.yml
vendored
15
.github/workflows/openimci.yml
vendored
@ -128,6 +128,8 @@ jobs:
|
|||||||
- name: Run OpenIM make install start
|
- name: Run OpenIM make install start
|
||||||
run: |
|
run: |
|
||||||
sudo make install
|
sudo make install
|
||||||
|
sudo docker images
|
||||||
|
sudo docker ps
|
||||||
|
|
||||||
execute-scripts:
|
execute-scripts:
|
||||||
name: Execute OpenIM Script On ${{ matrix.os }}
|
name: Execute OpenIM Script On ${{ matrix.os }}
|
||||||
@ -212,14 +214,10 @@ jobs:
|
|||||||
sudo make restart
|
sudo make restart
|
||||||
sudo make check
|
sudo make check
|
||||||
|
|
||||||
# - name: Build, Start, Check Services and Print Logs for macOS
|
- name: Build, Start, Check Services and Print Logs for macOS
|
||||||
# if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
# run: |
|
run: |
|
||||||
# make init && \
|
make build
|
||||||
# make build && \
|
|
||||||
# make start && \
|
|
||||||
# make check || \
|
|
||||||
# (echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
|
|
||||||
|
|
||||||
openim-test-build-image:
|
openim-test-build-image:
|
||||||
name: Build OpenIM Docker Image
|
name: Build OpenIM Docker Image
|
||||||
@ -245,3 +243,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo make init
|
sudo make init
|
||||||
sudo make image
|
sudo make image
|
||||||
|
sudo docker images
|
||||||
|
@ -304,8 +304,10 @@ This section involves setting up MongoDB, including its port, address, and crede
|
|||||||
| -------------- | -------------- | ----------------------- |
|
| -------------- | -------------- | ----------------------- |
|
||||||
| MONGO_PORT | "27017" | Port used by MongoDB. |
|
| MONGO_PORT | "27017" | Port used by MongoDB. |
|
||||||
| MONGO_ADDRESS | [Generated IP] | IP address for MongoDB. |
|
| MONGO_ADDRESS | [Generated IP] | IP address for MongoDB. |
|
||||||
| MONGO_USERNAME | [User Defined] | Username for MongoDB. |
|
| MONGO_USERNAME | [User Defined] | Admin Username for MongoDB. |
|
||||||
| MONGO_PASSWORD | [User Defined] | Password for MongoDB. |
|
| MONGO_PASSWORD | [User Defined] | Admin Password for MongoDB. |
|
||||||
|
| MONGO_OPENIM_PASSWORD | [User Defined] | OpenIM Username for MongoDB. |
|
||||||
|
| MONGO_OPENIM_PASSWORD | [User Defined] | OpenIM Password for MongoDB. |
|
||||||
|
|
||||||
### 2.8. <a name='TencentCloudCOSConfiguration'></a>Tencent Cloud COS Configuration
|
### 2.8. <a name='TencentCloudCOSConfiguration'></a>Tencent Cloud COS Configuration
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ func buildMongoURI() string {
|
|||||||
return config.Config.Mongo.Uri
|
return config.Config.Mongo.Uri
|
||||||
}
|
}
|
||||||
|
|
||||||
username := os.Getenv("MONGO_USERNAME")
|
username := os.Getenv("MONGO_OPENIM_USERNAME")
|
||||||
password := os.Getenv("MONGO_PASSWORD")
|
password := os.Getenv("MONGO_OPENIM_PASSWORD")
|
||||||
address := os.Getenv("MONGO_ADDRESS")
|
address := os.Getenv("MONGO_ADDRESS")
|
||||||
port := os.Getenv("MONGO_PORT")
|
port := os.Getenv("MONGO_PORT")
|
||||||
database := os.Getenv("MONGO_DATABASE")
|
database := os.Getenv("MONGO_DATABASE")
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# OpenIM Docker Deployment Script
|
||||||
# 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
|
# This script automates the process of building the OpenIM server image
|
||||||
|
# and deploying it using Docker Compose.
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Variables:
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# - SERVER_IMAGE_VERSION: Version of the server image (default: test)
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# - IMAGE_REGISTRY: Docker image registry (default: openim)
|
||||||
# See the License for the specific language governing permissions and
|
# - DOCKER_COMPOSE_FILE_URL: URL to the docker-compose.yml file
|
||||||
# limitations under the License.
|
#
|
||||||
|
# Usage:
|
||||||
|
# SERVER_IMAGE_VERSION=latest IMAGE_REGISTRY=myregistry ./this_script.sh
|
||||||
|
|
||||||
|
|
||||||
# Common utilities, variables and checks for all build scripts.
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@ -28,35 +26,46 @@ chmod +x "${OPENIM_ROOT}"/scripts/*.sh
|
|||||||
|
|
||||||
openim::util::ensure_docker_daemon_connectivity
|
openim::util::ensure_docker_daemon_connectivity
|
||||||
|
|
||||||
|
# Default values for variables
|
||||||
|
: ${SERVER_IMAGE_VERSION:=test}
|
||||||
|
: ${IMAGE_REGISTRY:=openim}
|
||||||
|
: ${DOCKER_COMPOSE_FILE_URL:="https://raw.githubusercontent.com/openimsdk/openim-docker/main/docker-compose.yaml"}
|
||||||
|
|
||||||
DOCKER_COMPOSE_COMMAND=
|
DOCKER_COMPOSE_COMMAND=
|
||||||
# Check if docker-compose command is available
|
# Check if docker-compose command is available
|
||||||
openim::util::check_docker_and_compose_versions
|
openim::util::check_docker_and_compose_versions
|
||||||
|
if command -v docker compose &> /dev/null; then
|
||||||
if command -v docker compose &> /dev/null
|
|
||||||
then
|
|
||||||
openim::log::info "docker compose command is available"
|
openim::log::info "docker compose command is available"
|
||||||
DOCKER_COMPOSE_COMMAND="docker compose"
|
DOCKER_COMPOSE_COMMAND="docker compose"
|
||||||
else
|
else
|
||||||
DOCKER_COMPOSE_COMMAND="docker-compose"
|
DOCKER_COMPOSE_COMMAND="docker-compose"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export SERVER_IMAGE_VERSION
|
||||||
|
export IMAGE_REGISTRY
|
||||||
"${OPENIM_ROOT}"/scripts/init-config.sh
|
"${OPENIM_ROOT}"/scripts/init-config.sh
|
||||||
|
|
||||||
pushd "${OPENIM_ROOT}"
|
pushd "${OPENIM_ROOT}"
|
||||||
|
docker build -t "${IMAGE_REGISTRY}/openim-server:${SERVER_IMAGE_VERSION}" .
|
||||||
${DOCKER_COMPOSE_COMMAND} stop
|
${DOCKER_COMPOSE_COMMAND} stop
|
||||||
curl https://raw.githubusercontent.com/openimsdk/openim-docker/main/docker-compose.yaml -o docker-compose.yml
|
curl "${DOCKER_COMPOSE_FILE_URL}" -o docker-compose.yml
|
||||||
${DOCKER_COMPOSE_COMMAND} up -d
|
${DOCKER_COMPOSE_COMMAND} up -d
|
||||||
|
|
||||||
|
# Function to check container status
|
||||||
|
check_containers() {
|
||||||
|
if ! ${DOCKER_COMPOSE_COMMAND} ps | grep -q 'Up'; then
|
||||||
|
echo "Error: One or more docker containers failed to start."
|
||||||
|
${DOCKER_COMPOSE_COMMAND} logs
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Wait for a short period to allow containers to initialize
|
# Wait for a short period to allow containers to initialize
|
||||||
sleep 30
|
sleep 30
|
||||||
|
check_containers
|
||||||
|
|
||||||
# Check the status of the containers
|
|
||||||
if ! ${DOCKER_COMPOSE_COMMAND} ps | grep -q 'Up'; then
|
|
||||||
echo "Error: One or more docker containers failed to start."
|
|
||||||
${DOCKER_COMPOSE_COMMAND} logs
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 30 # Keep the original 60-second wait, adjusted for the 10-second check above
|
|
||||||
${DOCKER_COMPOSE_COMMAND} logs openim-server
|
${DOCKER_COMPOSE_COMMAND} logs openim-server
|
||||||
${DOCKER_COMPOSE_COMMAND} ps
|
${DOCKER_COMPOSE_COMMAND} ps
|
||||||
|
|
||||||
popd
|
popd
|
@ -35,8 +35,8 @@ docker run -d \
|
|||||||
-e MONGO_INITDB_ROOT_USERNAME=${OPENIM_USER} \
|
-e MONGO_INITDB_ROOT_USERNAME=${OPENIM_USER} \
|
||||||
-e MONGO_INITDB_ROOT_PASSWORD=${PASSWORD} \
|
-e MONGO_INITDB_ROOT_PASSWORD=${PASSWORD} \
|
||||||
-e MONGO_INITDB_DATABASE=openIM \
|
-e MONGO_INITDB_DATABASE=openIM \
|
||||||
-e MONGO_USERNAME=${OPENIM_USER} \
|
-e MONGO_OPENIM_USERNAME=${OPENIM_USER} \
|
||||||
-e MONGO_PASSWORD=${PASSWORD} \
|
-e MONGO_OPENIM_PASSWORD=${PASSWORD} \
|
||||||
--restart always \
|
--restart always \
|
||||||
mongo:6.0.2 --wiredTigerCacheSizeGB 1 --auth
|
mongo:6.0.2 --wiredTigerCacheSizeGB 1 --auth
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user