Skip to content

Commit d972aa3

Browse files
committed
Simplify handling of XQueue and add it to CI
* Allow XQueue to be provisioned and run just like other services. * Start testing XQueue (in its own shard). * Clean up redundant Makefile rules.
1 parent 57a5166 commit d972aa3

7 files changed

+38
-52
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ env:
1616
- DEVSTACK_WORKSPACE=/tmp SHALLOW_CLONE=1 SERVICES='edx_notes_api'
1717
- DEVSTACK_WORKSPACE=/tmp SHALLOW_CLONE=1 SERVICES='credentials'
1818
- DEVSTACK_WORKSPACE=/tmp SHALLOW_CLONE=1 SERVICES='analyticspipeline'
19+
- DEVSTACK_WORKSPACE=/tmp SHALLOW_CLONE=1 SERVICES='xqueue'
1920
- DEVSTACK_WORKSPACE=/tmp SHALLOW_CLONE=1 SERVICES='marketing'
2021

2122
services:

Makefile

+20-34
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
dev.nfs.provision.services dev.nfs.setup dev.nfs.up dev.nfs.up.all \
1414
dev.nfs.up.watchers devpi-password dev.provision \
1515
dev.provision.analytics_pipeline dev.provision.services \
16-
dev.provision.xqueue dev.provision.xqueue.run dev.pull dev.repo.reset \
17-
dev.reset dev.status dev.sync.daemon.start dev.sync.provision \
18-
dev.sync.requirements dev.sync.up dev.up dev.up.all \
19-
dev.up.analytics_pipeline dev.up.watchers dev.up.with-programs \
20-
dev.up.xqueue discovery-shell down e2e-shell e2e-tests ecommerce-shell \
21-
feature-toggle-state forum-restart-devserver healthchecks help lms-restart \
22-
lms-shell lms-static lms-update-db lms-watcher-shell logs mongo-shell \
23-
mysql-shell mysql-shell-edxapp provision pull pull.analytics_pipeline \
24-
pull.xqueue registrar-shell requirements restore selfcheck static \
25-
stats stop stop.all stop.analytics_pipeline stop.watchers stop.xqueue \
26-
studio-restart studio-shell studio-static studio-update-db \
27-
studio-watcher-shell update-db upgrade upgrade validate \
28-
validate-lms-volume vnc-passwords xqueue_consumer-logs \
29-
xqueue_consumer-restart xqueue_consumer-shell xqueue-logs \
30-
xqueue-restart xqueue-shell
16+
dev.provision.xqueue dev.pull dev.repo.reset dev.reset dev.status \
17+
dev.sync.daemon.start dev.sync.provision dev.sync.requirements \
18+
dev.sync.up dev.up dev.up.all dev.up.analytics_pipeline \
19+
dev.up.watchers dev.up.with-programs discovery-shell down e2e-shell \
20+
e2e-tests ecommerce-shell feature-toggle-state forum-restart-devserver \
21+
healthchecks help lms-restart lms-shell lms-static lms-update-db \
22+
lms-watcher-shell logs mongo-shell mysql-shell mysql-shell-edxapp \
23+
provision pull pull.analytics_pipeline pull.xqueue registrar-shell \
24+
requirements restore selfcheck static stats stop stop.all \
25+
stop.analytics_pipeline stop.watchers stop.xqueue studio-restart \
26+
studio-shell studio-static studio-update-db studio-watcher-shell \
27+
update-db upgrade upgrade validate validate-lms-volume vnc-passwords \
28+
xqueue_consumer-restart xqueue_consumer-shell xqueue-restart \
29+
xqueue-shell
30+
3131

