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

Commit 97a8829

Browse files
authored
Merge pull request #4 from edx/kdmccormick/multiple-releases-one-machine/fixes2
Set COMPOSE_FILE environment variable in Makefile. I read over https://docs.docker.com/compose/reference/envvars/#compose_file and it seems fine.
2 parents 4f0a62e + 4f22538 commit 97a8829

9 files changed

+47
-45
lines changed

Makefile

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,43 @@ include options.mk
3838
-include local.mk # Prefix with hyphen to tolerate absence of file.
3939

4040
# Docker Compose YAML files to define services and their volumes.
41+
# This environment variable tells `docker-compose` which files to load definitions
42+
# of services, volumes, and networks from.
4143
# Depending on the value of FS_SYNC_STRATEGY, we use a slightly different set of
4244
# files, enabling use of different strategies to synchronize files between the host and
4345
# the containers.
4446
# Some services are only available for certain values of FS_SYNC_STRATEGY.
4547
# For example, the LMS/Studio asset watchers are only available for local-mounts and nfs,
4648
# and XQueue and the Analytics Pipeline are only available for local-mounts.
4749

50+
# Compose files are separated by a colon.
51+
COMPOSE_PATH_SEPARATOR := :
52+
4853
ifeq ($(FS_SYNC_STRATEGY),local-mounts)
49-
DOCKER_COMPOSE_FILES := \
50-
-f docker-compose-host.yml \
51-
-f docker-compose-themes.yml \
52-
-f docker-compose-watchers.yml \
53-
-f docker-compose-xqueue.yml \
54-
-f docker-compose-analytics-pipeline.yml \
55-
-f docker-compose-marketing-site.yml
54+
COMPOSE_FILE := docker-compose-host.yml
55+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-themes.yml
56+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-watchers.yml
57+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-xqueue.yml
58+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-analytics-pipeline.yml
59+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-marketing-site.yml
5660
endif
5761

5862
ifeq ($(FS_SYNC_STRATEGY),nfs)
59-
DOCKER_COMPOSE_FILES := \
60-
-f docker-compose-host-nfs.yml \
61-
-f docker-compose-themes-nfs.yml \
62-
-f docker-compose-watchers-nfs.yml
63+
COMPOSE_FILE := docker-compose-host-nfs.yml
64+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-themes-nfs.yml
65+
COMPOSE_FILE := $(COMPOSE_FILE):docker-compose-watchers-nfs.yml
6366
endif
6467

6568
ifeq ($(FS_SYNC_STRATEGY),docker-sync)
66-
DOCKER_COMPOSE_FILES := \
67-
-f docker-compose-sync.yml
69+
COMPOSE_FILE := docker-compose-sync.yml
6870
endif
6971

70-
ifndef DOCKER_COMPOSE_FILES
72+
ifndef COMPOSE_FILE
7173
$(error FS_SYNC_STRATEGY is set to $(FS_SYNC_STRATEGY). Must be one of: local-mounts, nfs, docker-sync)
7274
endif
7375

7476
# All three filesystem synchronization strategy require the main docker-compose.yml file.
75-
DOCKER_COMPOSE_FILES := -f docker-compose.yml $(DOCKER_COMPOSE_FILES)
77+
COMPOSE_FILE := docker-compose.yml:$(COMPOSE_FILE)
7678

7779
OS := $(shell uname)
7880

@@ -112,10 +114,10 @@ upgrade: ## Upgrade requirements with pip-tools
112114
pip-compile --upgrade -o requirements/base.txt requirements/base.in
113115

114116
dev.print-container.%: ## Get the ID of the running container for a given service. Run with ``make --silent`` for just ID.
115-
@echo $$(docker-compose $(DOCKER_COMPOSE_FILES) ps --quiet $*)
117+
@echo $$(docker-compose ps --quiet $*)
116118

117119
dev.ps: ## View list of created services and their statuses.
118-
docker-compose $(DOCKER_COMPOSE_FILES) ps
120+
docker-compose ps
119121

120122
dev.checkout: ## Check out "openedx-release/$OPENEDX_RELEASE" in each repo if set, "master" otherwise
121123
./repo.sh checkout
@@ -154,21 +156,21 @@ dev.repo.reset: ## Attempts to reset the local repo checkouts to the master work
154156
dev.pull: dev.pull.$(DEFAULT_SERVICES) ## Pull Docker images required by default services.
155157

