~schooltool-owners/schooltool.release/ark

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Gediminas Paulauskas
  • Date: 2013-10-30 12:46:50 UTC
  • Revision ID: menesis@pov.lt-20131030124650-ul77npl3moybb6kh
Multiple instance support. Usage: make start INSTANCE=another

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
DIST=/home/ftp/pub/schooltool/trunk
4
4
PYTHON=python
 
5
BUILDOUT_FLAGS=
5
6
 
6
7
INSTANCE_TYPE=schooltool
7
 
BUILDOUT_FLAGS=
 
8
INSTANCE=instance
 
9
SUPERVISOR_CONF=-c $(INSTANCE)/supervisord.conf
8
10
 
9
11
PACKAGES=src/schooltool src/schooltool.gradebook src/schooltool.intervention src/schooltool.lyceum.journal src/schooltool.devtools src/schooltool.cando src/schooltool.virginia
10
12
 
46
48
        bin/develop update --force
47
49
        $(MAKE) BUILDOUT_FLAGS=-n
48
50
 
49
 
instance: | build
50
 
        bin/make-schooltool-instance instance instance_type=$(INSTANCE_TYPE)
 
51
$(INSTANCE): | build
 
52
        bin/make-schooltool-instance $(INSTANCE) instance_type=$(INSTANCE_TYPE)
51
53
 
52
 
instance/run/supervisord.pid:
53
 
        bin/supervisord
 
54
$(INSTANCE)/run/supervisord.pid:
 
55
        bin/supervisord $(SUPERVISOR_CONF)
54
56
 
55
57
.PHONY: run
56
 
run: build instance instance/run/supervisord.pid
57
 
        @bin/supervisorctl start "services:*"
58
 
        @bin/supervisorctl status schooltool | grep RUNNING && bin/supervisorctl stop schooltool || exit 0
59
 
        @bin/supervisorctl status
60
 
        bin/start-schooltool-instance instance
 
58
run: build $(INSTANCE) $(INSTANCE)/run/supervisord.pid
 
59
        @bin/supervisorctl $(SUPERVISOR_CONF) start "services:*"
 
60
        @bin/supervisorctl $(SUPERVISOR_CONF) status schooltool | grep RUNNING && bin/supervisorctl $(SUPERVISOR_CONF) stop schooltool || exit 0
 
61
        @bin/supervisorctl $(SUPERVISOR_CONF) status
 
62
        bin/start-schooltool-instance $(INSTANCE)
61
63
 
62
64
.PHONY: start
63
 
start: build instance instance/run/supervisord.pid
64
 
        bin/supervisorctl start all
65
 
        @bin/supervisorctl status
 
65
start: build $(INSTANCE) $(INSTANCE)/run/supervisord.pid
 
66
        bin/supervisorctl $(SUPERVISOR_CONF) start all
 
67
        @bin/supervisorctl $(SUPERVISOR_CONF) status
66
68
 
67
69
.PHONY: start-services
68
 
start-services: build instance instance/run/supervisord.pid
69
 
        @bin/supervisorctl status | grep services[:] | grep -v RUNNING && bin/supervisorctl start "services:*" || exit 0
70
 
        @bin/supervisorctl status | grep services[:]
 
70
start-services: build $(INSTANCE) $(INSTANCE)/run/supervisord.pid
 
71
        @bin/supervisorctl $(SUPERVISOR_CONF) status | grep services[:] | grep -v RUNNING && bin/supervisorctl $(SUPERVISOR_CONF) start "services:*" || exit 0
 
72
        @bin/supervisorctl $(SUPERVISOR_CONF) status | grep services[:]
71
73
 
72
74
.PHONY: restart
73
 
restart: build instance instance/run/supervisord.pid
74
 
        @bin/supervisorctl restart "services:celery_report"
75
 
        @bin/supervisorctl start "services:*"
76
 
        bin/supervisorctl restart schooltool
77
 
        @bin/supervisorctl status
 
75
restart: build $(INSTANCE) $(INSTANCE)/run/supervisord.pid
 
76
        @bin/supervisorctl $(SUPERVISOR_CONF) restart "services:celery_report"
 
77
        @bin/supervisorctl $(SUPERVISOR_CONF) start "services:*"
 
