Last active
January 11, 2020 22:53
-
-
Save wienczny/6a3bc449cbb33234b59f to your computer and use it in GitHub Desktop.
Phabricator Backup, Update and Launch script.
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 characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated from attic to borg