156158
dev.pull.without-deps.%: ## Pull latest Docker images for services (separated by plus-signs).
157-
docker-compose $(DOCKER_COMPOSE_FILES) pull $$(echo $* | tr + " ")
159+
docker-compose pull $$(echo $* | tr + " ")
158160

159161
dev.pull.%: ## Pull latest Docker images for services (separated by plus-signs) and all their dependencies.
160-
docker-compose $(DOCKER_COMPOSE_FILES) pull --include-deps $$(echo $* | tr + " ")
162+
docker-compose pull --include-deps $$(echo $* | tr + " ")
161163

162164
dev.up: dev.up.$(DEFAULT_SERVICES) check-memory ## Bring up default services.
163165

164166
dev.up.%: | check-memory ## Bring up specific services (separated by plus-signs) and their dependencies with host volumes.
165-
docker-compose $(DOCKER_COMPOSE_FILES) up -d $$(echo $* | tr + " ")
167+
docker-compose up -d $$(echo $* | tr + " ")
166168
ifeq ($(ALWAYS_CACHE_PROGRAMS),true)
167169
make dev.cache-programs
168170
endif
169171

170172
dev.up.without-deps.%: ## Bring up specific services (separated by plus-signs) without dependencies.
171-
docker-compose $(DOCKER_COMPOSE_FILES) up --d --no-deps $$(echo $* | tr + " ")
173+
docker-compose up --d --no-deps $$(echo $* | tr + " ")
172174

173175
dev.up.with-programs: dev.up dev.cache-programs ## Bring up a all services and cache programs in LMS.
174176

@@ -209,10 +211,10 @@ provision: | dev.provision ## This command will be deprecated in a future releas
209211

210212
dev.stop: ## Stop all services.
211213
(test -d .docker-sync && docker-sync stop) || true ## Ignore failure here
212-
docker-compose $(DOCKER_COMPOSE_FILES) stop
214+
docker-compose stop
213215

214216
dev.stop.%: ## Stop specific services, separated by plus-signs.
215-
docker-compose $(DOCKER_COMPOSE_FILES) stop $$(echo $* | tr + " ")
217+
docker-compose stop $$(echo $* | tr + " ")
216218

217219
stop: dev.stop.$(DEFAULT_SERVICES)
218220

@@ -224,31 +226,31 @@ stop.xqueue: dev.stop.xqueue+xqueue_consumer
224226

225227
dev.kill: ## Kill all services.
226228
(test -d .docker-sync && docker-sync stop) || true ## Ignore failure here
227-
docker-compose $(DOCKER_COMPOSE_FILES) stop
229+
docker-compose stop
228230

229231
dev.kill.%: ## Kill specific services, separated by plus-signs.
230-
docker-compose $(DOCKER_COMPOSE_FILES) kill $$(echo $* | tr + " ")
232+
docker-compose kill $$(echo $* | tr + " ")
231233

232234
dev.rm-stopped: ## Remove stopped containers. Does not affect running containers.
233-
docker-compose $(DOCKER_COMPOSE_FILES) rm --force
235+
docker-compose rm --force
234236

235237
dev.down.%: ## Stop and remove specific services, separated by plus-signs.
236-
docker-compose $(DOCKER_COMPOSE_FILES) rm --force --stop $$(echo $* | tr + " ")
238+
docker-compose rm --force --stop $$(echo $* | tr + " ")
237239

238240
dev.down: ## Stop and remove all service containers and networks
239241
(test -d .docker-sync && docker-sync clean) || true ## Ignore failure here
240-
docker-compose $(DOCKER_COMPOSE_FILES) down
242+
docker-compose down
241243

242244
down: dev.down
243245

244246
destroy: ## Remove all devstack-related containers, networks, and volumes
245247
$(WINPTY) bash ./destroy.sh
246248

247249
logs: ## View logs from containers running in detached mode
248-
docker-compose $(DOCKER_COMPOSE_FILES) logs -f
250+
docker-compose logs -f
249251

250252
%-logs: ## View the logs of the specified service container
251-
docker-compose $(DOCKER_COMPOSE_FILES) logs -f --tail=500 $*
253+
docker-compose logs -f --tail=500 $*
252254

