Skip to content

Commit 5c49acc

Browse files
authored
Merge pull request #394 from jumpserver/dev
v3.10.4
2 parents 92392ae + 83a5c5d commit 5c49acc

File tree

6 files changed

+25
-29
lines changed

6 files changed

+25
-29
lines changed

compose/docker-compose-magnus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
- ${CONFIG_DIR}/certs:/opt/magnus/data/certs
2020
- ${VOLUME_DIR}/magnus/data:/opt/magnus/data
2121
healthcheck:
22-
test: "nc -z 127.0.0.1 33061 || exit 1"
22+
test: "curl localhost:8088/health || exit 1"
2323
interval: 10s
2424
timeout: 5s
2525
retries: 3

config-example.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ DOCKER_SUBNET_IPV6=fc00:1010:1111:200::/64
5151

5252
################################# MySQL 配置 ##################################
5353
# 外置 MySQL 需要输入正确的 MySQL 信息, 内置 MySQL 系统会自动处理
54+
# (*) 密码部分不得包含单引号和双引号
5455
#
5556
DB_HOST=mysql
5657
DB_PORT=3306
@@ -64,6 +65,7 @@ DB_NAME=jumpserver
6465

6566
################################# Redis 配置 ##################################
6667
# 外置 Redis 需要请输入正确的 Redis 信息, 内置 Redis 系统会自动处理
68+
# (*) 密码部分不得包含单引号和双引号
6769
#
6870
REDIS_HOST=redis
6971
REDIS_PORT=6379

scripts/5_db_backup.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ VOLUME_DIR=$(get_config VOLUME_DIR)
88
BACKUP_DIR="${VOLUME_DIR}/db_backup"
99
CURRENT_VERSION=$(get_config CURRENT_VERSION)
1010

11-
HOST=$(get_config DB_HOST)
12-
PORT=$(get_config DB_PORT)
13-
USER=$(get_config DB_USER)
14-
PASSWORD=$(get_config DB_PASSWORD)
1511
DATABASE=$(get_config DB_NAME)
1612
DB_FILE=${BACKUP_DIR}/${DATABASE}-${CURRENT_VERSION}-$(date +%F_%T).sql
1713

