update mesh ports for persistent mesh configuration

This commit is contained in:
sadnub 2022-02-01 22:15:08 -05:00
parent fbc04afa5b
commit f61329b5de
2 changed files with 10 additions and 5 deletions

View File

@ -10,8 +10,7 @@ SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
COPY api/tacticalrmm/tacticalrmm/settings.py /tmp/settings.py
RUN grep -o 'MESH_VER.*' /tmp/settings.py | cut -d'"' -f 2 > /tmp/MESH_VER && \
npm install meshcentral@$(cat /tmp/MESH_VER)
RUN npm install meshcentral@$(grep -o 'MESH_VER.*' /tmp/settings.py | cut -d'"' -f 2)
RUN chown -R node:node /home/node

View File

@ -21,9 +21,9 @@ set -e
if [ ! -f "/home/node/app/meshcentral-data/config.json" ] || [[ "${MESH_PERSISTENT_CONFIG}" -eq 0 ]]; then
encoded_uri=$(node -p "encodeURI('mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@${MONGODB_HOST}:${MONGODB_PORT}')")
encoded_uri=$(node -p "encodeURI('mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@${MONGODB_HOST}:${MONGODB_PORT}')")
mesh_config="$(cat << EOF
mesh_config="$(cat << EOF
{
"settings": {
"mongodb": "${encoded_uri}",
@ -71,7 +71,13 @@ mesh_config="$(cat << EOF
EOF
)"
echo "${mesh_config}" > /home/node/app/meshcentral-data/config.json
echo "${mesh_config}" > /home/node/app/meshcentral-data/config.json
else
# replace persistent mesh configuration with new ports
sed -i 's/"Port": 443/"Port": 4443/' /home/node/app/meshcentral-data/config.json
sed -i 's/"RedirPort": 80/"RedirPort": 8080/' /home/node/app/meshcentral-data/config.json
sed -i "s/\"CertUrl\": \".*\"/\"CertUrl\": \"https:\/\/${NGINX_HOST_IP}:${NGINX_HOST_PORT}\"/" /home/node/app/meshcentral-data/config.json
fi