diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-06 14:17:16 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-07 20:40:24 +0100 |
commit | 26c35ae60de7c8d4e52324b99d436a592ada9655 (patch) | |
tree | 88428c3abb3687efb62353215a58d638e657133e | |
parent | Work with recent flask (diff) | |
download | zmusic-ng-26c35ae60de7c8d4e52324b99d436a592ada9655.tar.xz zmusic-ng-26c35ae60de7c8d4e52324b99d436a592ada9655.zip |
Simplify deployment
-rw-r--r-- | Makefile | 36 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | server.cfg | 7 |
3 files changed, 16 insertions, 32 deletions
@@ -16,34 +16,22 @@ deploy: all @ssh $(SSH_OPTS) -Nf $(WEB_SERVER) @echo " RSYNC frontend/ $(WEB_SERVER):$(SERVER_STATIC_PATH)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(SERVER_STATIC_USER) -v" - @rsync -aizm --delete-excluded --exclude=Makefile --exclude=*.swp --exclude=bin/ --exclude=Makefile \ - --include=scripts.min.js --include=styles.min.css --exclude=*.js --exclude=*.css --rsh="ssh $(SSH_OPTS)" \ - --rsync-path="sudo -n -u $(SERVER_STATIC_USER) rsync" frontend/ "$(WEB_SERVER):$(SERVER_STATIC_PATH)" + @rsync -rltizm --delete-excluded --exclude=Makefile --exclude=*.swp --exclude=bin/ --exclude=Makefile \ + --include=scripts.min.js --include=styles.min.css --exclude=*.js --exclude=*.css \ + --rsh="ssh $(SSH_OPTS)" frontend/ "$(WEB_SERVER):$(SERVER_STATIC_PATH)" - @echo " CHOWN $(SERVER_STATIC_USER):$(SERVER_APP_USER) $(WEB_SERVER):$(SERVER_STATIC_PATH)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chown -R $(SERVER_STATIC_USER):$(SERVER_APP_USER) '$(SERVER_STATIC_PATH)'" + @echo " RSYNC backend/zmusic/ $(WEB_SERVER):$(SERVER_APP_PATH)" + @rsync -rltizm --delete-excluded --exclude=*.swp --exclude=*.pyc --filter="P app.cfg" \ + --rsh="ssh $(SSH_OPTS)" backend/zmusic/ "$(WEB_SERVER):$(SERVER_APP_PATH)" - @echo " RSYNC backend/zmusic $(WEB_SERVER):$(SERVER_APP_PATH)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(SERVER_APP_USER) -v" - @rsync -aizm --delete-excluded --filter="P zmusic.db" --filter="P app.cfg" --exclude=*.swp --exclude=*.pyc \ - --rsh="ssh $(SSH_OPTS)" --rsync-path="sudo -n -u $(SERVER_APP_USER) rsync" backend/zmusic/ "$(WEB_SERVER):$(SERVER_APP_PATH)" - - @echo " CHOWN $(SERVER_APP_USER):$(SERVER_APP_USER) $(WEB_SERVER):$(SERVER_APP_PATH)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chown -R $(SERVER_APP_USER):$(SERVER_APP_USER) '$(SERVER_APP_PATH)'" - - @echo " CHMOD 750/640 $(WEB_SERVER):$(SERVER_APP_PATH) $(WEB_SERVER):$(SERVER_STATIC_PATH)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo find '$(SERVER_APP_PATH)' '$(SERVER_STATIC_PATH)' -type f -exec chmod 640 {} \;; \ - sudo find '$(SERVER_APP_PATH)' '$(SERVER_STATIC_PATH)' -type d -exec chmod 750 {} \;;" - - @echo " UWSGI restart $(WEB_SERVER)" - @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo /etc/init.d/uwsgi restart" + @echo " UWSGI restart" + @ssh $(SSH_OPTS) $(WEB_SERVER) "systemctl restart uwsgi@emperor.service" @echo " SSH $(WEB_SERVER)" @ssh -O exit $(SSH_OPTS) $(WEB_SERVER) update-collection: - @echo " RSYNC $(LOCAL_COLLECTION_PATH) $(UPLOAD_SERVER):$(UPLOAD_SERVER_PATH)" - @rsync -avzPi --delete-excluded --delete-after --fuzzy --exclude=.directory '$(LOCAL_COLLECTION_PATH)/' '$(UPLOAD_SERVER):$(UPLOAD_SERVER_PATH)' - @echo " SCAN $(WEB_SERVER)" - @curl -L 'https://$(WEB_SERVER)/scan?username=$(ADMIN_USERNAME)&password=$(ADMIN_PASSWORD)' + @echo " RSYNC $(LOCAL_COLLECTION_PATH) $(WEB_SERVER):$(SERVER_MUSIC_PATH)" + @rsync -avziP --delete-excluded --delete-after --fuzzy --exclude=.directory '$(LOCAL_COLLECTION_PATH)/' '$(WEB_SERVER):$(SERVER_MUSIC_PATH)' + @echo " SCAN $(URL_BASE)" + @curl -L '$(URL_BASE)/scan?username=$(ADMIN_USERNAME)&password=$(ADMIN_PASSWORD)' @@ -194,9 +194,8 @@ For easy deployment, the makefile has some deployment targets, which are configu * `WEB_SERVER`: The hostname of the deployed server. * `SERVER_STATIC_PATH`: The path of the static frontend files. -* `SERVER_STATIC_USER`: The primary user for static file permissions. * `SERVER_APP_PATH`: The path of the python backend files. -* `SERVER_STATIC_USER`: The primary user of the python backup files. +* `URL_BASE`: The base URL of where to access this on the Internet. These makefile targets should be used with care, and the makefile itself should be inspected to ensure all commands are correct for custom configurations. @@ -245,7 +244,7 @@ The author does not condone or promote using this software for redistributing co ## License -Copyright (C) 2013-2019 Jason A. Donenfeld. All Rights Reserved. +Copyright (C) 2013-2021 Jason A. Donenfeld. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -1,13 +1,10 @@ LOCAL_COLLECTION_PATH = /home/zx2c4/Music -UPLOAD_SERVER = music.zx2c4.com -UPLOAD_SERVER_PATH = /mnt/storage/music -WEB_SERVER = music.zx2c4.com +WEB_SERVER = root@music.zx2c4.com SERVER_STATIC_PATH = /var/www/htdocs/music.zx2c4.com SERVER_APP_PATH = /var/www/uwsgi/zmusic SERVER_MUSIC_PATH = /mnt/storage/music -SERVER_APP_USER = zmusic -SERVER_STATIC_USER = nginx +URL_BASE = https://music.zx2c4.com ADMIN_USERNAME = msadmin ADMIN_PASSWORD = 2manyservers |