52 lines
989 B
Makefile
52 lines
989 B
Makefile
.PHONY: run test lint deps init-db dev build logs logs-worker logs-all down shell-postgres shell-api shell-worker status
|
|
|
|
# Docker Compose: use parent dir's compose file (when run via make -C devices-api)
|
|
COMPOSE := docker-compose -f ../docker-compose.yml
|
|
|
|
run:
|
|
lua app-standalone.lua
|
|
|
|
test:
|
|
lua run_tests.lua
|
|
|
|
lint:
|
|
luacheck . --codes
|
|
|
|
deps:
|
|
luarocks install lua-cjson luasocket pgmoon redis-lua luaossl
|
|
|
|
# Docker Compose targets (run from project root: make -C devices-api <target>)
|
|
init-db:
|
|
$(COMPOSE) exec postgres psql -U devices_user -d handheld_devices \
|
|
-f /docker-entrypoint-initdb.d/001_create_devices.sql
|
|
|
|
dev up:
|
|
$(COMPOSE) up -d
|
|
|
|
build:
|
|
$(COMPOSE) build
|
|
|
|
logs:
|
|
$(COMPOSE) logs -f api
|
|
|
|
logs-worker:
|
|
$(COMPOSE) logs -f worker
|
|
|
|
logs-all:
|
|
$(COMPOSE) logs -f
|
|
|
|
down:
|
|
$(COMPOSE) down
|
|
|
|
shell-postgres:
|
|
$(COMPOSE) exec postgres psql -U devices_user -d handheld_devices
|
|
|
|
shell-api:
|
|
$(COMPOSE) exec api sh
|
|
|
|
shell-worker:
|
|
$(COMPOSE) exec worker sh
|
|
|
|
status:
|
|
$(COMPOSE) ps
|