重构:移除部署脚本中的 SSL 证书操作
SSL 证书已配置完成,不再需要从部署脚本中执行 certbot。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -125,34 +125,6 @@ def check_ssh():
|
||||
log_info("SSH 连接正常")
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# SSL 证书
|
||||
# ============================================================================
|
||||
|
||||
|
||||
def deploy_ssl():
|
||||
"""申请 SSL 证书"""
|
||||
log_section("申请 SSL 证书")
|
||||
ssl_script = PROJECT_DIR / "tools" / "deploy-ssl-cert.py"
|
||||
if not ssl_script.exists():
|
||||
log_error(f"SSL 证书脚本不存在: {ssl_script}")
|
||||
return False
|
||||
|
||||
log_info("上传并执行 SSL 证书脚本...")
|
||||
ok, _, err = scp_file(str(ssl_script), "/tmp/deploy-ssl-cert.py", timeout=120)
|
||||
if not ok:
|
||||
log_error(f"上传 SSL 脚本失败: {err}")
|
||||
return False
|
||||
|
||||
ok, _, err = ssh_command("python3 /tmp/deploy-ssl-cert.py", timeout=300)
|
||||
if not ok:
|
||||
log_error(f"执行 SSL 脚本失败: {err}")
|
||||
return False
|
||||
|
||||
log_info("SSL 证书申请完成")
|
||||
return True
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Nginx 配置
|
||||
# ============================================================================
|
||||
@@ -369,7 +341,6 @@ def main():
|
||||
log_info(f"部署时间: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
|
||||
actions = {
|
||||
"ssl": lambda: check_ssh() or True and deploy_ssl(),
|
||||
"backend": lambda: check_ssh() or True and deploy_backend(),
|
||||
"frontend": lambda: check_ssh() or True and deploy_frontend(),
|
||||
"admin": lambda: check_ssh() or True and deploy_admin(),
|
||||
@@ -381,7 +352,6 @@ def main():
|
||||
|
||||
if deploy_type == "all":
|
||||
check_ssh()
|
||||
deploy_ssl() or True
|
||||
deploy_nginx() or True
|
||||
deploy_backend()
|
||||
deploy_frontend()
|
||||
@@ -392,7 +362,7 @@ def main():
|
||||
actions[deploy_type]()
|
||||
else:
|
||||
log_error(f"无效的部署类型: {deploy_type}")
|
||||
print("使用方法: python deploy.py [ssl|backend|frontend|admin|life-script|nginx|verify|all]")
|
||||
print("使用方法: python deploy.py [backend|frontend|admin|life-script|nginx|verify|all]")
|
||||
sys.exit(1)
|
||||
|
||||
duration = int(time.time() - start_time)
|
||||
|
||||
Reference in New Issue
Block a user