FASTCGI_ENV = \
	POOL_ROLE=tasks \
	GDAL_DATA=/usr/share/gdal/1.10/

DEBUG_PORT := $(shell echo 18$$((0x`echo $$USER | md5sum | head -c 2`)))

debug:
	ya make
	$(FASTCGI_ENV) LOGGING_CONFIG=cfg/logger-console.cfg \
	./bin/fastcgi -w maps.wikimap.mapspro.services.tasks.fastcgi.bin.main:app --http :$(DEBUG_PORT)

start: stop
	ya make
	$(FASTCGI_ENV) LOGGING_CONFIG=cfg/logger-debug.cfg \
	./bin/fastcgi -s /tmp/yandex-maps-wiki-tasks-$(USER).sock -w maps.wikimap.mapspro.services.tasks.fastcgi.bin.main:app --threads 4 --daemonize uwsgi.log --pidfile uwsgi.pid

stop:
	if [ -e uwsgi.pid ]; then kill -INT $$(cat uwsgi.pid); rm uwsgi.pid; fi
