diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..17cc432 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +DEPLOY_DIR ?= /var/www/logs_reader +SERVICE ?= logs_reader + +.PHONY: build deploy status logs + +## Compile le binaire et les fichiers statiques en release. +build: + cargo leptos build --release + +## Installe la nouvelle version dans $(DEPLOY_DIR) et redémarre le service. +deploy: build + install -m 755 target/release/logs_reader $(DEPLOY_DIR)/logs_reader + rsync -a --delete target/site/ $(DEPLOY_DIR)/site/ + systemctl --user restart $(SERVICE) + @for i in $$(seq 1 50); do \ + curl -sf -o /dev/null http://127.0.0.1:3100/ && echo "Déployé : http://logs-reader.loc" && exit 0; \ + sleep 0.1; \ + done; echo "Le service ne répond pas : make logs" >&2; exit 1 + +status: + systemctl --user status $(SERVICE) --no-pager + +logs: + journalctl --user -u $(SERVICE) -f