diff --git a/tutoraspects/plugin.py b/tutoraspects/plugin.py index af50fdfe8..700d6a1f1 100644 --- a/tutoraspects/plugin.py +++ b/tutoraspects/plugin.py @@ -353,8 +353,6 @@ ("DBT_REPOSITORY", "https://github.com/openedx/aspects-dbt"), ("DBT_BRANCH", "v3.4.1"), ("DBT_SSH_KEY", ""), - # Path to the dbt project inside the repository - ("DBT_REPOSITORY_PATH", "aspects-dbt"), # This is a pip compliant list of Python packages to install to run dbt # make sure packages with versions are enclosed in double quotes ("EXTRA_DBT_PACKAGES", []), diff --git a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh index 27b262fc3..cca3643ca 100644 --- a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh +++ b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh @@ -16,13 +16,13 @@ ssh -o StrictHostKeyChecking=no git@github.com || true ssh-add /root/.ssh/id_rsa {% endif %} -rm -rf {{ DBT_REPOSITORY_PATH }} +rm -rf aspects-dbt echo "Installing aspects-dbt" echo "git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }}" -git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }} +git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }} aspects-dbt -cd {{ DBT_REPOSITORY_PATH }} || exit +cd aspects-dbt || exit export ASPECTS_EVENT_SINK_DATABASE={{ASPECTS_EVENT_SINK_DATABASE}} export ASPECTS_XAPI_DATABASE={{ASPECTS_XAPI_DATABASE}} @@ -33,4 +33,4 @@ dbt deps --profiles-dir /app/aspects/dbt/ echo "Running dbt $*" dbt "$@" --profiles-dir /app/aspects/dbt/ -rm -rf {{ DBT_REPOSITORY_PATH }} +rm -rf aspects-dbt diff --git a/tutoraspects/templates/aspects/jobs/init/aspects/init-aspects.sh b/tutoraspects/templates/aspects/jobs/init/aspects/init-aspects.sh index f843b09ff..816b96ded 100644 --- a/tutoraspects/templates/aspects/jobs/init/aspects/init-aspects.sh +++ b/tutoraspects/templates/aspects/jobs/init/aspects/init-aspects.sh @@ -1,45 +1,5 @@ #!/usr/bin/env bash -## WARNING: If you modify this block, make sure to also update the -## corresponding block in the alembic.sh file. +bash /app/aspects/scripts/alembic.sh upgrade head -cd /app/aspects/migrations - -alembic upgrade head - -cd - - -## WARNING: If you modify this block, make sure to also update the -## corresponding block in the dbt.sh file. - -echo "Installing dbt packages..." - -pip install -r /app/aspects/dbt/requirements.txt - -{% if DBT_SSH_KEY %} -mkdir -p /root/.ssh -echo "{{ DBT_SSH_KEY}}" | tr -d '\r' > /root/.ssh/id_rsa -chmod 600 /root/.ssh/id_rsa -eval `ssh-agent -s` -ssh -o StrictHostKeyChecking=no git@github.com || true -ssh-add /root/.ssh/id_rsa -{% endif %} - -rm -rf {{ DBT_REPOSITORY_PATH }} - -echo "Installing aspects-dbt" -echo "git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }}" -git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }} - -cd {{ DBT_REPOSITORY_PATH }} || exit - -export ASPECTS_EVENT_SINK_DATABASE={{ASPECTS_EVENT_SINK_DATABASE}} -export ASPECTS_XAPI_DATABASE={{ASPECTS_XAPI_DATABASE}} - -echo "Installing dbt dependencies" -dbt deps --profiles-dir /app/aspects/dbt/ - -echo "Running dbt $*" -dbt run --profiles-dir /app/aspects/dbt/ - -rm -rf {{ DBT_REPOSITORY_PATH }} +bash /app/aspects/scripts/dbt.sh run