forked from openedx-unsupported/devstack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
94 lines (65 loc) · 4.03 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.DEFAULT_GOAL := help
DEVSTACK_WORKSPACE ?= ..
OS := $(shell uname)
export DEVSTACK_WORKSPACE
include *.mk
# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage.
help: ## Display this help message
@echo "Please use \`make <target>' where <target> is one of"
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
requirements: ## Install requirements
pip install -r requirements.txt
dev.clone: ## Clone service repos to the parent directory
./clone.sh
dev.provision.run: ## Provision all services with local mounted directories
DOCKER_COMPOSE_FILES="-f docker-compose.yml -f docker-compose-host.yml" ./provision.sh
dev.provision: | dev.provision.run stop ## Provision dev environment with all services stopped
dev.up: ## Bring up all services with host volumes
docker-compose -f docker-compose.yml -f docker-compose-host.yml up -d
dev.sync.daemon.start: ## Start the docker-sycn daemon
docker-sync start
dev.sync.provision: | dev.sync.daemon.start dev.provision ## Provision with docker-sync enabled
dev.sync.requirements: ## Install requirements
gem install docker-sync
dev.sync.up: dev.sync.daemon.start ## Bring up all services with docker-sync enabled
docker-compose -f docker-compose.yml -f docker-compose-sync.yml up -d
provision: ## Provision all services using the Docker volume
./provision.sh
stop: ## Stop all services
(test -d .docker-sync && docker-sync stop) || true ## Ignore failure here
docker-compose stop
down: ## Remove all service containers and networks
test -d .docker-sync && docker-sync clean
docker-compose down
destroy: ## Remove all devstack-related containers, networks, and volumes
./destroy.sh
logs: ## View logs from containers running in detached mode
docker-compose logs -f
pull: ## Update Docker images
docker-compose pull
validate: ## Validate the devstack configuration
docker-compose config
backup: ## Write all data volumes to the host.
docker run --rm --volumes-from edx.devstack.mysql -v $$(pwd)/.dev/backups:/backup debian:jessie tar zcvf /backup/mysql.tar.gz /var/lib/mysql
docker run --rm --volumes-from edx.devstack.mongo -v $$(pwd)/.dev/backups:/backup debian:jessie tar zcvf /backup/mongo.tar.gz /data/db
docker run --rm --volumes-from edx.devstack.elasticsearch -v $$(pwd)/.dev/backups:/backup debian:jessie tar zcvf /backup/elasticsearch.tar.gz /usr/share/elasticsearch/data
restore: ## Restore all data volumes from the host. WARNING: THIS WILL OVERWRITE ALL EXISTING DATA!
docker run --rm --volumes-from edx.devstack.mysql -v $$(pwd)/.dev/backups:/backup debian:jessie tar zxvf /backup/mysql.tar.gz
docker run --rm --volumes-from edx.devstack.mongo -v $$(pwd)/.dev/backups:/backup debian:jessie tar zxvf /backup/mongo.tar.gz
docker run --rm --volumes-from edx.devstack.elasticsearch -v $$(pwd)/.dev/backups:/backup debian:jessie tar zxvf /backup/elasticsearch.tar.gz
# TODO: Print out help for this target. Even better if we can iterate over the
# services in docker-compose.yml, and print the actual service names.
%-shell: ## Run a shell on the specified service container
docker exec -it edx.devstack.$* env TERM=$(TERM) /edx/app/$*/devstack.sh open
credentials-shell: ## Run a shell on the credentials container
docker exec -it edx.devstack.credentials env TERM=$(TERM) bash
lms-shell: ## Run a shell on the LMS container
docker exec -it edx.devstack.lms env TERM=$(TERM) /edx/app/edxapp/devstack.sh open
studio-shell: ## Run a shell on the Studio container
docker exec -it edx.devstack.studio env TERM=$(TERM) /edx/app/edxapp/devstack.sh open
healthchecks: ## Run a curl against all services' healthcheck endpoints to make sure they are up. This will eventually be parameterized
./healthchecks.sh
validate-lms-volume: ## Validate that changes to the local workspace are reflected in the LMS container
touch $(DEVSTACK_WORKSPACE)/edx-platform/testfile
docker exec edx.devstack.lms ls /edx/app/edxapp/edx-platform/testfile
rm $(DEVSTACK_WORKSPACE)/edx-platform/testfile