Last active
January 11, 2020 22:53
Revisions
-
wienczny revised this gist
Mar 30, 2016 . 1 changed file with 24 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,22 +17,22 @@ SCRIPT=$(readlink -f "$0") ROOT="/srv/http" # You can hard-code the path here instead. DATA="/srv/phabricator" BACKUP="/srv/backup" # Backup directory REPOSITORY="/srv/backup/phabricator.borg" cd $ROOT PHABRICATOR_UID=`stat -c %u $ROOT/phabricator` CURRENT_UID=`id -u` ### STOP WEB SERVER AND DAEMONS ############################################### # Stop daemons. sudo /bin/systemctl stop phabricator-phd # If running the notification server, stop it. sudo /bin/systemctl stop phabricator-aphlict # Stop the webserver (apache, nginx, lighttpd, etc). This command will differ # depending on which system and webserver you are running: replace it with an # appropriate command for your system. # NOTE: If you're running php-fpm, you should stop it here too. @@ -48,29 +48,32 @@ fi ### BACKUP ##################################################################### mkdir -p "${DATA}/backup" "$ROOT/phabricator/bin/storage" dump > "${DATA}/backup/phabricator-mysql.sql" borg create --verbose --progress --stats --exclude-caches --one-file-system --compression=lzma,9 \ "$REPOSITORY::phabricator-`date --iso-8601=seconds`"\ "${ROOT}" \ "${DATA}" ### UPDATE WORKING COPIES ###################################################### echo "Update libphutil" cd "$ROOT/libphutil" git pull echo "Update arcanist" cd "$ROOT/arcanist" git pull echo "Update phabricator" cd "$ROOT/phabricator" git pull ### START WEB SERVER AND DAEMONS ############################################### # Upgrade the database schema. You may want to add the "--force" flag to allow # this script to run noninteractively. "$ROOT/phabricator/bin/storage" upgrade --force # Restart the webserver. As above, this depends on your system and webserver. # NOTE: If you're running php-fpm, restart it here too. @@ -85,4 +88,4 @@ sudo /bin/systemctl start phabricator-aphlict ### CLEAN OLD BACKUPS ######################################################## borg prune -v "$REPOSITORY" --keep-daily=7 --keep-weekly=4 --keep-monthly=6 -
wienczny revised this gist
Nov 27, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,7 @@ set -x # NOTE: This script assumes you are running it from a directory which contains # arcanist/, libphutil/, and phabricator/. SCRIPT=$(readlink -f "$0") ROOT="/srv/http" # You can hard-code the path here instead. DATA="/srv/phabricator" BACKUP="/srv/backup" # Backup directory @@ -41,7 +42,7 @@ sudo /bin/systemctl stop php5-fpm ### CHANGE USER ################################################################ if [ "$CURRENT_UID" != "$PHABRICATOR_UID" ]; then sudo -u "#$PHABRICATOR_UID" "$SCRIPT" exit 0 fi @@ -50,7 +51,7 @@ fi mkdir -p ${DATA}/backup $ROOT/phabricator/bin/storage dump > ${DATA}/backup/phabricator-mysql.sql attic create --stats \ $REPOSITORY::phabricator-`date --iso-8601=seconds` \ ${ROOT} \ ${DATA} -
wienczny revised this gist
Nov 17, 2015 . 1 changed file with 19 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,7 @@ set -e set -x # This script should be run as user phabricator # This is an example script for updating Phabricator, similar to the one used to # update <https://secure.phabricator.com/>. It might not work perfectly on your @@ -15,7 +14,9 @@ set -x # arcanist/, libphutil/, and phabricator/. ROOT="/srv/http" # You can hard-code the path here instead. DATA="/srv/phabricator" BACKUP="/srv/backup" # Backup directory REPOSITORY="/srv/backup/phabricator.attic" cd $ROOT PHABRICATOR_UID=`stat -c %u $ROOT/phabricator` @@ -24,17 +25,18 @@ CURRENT_UID=`id -u` ### STOP WEB SERVER AND DAEMONS ############################################### # Stop daemons. sudo /bin/systemctl stop phabricator-phd # If running the notification server, stop it. sudo /bin/systemctl stop phabricator-aphlict # Stop the webserver (apache, nginx, lighttpd, etc). This command will differ # depending on which system and webserver you are running: replace it with an # appropriate command for your system. # NOTE: If you're running php-fpm, you should stop it here too. sudo /bin/systemctl stop nginx sudo /bin/systemctl stop php5-fpm ### CHANGE USER ################################################################ @@ -45,12 +47,12 @@ fi ### BACKUP ##################################################################### mkdir -p ${DATA}/backup $ROOT/phabricator/bin/storage dump > ${DATA}/backup/phabricator-mysql.sql attic create --stats \ $REPOSITORY::phabricator-`date +%Y-%m-%d-%H-%M` \ ${ROOT} \ ${DATA} ### UPDATE WORKING COPIES ###################################################### @@ -71,17 +73,15 @@ $ROOT/phabricator/bin/storage upgrade --force # Restart the webserver. As above, this depends on your system and webserver. # NOTE: If you're running php-fpm, restart it here too. sudo /bin/systemctl start php5-fpm sudo /bin/systemctl start nginx # Restart daemons. sudo /bin/systemctl start phabricator-phd # If running the notification server, start it. sudo /bin/systemctl start phabricator-aphlict ### CLEAN OLD BACKUPS ######################################################## attic prune -v $REPOSITORY --keep-daily=7 --keep-weekly=4 --keep-monthly=6 -
wienczny revised this gist
Sep 16, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ fi ### BACKUP ##################################################################### # datestamp has a formatted date DATESTAMP=`date +"%Y-%m-%d"` mkdir -p ${BACKUP} $ROOT/phabricator/bin/storage dump | xz > ${BACKUP}/phabricator-mysql-${DATESTAMP}.xz -
wienczny revised this gist
Apr 6, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,8 +49,8 @@ fi DATESTAMP=`date +"%d-%m-%Y"` mkdir -p ${BACKUP} $ROOT/phabricator/bin/storage dump | xz > ${BACKUP}/phabricator-mysql-${DATESTAMP}.xz tar -cJf ${BACKUP}/phabricator-data-${DATESTAMP}.tar.xz ${ROOT} ### UPDATE WORKING COPIES ###################################################### @@ -83,5 +83,5 @@ $ROOT/phabricator/bin/aphlict start ### CLEAN OLD BACKUPS ######################################################## if [ -d ${BACKUP} ]; then find ${BACKUP} -mtime +15 -type f -exec rm -v {} \; fi -
wienczny renamed this gist
Mar 10, 2015 . 1 changed file with 37 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,8 @@ set -e set -x # This script should be run as user phabricator. If not run as phabricator it # tries to sudo into this script again as phabricator. # This is an example script for updating Phabricator, similar to the one used to # update <https://secure.phabricator.com/>. It might not work perfectly on your @@ -14,16 +15,43 @@ set -x # arcanist/, libphutil/, and phabricator/. ROOT="/srv/http" # You can hard-code the path here instead. BACKUP="/srv/backup" # Backup directory cd $ROOT PHABRICATOR_UID=`stat -c %u $ROOT/phabricator` CURRENT_UID=`id -u` ### STOP WEB SERVER AND DAEMONS ############################################### # Stop daemons. $ROOT/phabricator/bin/phd stop # If running the notification server, stop it. $ROOT/phabricator/bin/aphlict stop # Stop the webserver (apache, nginx, lighttpd, etc). This command will differ # depending on which system and webserver you are running: replace it with an # appropriate command for your system. # NOTE: If you're running php-fpm, you should stop it here too. sudo /etc/init.d/nginx stop sudo /etc/init.d/php5-fpm stop ### CHANGE USER ################################################################ if [ "$CURRENT_UID" != "$PHABRICATOR_UID" ]; then sudo -u "#$PHABRICATOR_UID" "./$0" exit 0 fi ### BACKUP ##################################################################### # datestamp has a formatted date DATESTAMP=`date +"%d-%m-%Y"` mkdir -p ${BACKUP} $ROOT/phabricator/bin/storage dump | gzip > ${BACKUP}/phabricator-mysql-${DATESTAMP}.gz tar -cjvf ${BACKUP}/phabricator-data-${DATESTAMP}.tar.bz2 ${ROOT} ### UPDATE WORKING COPIES ###################################################### cd $ROOT/libphutil @@ -35,22 +63,7 @@ git pull cd $ROOT/phabricator git pull ### START WEB SERVER AND DAEMONS ############################################### # Upgrade the database schema. You may want to add the "--force" flag to allow # this script to run noninteractively. @@ -65,4 +78,10 @@ sudo /etc/init.d/nginx start $ROOT/phabricator/bin/phd start # If running the notification server, start it. $ROOT/phabricator/bin/aphlict start ### CLEAN OLD BACKUPS ######################################################## if [ -d ${BACKUP} ]; then find ${BACKUP} -mtime +7 -type f -exec rm -v {} \; fi -
wienczny created this gist
Oct 14, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ #!/bin/sh set -e set -x # This script should be run as user phabricator. If run as root it switches user # This is an example script for updating Phabricator, similar to the one used to # update <https://secure.phabricator.com/>. It might not work perfectly on your # system, but hopefully it should be easy to adapt. This script is not intended # to work without modifications. # NOTE: This script assumes you are running it from a directory which contains # arcanist/, libphutil/, and phabricator/. ROOT="/srv/http" # You can hard-code the path here instead. cd $ROOT PHABRICATOR_UID=`stat -c %u $ROOT/phabricator` CURRENT_UID=`id -u` if [ "$CURRENT_UID" != "$PHABRICATOR_UID" ]; then sudo -u "#$PHABRICATOR_UID" "./$0" exit 0 fi ### UPDATE WORKING COPIES ###################################################### cd $ROOT/libphutil git pull cd $ROOT/arcanist git pull cd $ROOT/phabricator git pull ### CYCLE WEB SERVER AND DAEMONS ############################################### # Stop daemons. $ROOT/phabricator/bin/phd stop # If running the notification server, stop it. $ROOT/phabricator/bin/aphlict stop # Stop the webserver (apache, nginx, lighttpd, etc). This command will differ # depending on which system and webserver you are running: replace it with an # appropriate command for your system. # NOTE: If you're running php-fpm, you should stop it here too. sudo /etc/init.d/nginx stop sudo /etc/init.d/php5-fpm stop # Upgrade the database schema. You may want to add the "--force" flag to allow # this script to run noninteractively. $ROOT/phabricator/bin/storage upgrade --force # Restart the webserver. As above, this depends on your system and webserver. # NOTE: If you're running php-fpm, restart it here too. sudo /etc/init.d/php5-fpm start sudo /etc/init.d/nginx start # Restart daemons. $ROOT/phabricator/bin/phd start # If running the notification server, start it. sudo $ROOT/phabricator/bin/aphlict start