-
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'amidaware:develop' into develop
- Loading branch information
Showing
799 changed files
with
32,120 additions
and
74,787 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,18 @@ set -e | |
: "${POSTGRES_USER:=tactical}" | ||
: "${POSTGRES_PASS:=tactical}" | ||
: "${POSTGRES_DB:=tacticalrmm}" | ||
: "${MESH_CONTAINER:=tactical-meshcentral}" | ||
: "${MESH_SERVICE:=tactical-meshcentral}" | ||
: "${MESH_WS_URL:=ws://${MESH_SERVICE}:4443}" | ||
: "${MESH_USER:=meshcentral}" | ||
: "${MESH_PASS:=meshcentralpass}" | ||
: "${MESH_HOST:=tactical-meshcentral}" | ||
: "${API_HOST:=tactical-backend}" | ||
: "${APP_HOST:=tactical-frontend}" | ||
: "${REDIS_HOST:=tactical-redis}" | ||
: "${HTTP_PROTOCOL:=http}" | ||
: "${APP_PORT:=8080}" | ||
: "${API_PORT:=8000}" | ||
|
||
: "${CERT_PRIV_PATH:=${TACTICAL_DIR}/certs/privkey.pem}" | ||
: "${CERT_PUB_PATH:=${TACTICAL_DIR}/certs/fullchain.pem}" | ||
|
||
# Add python venv to path | ||
export PATH="${VIRTUAL_ENV}/bin:$PATH" | ||
|
||
|
@@ -37,7 +38,7 @@ function django_setup { | |
sleep 5 | ||
done | ||
|
||
until (echo > /dev/tcp/"${MESH_CONTAINER}"/443) &> /dev/null; do | ||
until (echo > /dev/tcp/"${MESH_SERVICE}"/4443) &> /dev/null; do | ||
echo "waiting for meshcentral container to be ready..." | ||
sleep 5 | ||
done | ||
|
@@ -56,10 +57,12 @@ DEBUG = True | |
DOCKER_BUILD = True | ||
CERT_FILE = '/opt/tactical/certs/fullchain.pem' | ||
KEY_FILE = '/opt/tactical/certs/privkey.pem' | ||
SWAGGER_ENABLED = True | ||
CERT_FILE = '${CERT_PUB_PATH}' | ||
KEY_FILE = '${CERT_PRIV_PATH}' | ||
SCRIPTS_DIR = '${WORKSPACE_DIR}/scripts' | ||
SCRIPTS_DIR = '/community-scripts' | ||
ALLOWED_HOSTS = ['${API_HOST}', '*'] | ||
|
@@ -82,13 +85,15 @@ MESH_USERNAME = '${MESH_USER}' | |
MESH_SITE = 'https://${MESH_HOST}' | ||
MESH_TOKEN_KEY = '${MESH_TOKEN}' | ||
REDIS_HOST = '${REDIS_HOST}' | ||
MESH_WS_URL = '${MESH_WS_URL}' | ||
ADMIN_ENABLED = True | ||
EOF | ||
)" | ||
|
||
echo "${localvars}" > ${WORKSPACE_DIR}/api/tacticalrmm/tacticalrmm/local_settings.py | ||
|
||
# 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 collectstatic --no-input | ||
"${VIRTUAL_ENV}"/bin/python manage.py initial_db_setup | ||
|
@@ -98,6 +103,8 @@ EOF | |
"${VIRTUAL_ENV}"/bin/python manage.py reload_nats | ||
"${VIRTUAL_ENV}"/bin/python manage.py create_natsapi_conf | ||
"${VIRTUAL_ENV}"/bin/python manage.py create_installer_user | ||
"${VIRTUAL_ENV}"/bin/python manage.py post_update_tasks | ||
|
||
|
||
# create super user | ||
echo "from accounts.models import User; User.objects.create_superuser('${TRMM_USER}', '[email protected]', '${TRMM_PASS}') if not User.objects.filter(username='${TRMM_USER}').exists() else 0;" | python manage.py shell | ||
|
@@ -110,22 +117,28 @@ if [ "$1" = 'tactical-init-dev' ]; then | |
|
||
test -f "${TACTICAL_READY_FILE}" && rm "${TACTICAL_READY_FILE}" | ||
|
||
mkdir -p /meshcentral-data | ||
mkdir -p ${TACTICAL_DIR}/tmp | ||
mkdir -p ${TACTICAL_DIR}/certs | ||
mkdir -p /mongo/data/db | ||
mkdir -p /redis/data | ||
touch /meshcentral-data/.initialized && chown -R 1000:1000 /meshcentral-data | ||
touch ${TACTICAL_DIR}/tmp/.initialized && chown -R 1000:1000 ${TACTICAL_DIR} | ||
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 | ||
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 | ||
|
||
# setup Python virtual env and install dependencies | ||
! test -e "${VIRTUAL_ENV}" && python -m venv ${VIRTUAL_ENV} | ||
"${VIRTUAL_ENV}"/bin/python -m pip install --upgrade pip | ||
"${VIRTUAL_ENV}"/bin/pip install --no-cache-dir setuptools wheel | ||
"${VIRTUAL_ENV}"/bin/pip install --no-cache-dir -r /requirements.txt | ||
|
||
django_setup | ||
|
||
# create .env file for frontend | ||
webenv="$(cat << EOF | ||
PROD_URL = "${HTTP_PROTOCOL}://${API_HOST}" | ||
DEV_URL = "${HTTP_PROTOCOL}://${API_HOST}" | ||
APP_URL = "https://${APP_HOST}" | ||
DOCKER_BUILD = 1 | ||
EOF | ||
)" | ||
echo "${webenv}" | tee "${WORKSPACE_DIR}"/web/.env > /dev/null | ||
|
||
# chown everything to tactical user | ||
chown -R "${TACTICAL_USER}":"${TACTICAL_USER}" "${WORKSPACE_DIR}" | ||
chown -R "${TACTICAL_USER}":"${TACTICAL_USER}" "${TACTICAL_DIR}" | ||
|
@@ -154,8 +167,3 @@ if [ "$1" = 'tactical-websockets-dev' ]; then | |
check_tactical_ready | ||
"${VIRTUAL_ENV}"/bin/daphne tacticalrmm.asgi:application --port 8383 -b 0.0.0.0 | ||
fi | ||
|
||
if [ "$1" = 'tactical-mkdocs-dev' ]; then | ||
cd "${WORKSPACE_DIR}/docs" | ||
"${VIRTUAL_ENV}"/bin/mkdocs serve | ||
fi |
Oops, something went wrong.