Skip to content

Commit 932143d

Browse files
committed
Update Zabbix to 7.0.20 and ui libs and adapt letsencrypt
1 parent 9fa7dd9 commit 932143d

13 files changed

Lines changed: 204 additions & 118 deletions

File tree

build-images.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ buildah config --entrypoint=/ \
4444
--label="org.nethserver.authorizations=node:fwadm traefik@any:routeadm" \
4545
--label="org.nethserver.tcp-ports-demand=1" \
4646
--label="org.nethserver.rootfull=0" \
47-
--label="org.nethserver.images=docker.io/postgres:15.14-alpine docker.io/zabbix/zabbix-server-pgsql:7.0.19-alpine docker.io/zabbix/zabbix-agent2:7.0.19-alpine docker.io/zabbix/zabbix-web-nginx-pgsql:7.0.19-alpine" \
47+
--label="org.nethserver.min-core=3.12.4-0" \
48+
--label="org.nethserver.images=docker.io/postgres:15.14-alpine docker.io/zabbix/zabbix-server-pgsql:7.0.20-alpine docker.io/zabbix/zabbix-agent2:7.0.20-alpine docker.io/zabbix/zabbix-web-nginx-pgsql:7.0.20-alpine" \
4849
"${container}"
4950
# Commit the image
5051
buildah commit "${container}" "${repobase}/${reponame}"

imageroot/actions/configure-module/01Hostname_validation

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ agent.set_weight(os.path.basename(__file__), 0) # Validation step, no task progr
1919
data = json.load(sys.stdin)
2020

2121
# Setup default values
22-
host = data.get("host")
22+
host = data["host"]
2323
# do not test if it is the same host
2424
oldHost = os.environ.get('TRAEFIK_HOST','')
2525

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python3
2+
3+
#
4+
# Copyright (C) 2022 Nethesis S.r.l.
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
#
7+
8+
import json
9+
import sys
10+
import agent
11+
import os
12+
13+
# Try to parse the stdin as JSON.
14+
# If parsing fails, output everything to stderr
15+
data = json.load(sys.stdin)
16+
17+
# Setup default values
18+
host = data["host"]
19+
h2hs = data.get("http2https", True)
20+
21+
# Configure Traefik route for API
22+
set_route_data = {
23+
'instance': os.environ['MODULE_ID'],
24+
'url': 'http://127.0.0.1:' + os.environ["TCP_PORT"],
25+
'host': host,
26+
'http2https': h2hs,
27+
'lets_encrypt_check': True,
28+
'lets_encrypt_cleanup': True,
29+
}
30+
if 'lets_encrypt' in data:
31+
set_route_data['lets_encrypt'] = data['lets_encrypt']
32+
33+
agent.set_route(set_route_data)

imageroot/actions/configure-module/10configure_environment_vars

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import agent
1313
# If parsing fails, output everything to stderr
1414
data = json.load(sys.stdin)
1515

16+
# Setup default values
17+
host = data.get("host")
18+
h2hs = data.get("http2https", True)
19+
20+
agent.set_env("TRAEFIK_HOST", host)
21+
agent.set_env("TRAEFIK_HTTP2HTTPS", h2hs)
22+
1623
#This is specific to you module, so you need to change it accordingly.
1724
# we read a json stdin {"vars1":true, "var2":"foo", "vars3": 3} and we writ it to .config/state/environment
1825
# Upper case to set environment variable and minor case to read from stdin
Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1 @@
1-
#!/usr/bin/env python3
2-
3-
#
4-
# Copyright (C) 2022 Nethesis S.r.l.
5-
# SPDX-License-Identifier: GPL-3.0-or-later
6-
#
7-
8-
import json
9-
import sys
10-
import agent
11-
import agent.tasks
12-
import os
13-
14-
# Try to parse the stdin as JSON.
15-
# If parsing fails, output everything to stderr
16-
data = json.load(sys.stdin)
17-
18-
# Setup default values
19-
host = data.get("host")
20-
h2hs = data.get("http2https", True)
21-
le = data.get("lets_encrypt", False)
22-
23-
# Talk with agent using file descriptor.
24-
# Setup configuration from user input.
25-
agent.set_env("TRAEFIK_HOST", host)
26-
agent.set_env("TRAEFIK_HTTP2HTTPS", h2hs)
27-
agent.set_env("TRAEFIK_LETS_ENCRYPT", le)
28-
29-
# Make sure everything is saved inside the environment file
30-
# just before starting systemd unit
31-
agent.dump_env()
32-
33-
# Find default traefik instance for current node
34-
default_traefik_id = agent.resolve_agent_id('traefik@node')
35-
if default_traefik_id is None:
36-
sys.exit(2)
37-
38-
response = agent.tasks.run(
39-
agent_id=agent.resolve_agent_id('traefik@node'),
40-
action='set-route',
41-
data={
42-
'instance': os.environ['MODULE_ID'],
43-
'url': 'http://127.0.0.1:' + os.environ["TCP_PORT"],
44-
'host': host,
45-
'http2https': h2hs,
46-
'lets_encrypt': le
47-
},
48-
)
49-
50-
# Check if traefik configuration has been successfull
51-
agent.assert_exp(response['exit_code'] == 0)
1+
# Placeholder, see bug NethServer/dev#7058

