1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00
phorge-phorge/scripts/install/update_phabricator.sh
epriestley 087cc0808a Make SQL patch management DAG-based and provide namespace support
Summary:
This addresses three issues with the current patch management system:

  # Two people developing at the same time often pick the same SQL patch number, and then have to go rename it. The system catches this, but it's silly.
  # Second/third-party developers can't use the same system to manage auxiliary storage they may want to add.
  # There's no way to build mock databases for unit tests that need to do reads.

To resolve these things, you can now name your patches whatever you want and conflicts are just merge conflicts, which are less of a pain to fix than filename conflicts.

Dependencies are now a DAG, with implicit dependencies created on the prior patch if no dependencies are specified. Developers can add new concrete subclasses of `PhabricatorSQLPatchList` to add storage management, and define the dependency branchpoint of their patches so they apply in the correct order (although, generally, they should not depend on the mainline patches, presumably).

The commands `storage upgrade --namespace test1234` and `storage destroy --namespace test1234` will allow unit tests to build and destroy MySQL storage.

A "quickstart" mode allows an upgrade from scratch in ~1200ms. Destruction takes about 200ms. These seem like fairily reasonable costs to actually use in tests. Building from scratch patch-by-patch takes about 6000ms.

Test Plan:
  - Created new databases from scratch with and without quickstart in a separate test namespace. Pointed the webapp at the test namespaces, browsed around, everything looked good.
  - Compared quickstart and no-quickstart dump states, they're identical except for mysqldump timestamps and a few similar things.
  - Upgraded a legacy database to the new storage format.
  - Destroyed / dumped storage.

Reviewers: edward, vrana, btrahan, jungejason

Reviewed By: btrahan

CC: aran, nh

Maniphest Tasks: T140, T345

Differential Revision: https://secure.phabricator.com/D2323
2012-04-30 07:54:00 -07:00

77 lines
2.2 KiB
Bash
Executable file

#!/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.
# NOTE: This script assumes you are running it from a directory which contains
# arcanist/, libphutil/, phabricator/, and possibly diviner/.
ROOT=`pwd` # You can hard-code the path here instead.
### UPDATE WORKING COPIES ######################################################
if [ -e $ROOT/diviner ]
then
cd $ROOT/diviner
git pull
fi
cd $ROOT/libphutil
git pull
cd $ROOT/arcanist
git pull
cd $ROOT/phabricator
git pull
git submodule update --init
### RUN TESTS ##################################################################
# This is an acceptance test that makes sure all symbols can be loaded to
# avoid issues like missing methods in descendants of abstract base classes.
cd $ROOT/phabricator
../arcanist/bin/arc unit src/infrastructure/__tests__/
### CYCLE APACHE AND DAEMONS ###################################################
# Stop daemons.
$ROOT/phabricator/bin/phd stop
# Stop Apache. Depening on what system you're running, you may need to use
# 'apachectl' or something else to cycle apache.
sudo /etc/init.d/httpd stop
# Upgrade the database schema.
$ROOT/phabricator/bin/storage upgrade --force
# Restart apache.
sudo /etc/init.d/httpd start
# Restart daemons. Customize this to start whatever daemons you're running on
# your system.
# $ROOT/phabricator/bin/phd repository-launch-master
# $ROOT/phabricator/bin/phd launch garbagecollector
# $ROOT/phabricator/bin/phd launch 4 taskmaster
# $ROOT/phabricator/bin/phd launch ircbot /config/bot.json
### GENERATE DOCUMENTATION #####################################################
# This generates documentation if you have diviner/ checked out. You generally
# don't need to do this unless you're contributing to Phabricator and want to
# preview some of the amazing documentation you've just written.
if [ -e $ROOT/diviner ]
then
cd $ROOT/diviner && $ROOT/diviner/bin/diviner .
cd $ROOT/libphutil && $ROOT/diviner/bin/diviner .
cd $ROOT/arcanist && $ROOT/diviner/bin/diviner .
cd $ROOT/phabricator && $ROOT/diviner/bin/diviner .
fi