78
        bin/supervisorctl $(SUPERVISOR_CONF) restart schooltool
 
79
        @bin/supervisorctl $(SUPERVISOR_CONF) status
78
80
 
79
81
.PHONY: rerun
80
 
rerun: build instance instance/run/supervisord.pid
81
 
        @bin/supervisorctl restart "services:celery_report"
82
 
        @bin/supervisorctl start "services:*"
83
 
        @bin/supervisorctl status schooltool | grep RUNNING && bin/supervisorctl stop schooltool || exit 0
84
 
        @bin/supervisorctl status
85
 
        bin/start-schooltool-instance instance
 
82
rerun: build $(INSTANCE) $(INSTANCE)/run/supervisord.pid
 
83
        @bin/supervisorctl $(SUPERVISOR_CONF) restart "services:celery_report"
 
84
        @bin/supervisorctl $(SUPERVISOR_CONF) start "services:*"
 
85
        @bin/supervisorctl $(SUPERVISOR_CONF) status schooltool | grep RUNNING && bin/supervisorctl $(SUPERVISOR_CONF) stop schooltool || exit 0
 
86
        @bin/supervisorctl $(SUPERVISOR_CONF) status
 
87
        bin/start-schooltool-instance $(INSTANCE)
86
88
 
87
89
.PHONY: stop
88
90
stop:
89
 
        @test -S instance/run/supervisord.sock && bin/supervisorctl status | grep -v STOPPED && bin/supervisorctl stop all || exit 0
90
 
        @test -S instance/run/supervisord.sock && bin/supervisorctl shutdown || echo Nothing to stop
91
 
        @rm -f instance/run/zeo.sock
92
 
        @rm -f instance/run/supervisord.sock
93
 
        @rm -f instance/run/supervisord.pid
 
91
        @test -S $(INSTANCE)/run/supervisord.sock && bin/supervisorctl $(SUPERVISOR_CONF) status | grep -v STOPPED && bin/supervisorctl $(SUPERVISOR_CONF) stop all || exit 0
 
92
        @test -S $(INSTANCE)/run/supervisord.sock && bin/supervisorctl $(SUPERVISOR_CONF) shutdown || echo Nothing to stop
 
93
        @rm -f $(INSTANCE)/run/zeo.sock
 
94
        @rm -f $(INSTANCE)/run/supervisord.sock
 
95
        @rm -f $(INSTANCE)/run/supervisord.pid
94
96
 
95
97
.PHONY: status
96
98
status:
97
 
        @test -f instance/run/supervisord.pid && bin/supervisorctl status || echo All services shut down
 
99
        @test -f $(INSTANCE)/run/supervisord.pid && bin/supervisorctl $(SUPERVISOR_CONF) status || echo All services shut down
98
100
 
99
101
.PHONY: tags
100
102
tags: bin/ctags
107
109
        rm -rf build
108
110
        rm -f ID TAGS tags
109
111
        rm -rf coverage ftest-coverage
110
 
        rm -rf instance/var/celerybeat-schedule
111
 
        rm -rf instance/var/redis-dump.rdb
112
 
        rm -rf instance/run/zeo.sock
113
 
        rm -rf instance/run/supervisord.sock
114
 
        rm -rf instance/run/supervisord.pid
115
 
        rm -rf instance/var/Data.fs.lock
 
112
        rm -rf $(INSTANCE)/var/celerybeat-schedule
 
113
        rm -rf $(INSTANCE)/var/redis-dump.rdb
 
114
        rm -rf $(INSTANCE)/run/zeo.sock
 
115
        rm -rf $(INSTANCE)/run/supervisord.sock
 
116
        rm -rf $(INSTANCE)/run/supervisord.pid
 
117
        rm -rf $(INSTANCE)/var/Data.fs.lock
116
118
        find . -name '*.py[co]' -delete
117
119
        find . -name '*.mo' -delete
118
120
        find . -name 'LC_MESSAGES' -exec rmdir -p --ignore-fail-on-non-empty {} +
122
124
        rm -f buildout.cfg
123
125
        rm -rf eggs
124
126
        rm -rf dist
125
 
        rm -rf instance
 
127
        rm -rf $(INSTANCE)
126
128
        $(MAKE) clean
127
129
 
128
130
# Tests