253255
RED="\033[0;31m"
254256
YELLOW="\033[0;33m"
@@ -418,7 +420,7 @@ dev.up.analytics_pipeline: dev.up.analyticspipeline ## Bring up analytics pipeli
418420
pull.analytics_pipeline: dev.pull.analyticspipeline ## Update analytics pipeline docker images
419421

420422
analytics-pipeline-devstack-test: ## Run analytics pipeline tests in travis build
421-
docker-compose $(DOCKER_COMPOSE_FILES) exec -u hadoop -T analyticspipeline bash -c 'sudo chown -R hadoop:hadoop /edx/app/analytics_pipeline && source /edx/app/hadoop/.bashrc && make develop-local && make docker-test-acceptance-local ONLY_TESTS=edx.analytics.tasks.tests.acceptance.test_internal_reporting_database && make docker-test-acceptance-local ONLY_TESTS=edx.analytics.tasks.tests.acceptance.test_user_activity'
423+
docker-compose exec -u hadoop -T analyticspipeline bash -c 'sudo chown -R hadoop:hadoop /edx/app/analytics_pipeline && source /edx/app/hadoop/.bashrc && make develop-local && make docker-test-acceptance-local ONLY_TESTS=edx.analytics.tasks.tests.acceptance.test_internal_reporting_database && make docker-test-acceptance-local ONLY_TESTS=edx.analytics.tasks.tests.acceptance.test_user_activity'
422424

423425
stop.analytics_pipeline: dev.stop.namenode+datanode+resourcemanager+nodemanager+sparkmaster+sparkworker+vertica+analyticspipeline ## Stop all Analytics pipeline services.
424426

provision-analyticspipeline.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ elif [ ! -d "$DEVSTACK_WORKSPACE" ]; then
1717
fi
1818

1919
# Bring the pipeline containers online.
20-
docker-compose $DOCKER_COMPOSE_FILES up -d analyticspipeline
20+
docker-compose up -d analyticspipeline
2121

2222
# Analytics pipeline has dependency on lms but we only need its db schema & not full lms. So we'll just load their db
2323
# schemas as part of analytics pipeline provisioning. If there is a need of a fully fledged LMS, then provision lms
@@ -29,7 +29,7 @@ else
2929
echo -e "${GREEN}LMS DB not found, provisioning lms schema.${NC}"
3030
docker-compose exec -T mysql bash -c 'mysql -uroot mysql' < provision.sql
3131
./load-db.sh edxapp
32-
docker-compose $DOCKER_COMPOSE_FILES up -d lms studio
32+
docker-compose up -d lms studio
3333
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 paver install_prereqs'
3434
#Installing prereqs crashes the process
3535
docker-compose restart lms
@@ -43,7 +43,7 @@ docker-compose exec -T mysql bash -c 'mysql -uroot mysql' < provision-analytics-
4343

4444
# initialize hive metastore
4545
echo -e "${GREEN}Initializing HIVE metastore...${NC}"
46-
docker-compose $DOCKER_COMPOSE_FILES exec analyticspipeline bash -c '/edx/app/hadoop/hive/bin/schematool -dbType mysql -initSchema'
46+
docker-compose exec analyticspipeline bash -c '/edx/app/hadoop/hive/bin/schematool -dbType mysql -initSchema'
4747

4848
# materialize hadoop directory structure
4949
echo -e "${GREEN}Initializing Hadoop directory structure...${NC}"
@@ -56,4 +56,4 @@ done
5656
sleep 10 # for datanode & other services to activate
5757
echo -e "${GREEN}Namenode is ready!${NC}"
5858

