From 57fc5ac0880af0ce437951bbc9b0de28f8e956cb Mon Sep 17 00:00:00 2001 From: sadnub Date: Wed, 3 May 2023 17:58:19 -0400 Subject: [PATCH] docker and install script fixes --- .devcontainer/entrypoint.sh | 5 +++++ docker/containers/tactical-nginx/entrypoint.sh | 6 ++++++ docker/containers/tactical/entrypoint.sh | 5 +++++ install.sh | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index 025fb66f..ea1db04b 100644 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -106,6 +106,7 @@ EOF # run migrations and init scripts "${VIRTUAL_ENV}"/bin/python manage.py pre_update_tasks "${VIRTUAL_ENV}"/bin/python manage.py migrate --no-input + "${VIRTUAL_ENV}"/bin/python manage.py generate_json_schemas "${VIRTUAL_ENV}"/bin/python manage.py collectstatic --no-input "${VIRTUAL_ENV}"/bin/python manage.py initial_db_setup "${VIRTUAL_ENV}"/bin/python manage.py initial_mesh_setup @@ -113,6 +114,7 @@ EOF "${VIRTUAL_ENV}"/bin/python manage.py load_community_scripts "${VIRTUAL_ENV}"/bin/python manage.py reload_nats "${VIRTUAL_ENV}"/bin/python manage.py create_natsapi_conf + "${VIRTUAL_ENV}"/bin/python manage.py setup_reporting_permissions "${VIRTUAL_ENV}"/bin/python manage.py create_installer_user "${VIRTUAL_ENV}"/bin/python manage.py post_update_tasks @@ -131,6 +133,8 @@ if [ "$1" = 'tactical-init-dev' ]; then mkdir -p /meshcentral-data mkdir -p ${TACTICAL_DIR}/tmp mkdir -p ${TACTICAL_DIR}/certs + mkdir -p ${TACTICAL_DIR}/reporting + mkdir -p ${TACTICAL_DIR}/reporting/assets mkdir -p /mongo/data/db mkdir -p /redis/data touch /meshcentral-data/.initialized && chown -R 1000:1000 /meshcentral-data @@ -138,6 +142,7 @@ if [ "$1" = 'tactical-init-dev' ]; then touch ${TACTICAL_DIR}/certs/.initialized && chown -R 1000:1000 ${TACTICAL_DIR}/certs touch /mongo/data/db/.initialized && chown -R 1000:1000 /mongo/data/db touch /redis/data/.initialized && chown -R 1000:1000 /redis/data + touch ${TACTICAL_DIR}/reporting && chown -R 1000:1000 ${TACTICAL_DIR}/reporting mkdir -p ${TACTICAL_DIR}/api/tacticalrmm/private/exe mkdir -p ${TACTICAL_DIR}/api/tacticalrmm/private/log touch ${TACTICAL_DIR}/api/tacticalrmm/private/log/django_debug.log diff --git a/docker/containers/tactical-nginx/entrypoint.sh b/docker/containers/tactical-nginx/entrypoint.sh index 75a233f4..dabb5086 100644 --- a/docker/containers/tactical-nginx/entrypoint.sh +++ b/docker/containers/tactical-nginx/entrypoint.sh @@ -77,6 +77,7 @@ server { location /static/ { root ${TACTICAL_DIR}/api; + add_header "Access-Control-Allow-Origin" "https://${APP_HOST}"; } location /private/ { @@ -100,6 +101,11 @@ server { proxy_set_header X-Forwarded-Host \$server_name; } + location /assets/ { + internal; + alias /opt/tactical/reporting/; + } + location ~ ^/natsws { set \$natswebsocket http://${NATS_SERVICE}:9235; proxy_pass \$natswebsocket; diff --git a/docker/containers/tactical/entrypoint.sh b/docker/containers/tactical/entrypoint.sh index d796a129..bfd0903a 100644 --- a/docker/containers/tactical/entrypoint.sh +++ b/docker/containers/tactical/entrypoint.sh @@ -40,6 +40,8 @@ if [ "$1" = 'tactical-init' ]; then mkdir -p /meshcentral-data mkdir -p ${TACTICAL_DIR}/tmp mkdir -p ${TACTICAL_DIR}/certs + mkdir -p ${TACTICAL_DIR}/reporting + mkdir -p ${TACTICAL_DIR}/reporting/assets mkdir -p /mongo/data/db mkdir -p /redis/data touch /meshcentral-data/.initialized && chown -R 1000:1000 /meshcentral-data @@ -47,6 +49,7 @@ if [ "$1" = 'tactical-init' ]; then touch ${TACTICAL_DIR}/certs/.initialized && chown -R 1000:1000 ${TACTICAL_DIR}/certs touch /mongo/data/db/.initialized && chown -R 1000:1000 /mongo/data/db touch /redis/data/.initialized && chown -R 1000:1000 /redis/data + touch ${TACTICAL_DIR}/reporting && chown -R 1000:1000 ${TACTICAL_DIR}/reporting mkdir -p ${TACTICAL_DIR}/api/tacticalrmm/private/exe mkdir -p ${TACTICAL_DIR}/api/tacticalrmm/private/log touch ${TACTICAL_DIR}/api/tacticalrmm/private/log/django_debug.log @@ -114,6 +117,7 @@ EOF # run migrations and init scripts python manage.py pre_update_tasks python manage.py migrate --no-input + python manage.py generate_json_schemas python manage.py collectstatic --no-input python manage.py initial_db_setup python manage.py initial_mesh_setup @@ -123,6 +127,7 @@ EOF python manage.py create_natsapi_conf python manage.py create_uwsgi_conf python manage.py create_installer_user + python manage.py setup_reporting_permissions python manage.py clear_redis_celery_locks python manage.py post_update_tasks diff --git a/install.sh b/install.sh index f9c50a09..fb508b9f 100644 --- a/install.sh +++ b/install.sh @@ -521,12 +521,12 @@ pip install --no-cache-dir --upgrade pip pip install --no-cache-dir setuptools==${SETUPTOOLS_VER} wheel==${WHEEL_VER} pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt python manage.py migrate +python manage.py generate_json_schemas python manage.py collectstatic --no-input python manage.py create_natsapi_conf python manage.py create_uwsgi_conf python manage.py load_chocos python manage.py load_community_scripts -python manage.py generate_json_schemas python manage.py setup_reporting_permissions WEB_VERSION=$(python manage.py get_config webversion) printf >&2 "${YELLOW}%0.s*${NC}" {1..80}