imageroot/actions/configure-module/validate-input.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
],
1313
"type": "object",
1414
"required": [
15-
"host",
16-
"http2https",
17-
"lets_encrypt"
15+
"host"
1816
],
1917
"properties": {
2018
"host": {
Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1 @@
1-
#!/usr/bin/env python3
2-
3-
#
4-
# Copyright (C) 2023 Nethesis S.r.l.
5-
# SPDX-License-Identifier: GPL-3.0-or-later
6-
#
7-
8-
# Remove traefik route
9-
10-
import os
11-
import sys
12-
import json
13-
import agent
14-
import agent.tasks
15-
16-
# Try to parse the stdin as JSON.
17-
# If parsing fails, output everything to stderr
18-
data = json.load(sys.stdin)
19-
20-
# Find default traefik instance for current node
21-
default_traefik_id = agent.resolve_agent_id('traefik@node')
22-
if default_traefik_id is None:
23-
sys.exit(2)
24-
25-
# Remove traefik route
26-
response = agent.tasks.run(
27-
agent_id=default_traefik_id,
28-
action='delete-route',
29-
data={
30-
'instance': os.environ['MODULE_ID']
31-
},
32-
)
33-
34-
# Check if traefik configuration has been successfull
35-
agent.assert_exp(response['exit_code'] == 0)
1+
# Placeholder, see bug NethServer/dev#7058

imageroot/actions/get-configuration/20read

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ config = {}
2020
# Read current configuration from the environment file
2121
config["host"] = os.getenv("TRAEFIK_HOST","")
2222
config["http2https"] = os.getenv("TRAEFIK_HTTP2HTTPS") == "True"
23-
config["lets_encrypt"] = os.getenv("TRAEFIK_LETS_ENCRYPT") == "True"
23+
config["lets_encrypt"] = agent.get_route(os.environ['MODULE_ID']).get('lets_encrypt', False)
2424
config["servername"] = os.getenv("ZBX_SERVER_NAME")
2525
config["timezone"] = os.getenv("PHP_TZ")
2626

imageroot/actions/restore-module/06copyenv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ original_environment = request['environment']
1616
for evar in [
1717
"TRAEFIK_HOST",
1818
"TRAEFIK_HTTP2HTTPS",
19-
"TRAEFIK_LETS_ENCRYPT",
2019
"ZBX_SERVER_NAME",
2120
"PHP_TZ",
2221
]:

imageroot/actions/restore-module/50traefik

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import agent
99
import os
1010

11+
request = json.load(sys.stdin)
12+
renv = request['environment']
13+
1114
configure_retval = agent.tasks.run(agent_id=os.environ['AGENT_ID'], action='configure-module', data={
12-
"lets_encrypt": os.environ.get("TRAEFIK_LETS_ENCRYPT",False) == "True",
13-
"host": os.environ.get("TRAEFIK_HOST","zabbix.test.com"),
14-
"http2https": os.environ.get("TRAEFIK_HTTP2HTTPS",False) == "True",
15-
"servername": os.environ.get("ZBX_SERVER_NAME",""),
16-
"timezone": os.environ.get("PHP_TZ","Europe/Riga")
15+
"host": renv["TRAEFIK_HOST"],
16+
"http2https": renv["TRAEFIK_HTTP2HTTPS"] == "True",
17+
"servername": renv["ZBX_SERVER_NAME"],
18+
"timezone": renv["PHP_TZ"]
1719
})
1820
agent.assert_exp(configure_retval['exit_code'] == 0, "The configure-module subtask failed! You can run just one instance on a node.")

0 commit comments

Comments
 (0)