Skip to content

Commit 39db5ed

Browse files
committed
fix: tz
1 parent dd77875 commit 39db5ed

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

docker/backup.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import os
23
import re
34
import sys
@@ -6,7 +7,7 @@
67
from urllib.parse import urlparse
78
import boto3
89
from botocore.client import Config
9-
import requests
10+
import time
1011

1112
# 数据库清理备份脚本
1213
# 1. 按要求备份数据,并保存到指定路径
@@ -89,13 +90,16 @@ def check_bool(key):
8990
s3_bucket = os.environ["S3_BUCKET"] if check_var("S3_BUCKET") else None
9091
s3_prefix = os.environ["S3_PREFIX"] if check_var("S3_PREFIX") else DEFAULT_S3_PREFIX
9192
s3_region = os.environ["S3_REGION"] if check_var("S3_REGION") else None
92-
s3_region = os.environ["S3_REGION"] if check_var("S3_REGION") else None
9393
s3_signature_version = (
9494
os.environ["S3_SIGNATURE_VERSION"] if check_var("S3_SIGNATURE_VERSION") else None
9595
)
9696

9797
# 计算当前日期,按照 年月日时分 格式
98-
date = (datetime.now() + timedelta(hours=8)).strftime("%Y%m%d%H%M%S")
98+
date = (
99+
datetime.now() + timedelta(hours=8)
100+
if not time.localtime().tm_gmtoff
101+
else datetime.now()
102+
).strftime("%Y%m%d%H%M%S")
99103

100104

101105
def get_dbname_from_mongo_uri(uri):
@@ -185,7 +189,9 @@ def upload_s3(prefix):
185189
config_s3["addressing_style"] = "virtual"
186190

187191
if s3_region and s3_signature_version:
188-
config = Config(s3=config_s3, signature_version="s3", region_name=s3_region)
192+
config = Config(
193+
s3=config_s3, signature_version=s3_signature_version, region_name=s3_region
194+
)
189195
elif s3_region:
190196
config = Config(s3=config_s3, region_name=s3_region)
191197
elif s3_signature_version:

docker/restore.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# -*- coding: utf-8 -*-
12
import os
23
import re
34
import sys
45
from datetime import datetime, timedelta
56
import subprocess
67
import boto3
78
from botocore.client import Config
9+
import time
810

911
# 数据库还原
1012

@@ -66,7 +68,11 @@ def check_bool(key):
6668
s3_prefix = os.environ["S3_PREFIX"] if check_var("S3_PREFIX") else DEFAULT_S3_PREFIX
6769
s3_region = os.environ["S3_REGION"] if check_var("S3_REGION") else None
6870

69-
date = (datetime.now() + timedelta(hours=8)).strftime("%Y%m%d%H%M%S")
71+
date = (
72+
datetime.now() + timedelta(hours=8)
73+
if not time.localtime().tm_gmtoff
74+
else datetime.now()
75+
).strftime("%Y%m%d%H%M%S")
7076

7177

7278
def get_files(compiled_regex):

helm-chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.6.2
18+
version: 1.6.3
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "1.6.2"
24+
appVersion: "1.6.3"

0 commit comments

Comments
 (0)