update_phabricator.sh 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/sh

set -e
set -x

# 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="/var/phabricator" # You can hard-code the path here instead.

### UPDATE WORKING COPIES ######################################################

cd $ROOT/libphutil
sudo -u phabricator git pull

cd $ROOT/arcanist
sudo -u phabricator git pull

cd $ROOT/phabricator
sudo -u phabricator git pull


### CYCLE WEB SERVER AND DAEMONS ###############################################

# Stop daemons.
31
sudo -u phabricator $ROOT/phabricator/bin/phd stop --force
32 33 34 35 36 37 38 39

# 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.
40 41
sudo monit unmonitor nginx
sudo monit unmonitor php7.3-fpm
42 43 44 45 46
sudo systemctl stop nginx.service
sudo systemctl stop php7.3-fpm.service

# Upgrade the database schema. You may want to add the "--force" flag to allow
# this script to run noninteractively.
47
sudo -u phabricator $ROOT/phabricator/bin/storage upgrade --force
48 49 50 51 52

# Restart the webserver. As above, this depends on your system and webserver.
# NOTE: If you're running php-fpm, restart it here too.
sudo systemctl start nginx.service
sudo systemctl start php7.3-fpm.service
53 54
sudo monit monitor nginx
sudo monit monitor php7.3-fpm
55 56

# Restart daemons.
57
sudo -u phabricator $ROOT/phabricator/bin/phd start
58 59 60

# If running the notification server, start it.
# $ROOT/phabricator/bin/aphlict start