3232
# Docker Compose files that define services.
3333
MAIN_COMPOSE_FILE=-f docker-compose.yml
@@ -48,16 +48,15 @@ SUPPORTING_COMPOSE_FILES_FOR_SYNC=-f docker-compose-sync.yml
4848
STANDARD_COMPOSE_SUITE=$(MAIN_COMPOSE_FILE) $(SUPPORTING_COMPOSE_FILES)
4949
STANDARD_COMPOSE_SUITE_FOR_NFS=$(MAIN_COMPOSE_FILE) $(SUPPORTING_COMPOSE_FILES_FOR_NFS)
5050
STANDARD_COMPOSE_SUITE_FOR_SYNC=$(MAIN_COMPOSE_FILE) $(SUPPORTING_COMPOSE_FILES_FOR_SYNC)
51-
XQUEUE_COMPOSE_SUITE=$(MAIN_COMPOSE_FILE) $(XQUEUE_COMPOSE_FILE) $(SUPPORTING_COMPOSE_FILES)
5251
ANALYTICS_COMPOSE_SUITE=$(STANDARD_COMPOSE_SUITE) $(ANALYTICS_COMPOSE_FILE)
5352

5453
# All Docker Compose YAML files that contain service definitions.
5554
# Useful for Makefile targets like `dev.pull` and `down`
5655
ALL_SERVICE_COMPOSE_FILES=\
5756
$(MAIN_COMPOSE_FILE) \
58-
$(XQUEUE_COMPOSE_FILE) \
5957
$(WATCHERS_COMPOSE_FILE) \
6058
$(ANALYTICS_COMPOSE_FILE) \
59+
$(XQUEUE_COMPOSE_FILE) \
6160
$(MARKETING_COMPOSE_FILE)
6261

6362
# All Docker Compose files (except those for NFS and Docker Sync).
@@ -121,10 +120,7 @@ dev.provision: | check-memory dev.clone.ssh dev.provision.services stop ## Provi
121120
dev.cache-programs: ## Copy programs from Discovery to Memcached for use in LMS.
122121
$(WINPTY) bash ./programs/provision.sh cache
123122

124-
dev.provision.xqueue: | check-memory dev.provision.xqueue.run stop stop.xqueue # Provision XQueue; run after other services are provisioned
125-
126-
dev.provision.xqueue.run:
127-
DOCKER_COMPOSE_FILES="$(MAIN_COMPOSE_FILE) $(XQUEUE_COMPOSE_FILE)" $(WINPTY) bash ./provision-xqueue.sh
123+
dev.provision.xqueue: dev.provision.services.xqueue
128124

129125
dev.reset: | down dev.repo.reset pull dev.up static update-db ## Attempts to reset the local devstack to the master working state
130126

@@ -183,9 +179,6 @@ dev.nfs.provision.services: ## Provision all services with local mounted directo
183179
dev.nfs.provision.services.%: ## Provision specified services with local mounted directories, separated by plus signs
184180
DOCKER_COMPOSE_FILES="$(STANDARD_COMPOSE_SUITE_FOR_NFS)" ./provision.sh $*
185181

186-
dev.up.xqueue: | check-memory ## Bring up xqueue, assumes you already have lms running
187-
bash -c 'docker-compose $(XQUEUE_COMPOSE_SUITE) up -d'
188-
189182
dev.up.all: | dev.up dev.up.watchers ## Bring up all services with host volumes, including watchers
190183

191184
dev.sync.daemon.start: ## Start the docker-sycn daemon
@@ -214,8 +207,8 @@ stop.watchers: ## Stop asset watchers
214207

215208
stop.all: | stop.analytics_pipeline stop stop.watchers ## Stop all containers, including asset watchers
216209

217-
stop.xqueue: ## Stop the XQueue service container
218-
docker-compose $(XQUEUE_COMPOSE_FILE) stop
210+
stop.xqueue: ## Stop the XQueue and XQueue-Consumer containers
211+
docker-compose $(ALL_SERVICE_COMPOSE_FILES) stop xqueue xqueue_consumer
219212

220213
down: ## Remove all service containers and networks
221214
(test -d .docker-sync && docker-sync clean) || true ## Ignore failure here
@@ -230,12 +223,6 @@ logs: ## View logs from containers running in detached mode
230223
%-logs: ## View the logs of the specified service container
231224
docker-compose $(ALL_SERVICE_COMPOSE_FILES) logs -f --tail=500 $*
232225

