Skip to content

Commit

Permalink
Merge pull request #57 from NethServer/sdl-7204
Browse files Browse the repository at this point in the history
Add symlink for restore-module configuration in clone-module NethServer/dev#7204
  • Loading branch information
stephdl authored Dec 12, 2024
2 parents 44ceec2 + 4a6f207 commit c277d82
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions imageroot/actions/clone-module/20initialize
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

exec 1>&2 # Send any output to stderr, to not alter the action response protocol
set -e

start=$(echo $TCP_PORTS_RANGE | cut -d'-' -f1)

ovpn_udp_port=$start
api_port=$(($start+1))
ui_port=$(($start+2))
proxy_port=$(($start+3))
promtail_port=$(($start+4))
# port 6 and 7 are reserved for loki
# port 8 is reserved for prometheus
# port 9 is reserved for grafana
webssh_port=$(($start+9))
db_port=$(($start+10))

num=$(echo $MODULE_ID | sed 's/nethsecurity\-controller//')

# the port range has changed we must update the ports in the network.env file
cat << EOF > network.env
OVPN_UDP_PORT=$ovpn_udp_port
OVPN_TUN=tunnsc$num
API_PORT=$api_port
API_BIND_IP=127.0.0.1
LISTEN_ADDRESS=127.0.0.1:$api_port
UI_PORT=$ui_port
UI_BIND_IP=127.0.0.1
PROXY_PORT=$proxy_port
PROXY_BIND_UI=127.0.0.1
WEBSSH_PORT=$webssh_port
EOF

# replace the ports in the db.env file
sed -i "s/^POSTGRES_PORT=.*/POSTGRES_PORT=$db_port/" db.env
sed -i "s|^\(REPORT_DB_URI=postgres://report:[^@]*@127.0.0.1:\)[0-9]\{1,\}|\1$db_port|" db.env

mkdir -p clients
1 change: 1 addition & 0 deletions imageroot/actions/clone-module/30configure

0 comments on commit c277d82

Please sign in to comment.