Skip to content

Commit

Permalink
Update traefik configuration and remove systemd script
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Jan 5, 2024
1 parent 2f84a60 commit 442d10c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 38 deletions.
33 changes: 11 additions & 22 deletions imageroot/actions/restore-module/50traefik
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!")
16 changes: 0 additions & 16 deletions imageroot/actions/restore-module/60systemd

This file was deleted.

0 comments on commit 442d10c

Please sign in to comment.