233-
xqueue-logs: ## View logs from containers running in detached mode
234-
docker-compose $(XQUEUE_COMPOSE_FILE) logs -f xqueue
235-
236-
xqueue_consumer-logs: ## View logs from containers running in detached mode
237-
docker-compose $(XQUEUE_COMPOSE_FILE) logs -f xqueue_consumer
238-
239226
RED="\033[0;31m"
240227
YELLOW="\033[0;33m"
241228
GREY="\033[1;90m"
@@ -271,8 +258,7 @@ pull: dev.pull
271258
@echo "****************************************************************"
272259
@echo -n $(NO_COLOR)
273260

274-
pull.xqueue: ## Update XQueue Docker images
275-
docker-compose $(XQUEUE_COMPOSE_FILE) pull
261+
pull.xqueue: dev.pull-without-deps.xqueue+xqueue_consumer
276262

277263
validate: ## Validate the devstack configuration
278264
docker-compose config

check.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,22 @@ if should_check credentials; then
105105
"curl --fail -L http://localhost:18150/health"
106106
fi
107107

108+
if should_check xqueue; then
109+
echo "Checking xqueue status:"
110+
run_check xqueue_heartbeat xqueue \
111+
"curl --fail -L http://localhost:18040/xqueue/status"
112+
fi
113+
114+
if should_check analyticspipeline; then
115+
echo "Running Analytics Devstack tests: "
116+
run_check analyticspipeline_tests analyticspipeline \
117+
"make analytics-pipeline-devstack-test"
118+
fi
119+
108120
if should_check marketing; then
109121
echo "Seeing if we can curl root of Marketing site: "
110122
run_check marketing_curl marketing \
111-
"curl http://localhost:8080"
123+
"curl --fail -L http://localhost:8080"
112124
fi
113125

114126
echo "Successful checks:${succeeded:- NONE}"

provision-xqueue.sh

-13
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ set -x
55
# Bring up XQueue, we don't need the consumer for provisioning
66
docker-compose $DOCKER_COMPOSE_FILES up -d xqueue
77

8-
# This works in case you provision xqueue without having other services up
9-
# Bring the database online.
10-
docker-compose up -d mysql
11-
12-
# Ensure the MySQL server is online and usable
13-
echo "Waiting for MySQL"
14-
until docker exec -i edx.devstack.mysql mysql -uroot -se "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = 'root')" &> /dev/null
15-
do
16-
printf "."
17-
sleep 1
18-
done
19-
20-
docker exec -i edx.devstack.mysql mysql -uroot mysql < provision-xqueue.sql
218
# Update dependencies
229
docker-compose $DOCKER_COMPOSE_FILES exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && make requirements'
2310
# Run migrations

provision-xqueue.sql

-4
This file was deleted.

provision.sh

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ notes \
4949
registrar \
5050
analyticspipeline \
5151
marketing \
52+
xqueue \
5253
"
5354

5455
# What should we provision?

provision.sql

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ GRANT ALL ON notes.* TO 'notes001'@'%' IDENTIFIED BY 'password';
1616
CREATE DATABASE IF NOT EXISTS registrar;
1717
GRANT ALL ON registrar.* TO 'registrar001'@'%' IDENTIFIED BY 'password';
1818

19+
CREATE DATABASE IF NOT EXISTS xqueue;
20+
GRANT ALL ON xqueue.* TO 'xqueue001'@'%' IDENTIFIED BY 'password';
21+
1922
CREATE DATABASE IF NOT EXISTS edxapp;
2023
CREATE DATABASE IF NOT EXISTS edxapp_csmh;
2124
GRANT ALL ON edxapp.* TO 'edxapp001'@'%' IDENTIFIED BY 'password';

0 commit comments

Comments
 (0)