aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a4b2b97
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+.PHONY: deploy
+
+include deployment-config.mk
+
+SSH_OPTS := -q -o ControlMaster=auto -o ControlPath=.ssh-deployment.sock
+
+deploy:
+ @echo " SSH $(WEB_SERVER)"
+ @ssh $(SSH_OPTS) -Nf $(WEB_SERVER)
+
+ @echo " RSYNC . $(WEB_SERVER):$(FLASK_PATH)"
+ @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(FLASK_USER) -v"
+ @rsync -aizm --delete-excluded --exclude=.ssh-deployment.sock --exclude=.git --exclude=Makefile --exclude="*.pyc" --exclude="*.mk" --exclude=.gitignore --exclude="*.swp" \
+ --filter="P pastes/" --rsh="ssh $(SSH_OPTS)" --rsync-path="sudo -n -u $(FLASK_USER) rsync" \
+ . "$(WEB_SERVER):$(FLASK_PATH)"
+
+ @echo " CHMOD 750/640 $(WEB_SERVER):$(FLASK_PATH)/*"
+ @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo find -P '$(FLASK_PATH)' \! -path '$(FLASK_PATH)/pastes/*' -type f -exec chmod 640 {} \;; \
+ sudo find -P '$(FLASK_PATH)' \! -path '$(FLASK_PATH)/pastes/*' -type d -exec chmod 750 {} \;;"
+
+ @echo " CHOWN $(FLASK_USER):$(NGINX_USER) $(WEB_SERVER):$(FLASK_PATH)/pastes"
+ @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo mkdir -p '$(FLASK_PATH)/pastes'; sudo chown $(FLASK_USER):$(NGINX_USER) '$(FLASK_PATH)' '$(FLASK_PATH)/pastes'"
+ @echo " CHMOD 710 $(WEB_SERVER):$(FLASK_PATH)"
+ @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chmod 710 '$(FLASK_PATH)'"
+
+ @echo " UWSGI restart $(WEB_SERVER)"
+ @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo /etc/init.d/uwsgi restart"
+
+ @echo " SSH $(WEB_SERVER)"
+ @ssh -O exit $(SSH_OPTS) $(WEB_SERVER)