1+ # ##############################################################
2+ # PRODUCTION COMMANDS #########################################
3+ # ##############################################################
4+ # These are production commands which may be invoked in deployments
15altprodserver : NUM_PROCS:=3
26altprodserver : NUM_THREADS:=5
3- altprodserver : collectstatic ensurecrowdinclient downloadmessages compilemessages
7+ altprodserver : collectstatic compilemessages
48 cd contentcuration/ && gunicorn contentcuration.wsgi:application --timeout=4000 --error-logfile=/var/log/gunicorn-error.log --workers=${NUM_PROCS} --threads=${NUM_THREADS} --bind=0.0.0.0:8081 --pid=/tmp/contentcuration.pid --log-level=debug || sleep infinity
59
6- contentnodegc :
7- cd contentcuration/ && python manage.py garbage_collect
8-
9- dummyusers :
10- cd contentcuration/ && python manage.py loaddata contentcuration/fixtures/admin_user.json
11- cd contentcuration/ && python manage.py loaddata contentcuration/fixtures/admin_user_token.json
12-
1310prodceleryworkers :
1411 cd contentcuration/ && celery -A contentcuration worker -l info --concurrency=3 --task-events
1512
16- devserver :
17- yarn run devserver
18-
19- test :
20- yarn install && yarn run unittests
21- mv contentcuration/coverage.xml shared
22-
23- python-test :
24- pytest --cov-report=xml --cov=./
25- mv ./coverage.xml shared
26-
27- docker-python-test : SHELL:=/bin/bash
28- docker-python-test :
29- # launch all studio's dependent services using docker-compose, and then run the tests
30- # create a shared directory accessible from within Docker so that it can pass the
31- # coverage report back for uploading.
32- mkdir -p shared
33- docker-compose run -v " ${PWD} /shared:/shared" studio-app make collectstatic python-test -e DJANGO_SETTINGS_MODULE=contentcuration.test_settings
34- bash <( curl -s https://codecov.io/bash)
35- rm -rf shared
36-
37- endtoendtest : SHELL:=/bin/bash
38- endtoendtest :
39- # launch all studio's dependent services using docker-compose, and then run the tests
40- # create a shared directory accessible from within Docker so that it can pass the
41- # coverage report back for uploading.
42- mkdir -p shared
43- docker-compose run -v " ${PWD} /shared:/shared" studio-app make collectstatic test -e DJANGO_SETTINGS_MODULE=contentcuration.test_settings
44- bash <( curl -s https://codecov.io/bash)
45- rm -rf shared
46-
47-
4813collectstatic :
4914 python contentcuration/manage.py collectstatic --noinput
5015
16+ compilemessages :
17+ python contentcuration/manage.py compilemessages
18+
5119migrate :
5220 python contentcuration/manage.py migrate || true
5321 python contentcuration/manage.py loadconstants
5422
55- ensurecrowdinclient :
56- ls -l crowdin-cli.jar || curl -L https://storage.googleapis.com/le-downloads/crowdin-cli/crowdin-cli.jar -o crowdin-cli.jar
23+ contentnodegc :
24+ python contentcuration/manage.py garbage_collect
5725
26+ filedurations :
27+ python contentcuration/manage.py set_file_duration
28+
29+ learningactivities :
30+ python contentcuration/manage.py set_default_learning_activities
31+
32+ # ##############################################################
33+ # END PRODUCTION COMMANDS #####################################
34+ # ##############################################################
35+
36+ # ##############################################################
37+ # I18N COMMANDS ###############################################
38+ # ##############################################################
5839i18n-extract-frontend :
5940 # generate frontend messages
6041 yarn makemessages
@@ -90,6 +71,8 @@ i18n-download-translations:
9071 python node_modules/kolibri-tools/lib/i18n/crowdin.py download-translations ${branch}
9172 node node_modules/kolibri-tools/lib/i18n/intl_code_gen.js
9273 python node_modules/kolibri-tools/lib/i18n/crowdin.py convert-files
74+ # TODO: is this necessary? # Manual hack to add es language by copying es_ES to es
75+ # cp -r contentcuration/locale/es_ES contentcuration/locale/es
9376
9477i18n-download : i18n-download-translations
9578
@@ -106,18 +89,10 @@ i18n-download-glossary:
10689
10790i18n-upload-glossary :
10891 python node_modules/kolibri-tools/lib/i18n/crowdin.py upload-glossary
109- uploadmessages : ensurecrowdinclient
110- java -jar crowdin-cli.jar upload sources -b ` git rev-parse --abbrev-ref HEAD`
11192
112- # we need to depend on makemessages, since CrowdIn requires the en folder to be populated
113- # in order for it to properly extract strings
114- downloadmessages : ensurecrowdinclient makemessages
115- java -jar crowdin-cli.jar download -b ` git rev-parse --abbrev-ref HEAD` || true
116- # Manual hack to add es language by copying es_ES to es
117- cp -r contentcuration/locale/es_ES contentcuration/locale/es
118-
119- compilemessages :
120- python contentcuration/manage.py compilemessages
93+ # ##############################################################
94+ # END I18N COMMANDS ###########################################
95+ # ##############################################################
12196
12297# When using apidocs, this should clean out all modules
12398clean-docs :
@@ -131,11 +106,16 @@ docs: clean-docs
131106setup :
132107 python contentcuration/manage.py setup
133108
134- filedurations :
135- python contentcuration/manage.py set_file_duration
109+ # ###############################################################
110+ # DEVELOPMENT COMMANDS #########################################
111+ # ###############################################################
136112
137- learningactivities :
138- python contentcuration/manage.py set_default_learning_activities
113+ test :
114+ pytest
115+
116+ dummyusers :
117+ cd contentcuration/ && python manage.py loaddata contentcuration/fixtures/admin_user.json
118+ cd contentcuration/ && python manage.py loaddata contentcuration/fixtures/admin_user_token.json
139119
140120export COMPOSE_PROJECT_NAME =studio_$(shell git rev-parse --abbrev-ref HEAD)
141121
@@ -145,6 +125,12 @@ purge-postgres:
145125
146126destroy-and-recreate-database : purge-postgres setup
147127
128+ devceleryworkers :
129+ $(MAKE ) -e DJANGO_SETTINGS_MODULE=contentcuration.dev_settings prodceleryworkers
130+
131+ run-services :
132+ $(MAKE ) -j 2 dcservicesup devceleryworkers
133+
148134dcbuild :
149135 # build all studio docker image and all dependent services using docker-compose
150136 docker-compose build
@@ -166,14 +152,13 @@ dcclean:
166152 docker-compose down -v
167153 docker image prune -f
168154
169- export COMPOSE_STUDIO_APP = ${COMPOSE_PROJECT_NAME}_studio-app_1
170155dcshell :
171- # bash shell inside studio-app container
172- docker exec -ti ${COMPOSE_STUDIO_APP} /usr/bin/fish
156+ # bash shell inside the (running!) studio-app container
157+ docker-compose exec studio-app /usr/bin/fish
173158
174- dctest : endtoendtest
175- # launch all studio's dependent services using docker-compose, and then run the tests
176- echo " Finished running make test -e DJANGO_SETTINGS_MODULE=contentcuration.test_settings "
159+ dctest :
160+ # run backend tests inside docker, in new instances
161+ docker-compose run studio-app make test
177162
178163dcservicesup :
179164 # launch all studio's dependent services using docker-compose
0 commit comments