59-
docker-compose $DOCKER_COMPOSE_FILES exec -u hadoop analyticspipeline bash -c 'sudo /edx/app/hadoop/hadoop/bin/hdfs dfs -chown -R hadoop:hadoop hdfs://namenode:8020/; hdfs dfs -mkdir -p hdfs://namenode:8020/edx-analytics-pipeline/{warehouse,marker,manifest,packages} hdfs://namenode:8020/{spark-warehouse,data} hdfs://namenode:8020/tmp/spark-events;hdfs dfs -copyFromLocal -f /edx/app/hadoop/lib/edx-analytics-hadoop-util.jar hdfs://namenode:8020/edx-analytics-pipeline/packages/;'
59+
docker-compose exec -u hadoop analyticspipeline bash -c 'sudo /edx/app/hadoop/hadoop/bin/hdfs dfs -chown -R hadoop:hadoop hdfs://namenode:8020/; hdfs dfs -mkdir -p hdfs://namenode:8020/edx-analytics-pipeline/{warehouse,marker,manifest,packages} hdfs://namenode:8020/{spark-warehouse,data} hdfs://namenode:8020/tmp/spark-events;hdfs dfs -copyFromLocal -f /edx/app/hadoop/lib/edx-analytics-hadoop-util.jar hdfs://namenode:8020/edx-analytics-pipeline/packages/;'

provision-credentials.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
name=credentials
77
port=18150
88

9-
docker-compose $DOCKER_COMPOSE_FILES up -d $name
9+
docker-compose up -d $name
1010

1111
echo -e "${GREEN}Installing requirements for ${name}...${NC}"
1212
docker-compose exec ${name} bash -c 'source /edx/app/credentials/credentials_env && cd /edx/app/credentials/credentials && make requirements && make production-requirements' -- "$name"

provision-forum.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ set -e
22
set -o pipefail
33
set -x
44

5-
docker-compose $DOCKER_COMPOSE_FILES up -d forum
5+
docker-compose up -d forum
66
docker-compose exec -T forum bash -c 'source /edx/app/forum/ruby_env && cd /edx/app/forum/cs_comments_service && bundle install --deployment --path /edx/app/forum/.gem/'

provision-ida.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ client_name=$2 # The name of the Oauth client stored in the edxapp DB.
44
client_port=$3 # The port corresponding to this IDA service in devstack.
55
container_name=${4:-$1} # (Optional) The name of the container. If missing, will use app_name.
66

7-
docker-compose $DOCKER_COMPOSE_FILES up -d $app_name
7+
docker-compose up -d $app_name
88

99
echo -e "${GREEN}Installing requirements for ${app_name}...${NC}"
1010
docker-compose exec ${container_name} bash -c 'source /edx/app/$1/$1_env && cd /edx/app/$1/$1/ && make requirements' -- "$app_name"

provision-lms.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ apps=( lms studio )
1010

1111
# Bring edxapp containers online
1212
for app in "${apps[@]}"; do
13-
docker-compose $DOCKER_COMPOSE_FILES up -d $app
13+
docker-compose up -d $app
1414
done
1515

1616
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 paver install_prereqs'

provision-marketing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -x
77
YELLOW='\033[1;33m'
88
NC='\033[0m' # No Color
99

10-
docker-compose $DOCKER_COMPOSE_FILES up -d marketing
10+
docker-compose up -d marketing
1111

1212
set +x
1313
echo -e "${YELLOW}edX Marketing Site is not fully provisioned yet.${NC}"

provision-registrar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name=registrar
44
port=18734
55

6-
docker-compose $DOCKER_COMPOSE_FILES up -d $name
6+
docker-compose up -d $name
77

88
echo -e "${GREEN}Installing requirements for ${name}...${NC}"
99
docker-compose exec ${name} bash -c 'source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && make requirements' -- "$name"

provision-xqueue.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ set -o pipefail
33
set -x
44

55
# Bring up XQueue, we don't need the consumer for provisioning
6-
docker-compose $DOCKER_COMPOSE_FILES up -d xqueue
6+
docker-compose up -d xqueue
77

88
# Update dependencies
9-
docker-compose $DOCKER_COMPOSE_FILES exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && make requirements'
9+
docker-compose exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && make requirements'
1010
# Run migrations
11-
docker-compose $DOCKER_COMPOSE_FILES exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && python manage.py migrate'
11+
docker-compose exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && python manage.py migrate'
1212
# Add users that graders use to fetch data, there's one default user in Ansible which is part of our settings
13-
docker-compose $DOCKER_COMPOSE_FILES exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && python manage.py update_users'
13+
docker-compose exec xqueue bash -c 'source /edx/app/xqueue/xqueue_env && cd /edx/app/xqueue/xqueue && python manage.py update_users'

0 commit comments

Comments
 (0)