mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-25 09:00:26 +00:00
Fix bug related to application binding domain
This commit is contained in:
parent
6b867f0743
commit
dad4781508
5 changed files with 50 additions and 9 deletions
|
@ -20,7 +20,7 @@ user_pwd = L@BI75LJ7Shi7oLA
|
|||
key = bd3d92e0f52e299d014c38f8aac7f730602a8a7a41adbee77eddf07b391b9d31
|
||||
|
||||
[domain]
|
||||
wildcard_domain = test.websoft9.cn
|
||||
wildcard_domain =
|
||||
|
||||
[cockpit]
|
||||
port = 9000
|
||||
|
@ -29,5 +29,4 @@ port = 9000
|
|||
keys =
|
||||
|
||||
[favorite_apps]
|
||||
keys = kibana
|
||||
|
||||
keys =
|
||||
|
|
|
@ -5,4 +5,4 @@ path = /websoft9/library/apps
|
|||
path = /websoft9/media/json/
|
||||
|
||||
[max_apps]
|
||||
key = 2
|
||||
key =
|
||||
|
|
15
apphub/src/external/gitea_api.py
vendored
15
apphub/src/external/gitea_api.py
vendored
|
@ -105,6 +105,21 @@ class GiteaAPI:
|
|||
params={"ref": "main"}
|
||||
)
|
||||
|
||||
def get_file_raw_from_repo(self, repo_name: str, file_path: str):
|
||||
"""
|
||||
Get file raw from repository
|
||||
|
||||
Args:
|
||||
repo_name (str): Repository name
|
||||
file_path (str): File path
|
||||
|
||||
Returns:
|
||||
Response: Response from Gitea API
|
||||
"""
|
||||
return self.api.get(
|
||||
path=f"repos/{self.owner}/{repo_name}/raw/{file_path}"
|
||||
)
|
||||
|
||||
def update_file_content_in_repo(self, repo_name: str, file_path: str, content: str, sha: str):
|
||||
"""
|
||||
Update file content in repository
|
||||
|
|
10
apphub/src/services/app_manager.py
Executable file → Normal file
10
apphub/src/services/app_manager.py
Executable file → Normal file
|
@ -995,13 +995,19 @@ class AppManger:
|
|||
# redeploy app
|
||||
self.redeploy_app(app_id,False)
|
||||
|
||||
# Get the forward scheme form env file: http or https
|
||||
|
||||
# Get the nginx proxy config
|
||||
advanced_config = GiteaManager().get_file_raw_from_repo(app_id, "src/nginx-proxy.conf")
|
||||
if advanced_config:
|
||||
proxy_host = proxyManager.create_proxy_by_app(domain_names, app_id, forward_port, advanced_config, forward_scheme=forward_scheme)
|
||||
else:
|
||||
proxy_host = proxyManager.create_proxy_by_app(domain_names, app_id, forward_port, forward_scheme=forward_scheme)
|
||||
|
||||
if proxy_host:
|
||||
logger.access(f"Created domains: {domain_names} for app: [{app_id}]")
|
||||
return proxy_host
|
||||
else:
|
||||
logger.error(f"Create app:{app_id} proxy error")
|
||||
logger.error(f"Failed to create proxy host for app: [{app_id}]")
|
||||
raise CustomException()
|
||||
else:
|
||||
logger.error(f"Get app:{app_id} forward_port error")
|
||||
|
|
|
@ -131,3 +131,24 @@ class GiteaManager:
|
|||
if response.status_code != 204:
|
||||
logger.error(f"Remove repo:{repo_name} error:{response.status_code}:{response.text}")
|
||||
raise CustomException()
|
||||
|
||||
def get_file_raw_from_repo(self, repo_name: str, file_path: str):
|
||||
"""
|
||||
Get a file from a repository
|
||||
|
||||
Args:
|
||||
repo_name (str): Repository name
|
||||
file_path (str): File path
|
||||
|
||||
Returns:
|
||||
dict: File content
|
||||
"""
|
||||
response = self.gitea.get_file_raw_from_repo(repo_name, file_path)
|
||||
if response.status_code == 200:
|
||||
return response.text
|
||||
elif response.status_code == 404:
|
||||
return None
|
||||
else:
|
||||
logger.error(f"Get file:{file_path} content from repo:{repo_name} error:{response.status_code}:{response.text}")
|
||||
raise CustomException()
|
||||
|
||||
|
|
Loading…
Reference in a new issue