forked from NethServer/ns8-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update traefik configuration and remove systemd script
- Loading branch information
Showing
2 changed files
with
11 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2022 Nethesis S.r.l. | ||
# Copyright (C) 2023 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import os | ||
import sys | ||
import json | ||
import agent | ||
import agent.tasks | ||
|
||
# Find default traefik instance for current node | ||
default_traefik_id = agent.resolve_agent_id('traefik@node') | ||
if default_traefik_id is None: | ||
sys.exit(2) | ||
import os | ||
|
||
# Configure traefik virtual host | ||
response = agent.tasks.run( | ||
agent_id=default_traefik_id, | ||
action='set-route', | ||
data={ | ||
'instance': os.environ['MODULE_ID'], | ||
'url': f'http://127.0.0.1:{os.environ["TCP_PORT"]}', | ||
'host': os.environ["TRAEFIK_HOST"], | ||
'lets_encrypt': os.environ["TRAEFIK_LETS_ENCRYPT"] == True, | ||
'http2https': os.environ["TRAEFIK_HTTP2HTTPS"] == True | ||
}, | ||
) | ||
request = json.load(sys.stdin) | ||
renv = request['environment'] | ||
|
||
# Check if traefik configuration has been successfull | ||
agent.assert_exp(response['exit_code'] == 0) | ||
configure_retval = agent.tasks.run(agent_id=os.environ['AGENT_ID'], action='configure-module', data={ | ||
"lets_encrypt": renv["TRAEFIK_LETS_ENCRYPT"], | ||
"host": renv["TRAEFIK_HOST"], | ||
"http2https": renv["TRAEFIK_HTTP2HTTPS"], | ||
}) | ||
agent.assert_exp(configure_retval['exit_code'] == 0, "The configure-module subtask failed!") |
This file was deleted.
Oops, something went wrong.