Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 846b528

Browse files
authored
feat: add insights service (#818)
* feat: add insights service * fix: insights requirements * style: more consistent shell invoke * docs: add insights to readme
1 parent 15acc23 commit 846b528

10 files changed

Lines changed: 79 additions & 2 deletions

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ dev.shell.studio_watcher:
476476
dev.shell.xqueue_consumer:
477477
docker-compose exec xqueue_consumer env TERM=$(TERM) /edx/app/xqueue/devstack.sh open
478478

479+
dev.shell.insights:
480+
docker-compose exec insights env TERM=$(TERM) bash -c 'eval $$(source /edx/app/insights/insights_env; echo PATH="$$PATH";) && /edx/app/insights/devstack.sh open'
481+
479482
dev.shell.%: ## Run a shell on the specified service's container.
480483
docker-compose exec $* /bin/bash
481484

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ Instead of a service name or list, you can also run commands like ``make dev.pro
316316
+------------------------------------+-------------------------------------+----------------+--------------+
317317
| `coursegraph` | http://localhost:7474/browser | Tooling (Java) | Extra |
318318
+------------------------------------+-------------------------------------+----------------+--------------+
319+
| `insights` | http://localhost:18110 | Python/Django | Extra |
320+
+------------------------------------+-------------------------------------+----------------+--------------+
319321

320322
Some common service combinations include:
321323

check.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ if should_check xqueue; then
109109
"curl --fail -L http://localhost:18040/xqueue/status"
110110
fi
111111

112+
if should_check insights; then
113+
echo "Running Analytics Dashboard Devstack tests: "
114+
run_check insights_heartbeat insights \
115+
"curl --fail -L http://localhost:18110/health/"
116+
fi
117+
112118
echo "Successful checks:${succeeded:- NONE}"
113119
echo "Failed checks:${failed:- NONE}"
114120
if [[ "$succeeded" ]]; then

docker-compose-host.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ services:
5050
- edxapp_tox:/edx/app/edxapp/edx-platform/.tox
5151
- edxapp_uploads:/edx/var/edxapp/uploads
5252
- ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
53+
insights:
54+
volumes:
55+
- ${DEVSTACK_WORKSPACE}/edx-analytics-dashboard:/edx/app/insights/insights
56+
- insights_node_modules:/edx/app/insights/insights/node_modules
5357

5458
# Note that frontends mount `src` to /edx/app/src instead of /edx/src.
5559
# See ADR #5 for rationale.
@@ -99,6 +103,7 @@ volumes:
99103
credentials_node_modules:
100104
discovery_node_modules:
101105
ecommerce_node_modules:
106+
insights_node_modules:
102107
edxapp_media:
103108
edxapp_node_modules:
104109
edxapp_uploads:

docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,35 @@ services:
368368
volumes:
369369
- edxapp_lms_assets:/edx/var/edxapp/staticfiles/
370370

371+
insights:
372+
command: bash -c 'source /edx/app/insights/insights_env && while true; do python /edx/app/insights/insights/manage.py runserver 0.0.0.0:18110 --settings analytics_dashboard.settings.devstack; sleep 2; done'
373+
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.insights"
374+
hostname: insights.devstack.edx
375+
depends_on:
376+
- mysql57
377+
- lms
378+
- memcached
379+
# Allows attachment to the insights service using 'docker attach <containerID>'.
380+
stdin_open: true
381+
tty: true
382+
environment:
383+
DB_HOST: edx.devstack.mysql57
384+
DB_NAME: dashboard
385+
DB_PORT: 3306
386+
DB_USER: rozencrantz
387+
DB_PASSWORD: secret
388+
LMS_HOST: http://localhost:18000
389+
DJANGO_SETTINGS_MODULE: analytics_dashboard.settings.devstack
390+
image: edxops/insights:${OPENEDX_RELEASE:-latest}
391+
networks:
392+
default:
393+
aliases:
394+
- edx.devstack.insights
395+
ports:
396+
- "18110:18110"
397+
volumes:
398+
- /edx/var/insights/
399+
371400
registrar:
372401
command: bash -c 'source /edx/app/registrar/registrar_env && while true; do python /edx/app/registrar/registrar/manage.py runserver 0.0.0.0:18734; sleep 2; done'
373402
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.registrar"

options.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-gradebook+front
7474
# Separated by plus signs.
7575
# Separated by plus signs. Listed in alphabetical order for clarity.
7676
EDX_SERVICES ?= \
77-
credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-account+frontend-app-course-authoring+frontend-app-gradebook+frontend-app-learning+frontend-app-library-authoring+frontend-app-payment+frontend-app-program-console+frontend-app-publisher+lms+lms_watcher+registrar+registrar-worker+studio+studio_watcher+xqueue+xqueue_consumer
77+
credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-account+frontend-app-course-authoring+frontend-app-gradebook+frontend-app-learning+frontend-app-library-authoring+frontend-app-payment+frontend-app-program-console+frontend-app-publisher+insights+lms+lms_watcher+registrar+registrar-worker+studio+studio_watcher+xqueue+xqueue_consumer
7878

7979
# Services with database migrations.
8080
# Should be a subset of $(EDX_SERVICES).
@@ -92,7 +92,7 @@ credentials+discovery+ecommerce+lms+registrar+studio
9292
# Note: This list should contain _all_ services with static asse to compile ts, even if not
9393
# configured to run; the list will be filtered later against $(DEFAULT_SERVICES).
9494
ASSET_SERVICES ?= \
95-
credentials+discovery+ecommerce+lms+registrar+studio
95+
credentials+discovery+ecommerce+insights+lms+registrar+studio
9696

9797
# All third-party services.
9898
# Separated by plus signs. Listed in alphabetical order for clarity.

provision-insights.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -eu -o pipefail
3+
4+
. scripts/colors.sh
5+
set -x
6+
7+
name=insights
8+
port=8011
9+
10+
docker-compose up -d insights
11+
12+
echo -e "${GREEN}Installing requirements for ${name}...${NC}"
13+
docker-compose exec -T ${name} bash -e -c 'source /edx/app/insights/insights_env && cd /edx/app/insights/insights && make develop' -- ${name}
14+
15+
# # Install Insights npm dependencies
16+
docker-compose exec -T ${name} bash -e -c 'source /edx/app/insights/insights_env && cd /edx/app/insights/insights/ && npm install && ./npm-post-install.sh'
17+
18+
echo -e "${GREEN}Running migrations for ${name}...${NC}"
19+
docker-compose exec -T ${name} bash -e -c 'source /edx/app/insights/insights_env && export DJANGO_SETTINGS_MODULE="analytics_dashboard.settings.devstack" && cd /edx/app/insights/insights && make migrate' -- ${name}
20+
21+
./provision-ida-user.sh ${name} ${name} ${port}
22+
23+
# Compile static assets last since they are absolutely necessary for all services. This will allow developers to get
24+
# started if they do not care about static assets
25+
echo -e "${GREEN}Compiling static assets for ${name}...${NC}"
26+
docker-compose exec -T ${name} bash -e -c 'source /edx/app/insights/insights_env && cd /edx/app/insights/insights && make static' -- "$name"

provision.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ notes \
4848
registrar \
4949
xqueue \
5050
coursegraph \
51+
insights \
5152
"
5253

5354
# What should we provision?

provision.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ CREATE DATABASE IF NOT EXISTS edxapp_csmh;
2121
GRANT ALL ON edxapp.* TO 'edxapp001'@'%' IDENTIFIED BY 'password';
2222
GRANT ALL ON edxapp_csmh.* TO 'edxapp001'@'%';
2323

24+
CREATE DATABASE IF NOT EXISTS `dashboard`;
25+
GRANT ALL PRIVILEGES ON `dashboard`.* TO 'rozencrantz'@'%' IDENTIFIED BY 'secret';
26+
2427
FLUSH PRIVILEGES;

repo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ repos=(
2929
"https://github.com/edx/edx-notes-api.git"
3030
"https://github.com/edx/edx-platform.git"
3131
"https://github.com/edx/xqueue.git"
32+
"https://github.com/edx/edx-analytics-dashboard.git"
3233
"https://github.com/edx/frontend-app-gradebook.git"
3334
"https://github.com/edx/frontend-app-payment.git"
3435
"https://github.com/edx/frontend-app-publisher.git"
@@ -52,6 +53,7 @@ ssh_repos=(
5253
"git@github.com:edx/edx-notes-api.git"
5354
"git@github.com:edx/edx-platform.git"
5455
"git@github.com:edx/xqueue.git"
56+
"git@github.com:edx/edx-analytics-dashboard.git"
5557
"git@github.com:edx/frontend-app-gradebook.git"
5658
"git@github.com:edx/frontend-app-payment.git"
5759
"git@github.com:edx/frontend-app-publisher.git"

0 commit comments

Comments
 (0)