@@ -33,8 +29,9 @@ function main() {
3329
done
3430
fi
3531

36-
backup_cmd="mysqldump --skip-add-locks --skip-lock-tables --single-transaction --host=${HOST} --port=${PORT} --user=${USER} --password=${PASSWORD} ${DATABASE}"
37-
if ! docker run --rm -i --network=jms_net "${mysql_images}" ${backup_cmd} > "${DB_FILE}"; then
32+
backup_cmd='mysqldump --skip-add-locks --skip-lock-tables --single-transaction -h$DB_HOST -P$DB_PORT -u$DB_USER -p"$DB_PASSWORD" $DB_NAME > '${DB_FILE}
33+
if ! docker run --rm --env-file=${CONFIG_FILE} -i --network=jms_net -v "${BACKUP_DIR}:${BACKUP_DIR}" "${mysql_images}" bash -c "${backup_cmd}"; then
34+
log_error "$(gettext 'Backup failed')!"
3835
log_error "$(gettext 'Backup failed')!"
3936
rm -f "${DB_FILE}"
4037
exit 1

scripts/6_db_restore.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
44

55
. "${BASE_DIR}/utils.sh"
66

7-
HOST=$(get_config DB_HOST)
8-
PORT=$(get_config DB_PORT)
9-
USER=$(get_config DB_USER)
10-
PASSWORD=$(get_config DB_PASSWORD)
11-
DATABASE=$(get_config DB_NAME)
12-
137
DB_FILE="$1"
8+
BACKUP_DIR=$(dirname "${DB_FILE}")
149

1510
function main() {
1611
echo_warn "$(gettext 'Make sure you have a backup of data, this operation is not reversible')! \n"
17-
restore_cmd="mysql --host=${HOST} --port=${PORT} --user=${USER} --password=${PASSWORD} ${DATABASE}"
1812

1913
if [[ ! -f "${DB_FILE}" ]]; then
2014
echo "$(gettext 'file does not exist'): ${DB_FILE}"
@@ -35,7 +29,8 @@ function main() {
3529
done
3630
fi
3731

38-
if ! docker run --rm -i --network=jms_net "${mysql_images}" $restore_cmd <"${DB_FILE}"; then
32+
restore_cmd='mysql -h$DB_HOST -P$DB_PORT -u$DB_USER -p"$DB_PASSWORD" $DB_NAME < '${DB_FILE}
33+
if ! docker run --rm --env-file=${CONFIG_FILE} -i --network=jms_net -v "${BACKUP_DIR}:${BACKUP_DIR}" "${mysql_images}" bash -c "${restore_cmd}"; then
3934
log_error "$(gettext 'Database recovery failed. Please check whether the database file is complete or try to recover manually')!"
4035
exit 1
4136
else

scripts/const.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,36 @@ STATIC_ENV=${PROJECT_DIR}/static.env
2626
. "${STATIC_ENV}"
2727

2828
export OS=$(uname -s)
29-
export DOCKER_VERSION=24.0.7
29+
export DOCKER_VERSION=25.0.3
3030
export DOCKER_MIRROR="https://download.jumpserver.org/docker/docker-ce/linux/static/stable"
3131
export DOCKER_BIN_URL="${DOCKER_MIRROR}/$(uname -m)/docker-${DOCKER_VERSION}.tgz"
3232
if [[ "$(uname -m)" == "x86_64" ]]; then
33-
DOCKER_MD5=ad4add9b55f71c295e6f8f9e093eb53d
33+
DOCKER_MD5=0ba827cc2a1bd3c4e61c424d81148be7
3434
fi
3535
if [[ "$(uname -m)" == "aarch64" ]]; then
36-
DOCKER_MD5=89be712e6a933321362ced9a4d22baef
36+
DOCKER_MD5=b103d07e8dffeb601128186f6aa0e714
3737
fi
3838
if [[ "$(uname -m)" == "loongarch64" ]]; then
39-
DOCKER_MD5=124492bc9a838fb8e4917cac5833ceae
39+
DOCKER_MD5=8eea6349b4fbda3fd9a0499ec7f03259
4040
fi
4141
if [[ "$(uname -m)" == "s390x" ]]; then
42-
DOCKER_MD5=ca5586e1ba49cd5cab6fdcd03ac443c6
42+
DOCKER_MD5=10d9d1a0c771ebcfbf078a3141d72154
4343
fi
4444
export DOCKER_MD5
4545

46-
export DOCKER_COMPOSE_VERSION=v2.24.0
46+
export DOCKER_COMPOSE_VERSION=v2.24.5
4747
export DOCKER_COMPOSE_MIRROR="https://download.jumpserver.org/docker/compose/releases/download"
4848
export DOCKER_COMPOSE_BIN_URL="${DOCKER_COMPOSE_MIRROR}/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-$(uname -m)"
4949
if [[ "$(uname -m)" == "x86_64" ]]; then
50-
DOCKER_COMPOSE_MD5=fa754fec4f02baa1b7e7f8b1d2ad4a61
50+
DOCKER_COMPOSE_MD5=aea273a344c430d1c89d23b21fa18f63
5151
fi
5252
if [[ "$(uname -m)" == "aarch64" ]]; then
53-
DOCKER_COMPOSE_MD5=0c64adb54fac8e5ccd1fa1cecaca114f
53+
DOCKER_COMPOSE_MD5=3202cc80ff6147d6eb823151c8889622
5454
fi
5555
if [[ "$(uname -m)" == "loongarch64" ]]; then
56-
DOCKER_COMPOSE_MD5=0db3ab0a0e5d63165ab804356d1fe132
56+
DOCKER_COMPOSE_MD5=a7a3372132ba4b241635b06eb74b2a45
5757
fi
5858
if [[ "$(uname -m)" == "s390x" ]]; then
59-
DOCKER_COMPOSE_MD5=a4784eb9505581dce9df97c0b080e8ef
59+
DOCKER_COMPOSE_MD5=53b35fe65a92175ce5dff8ee4e715df5
6060
fi
6161
export DOCKER_COMPOSE_MD5

scripts/utils.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ function is_confirm() {
1717
function random_str() {
1818
len=$1
1919
if [[ -z ${len} ]]; then
20-
len=16
20+
len=24
2121
fi
22-
uuid=None
22+
uuid=""
2323
if command -v dmidecode &>/dev/null; then
24-
uuid=$(dmidecode -t 1 | grep UUID | awk '{print $2}' | base64 | head -c ${len})
24+
if [[ ${len} -gt 24 ]]; then
25+
uuid=$(dmidecode -t 1 | grep UUID | awk '{print $2}' | sha256sum | awk '{print $1}' | head -c ${len})
26+
fi
2527
fi
2628
if [[ "${#uuid}" == "${len}" ]]; then
2729
echo "${uuid}"
2830
else
29-
head -c100 < /dev/urandom | base64 | tr -dc A-Za-z0-9 | head -c ${len}; echo
31+
head -c200 < /dev/urandom | base64 | tr -dc A-Za-z0-9 | head -c ${len}; echo
3032
fi
3133
}
3234

0 commit comments

Comments
 (0)