1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-21 22:32:41 +01:00

Remove PhabricatorSetup and make PHABRICATOR_ENV optional

Summary:
  - PHABRICATOR_ENV is now optional. If you don't specify it, we won't load a config file.
  - PhabricatorSetup is now gone.
    - I removed the alternate file domain check for now, see T2380.
  - `phabricator.setup` config is now gone.
  - Rewrote documentation:
    - No more mentions of `phabricator.setup`.
    - Normal install guide no longer mentions PHABRICATOR_ENV. This is now an advanced topic.
    - Clarified that you only need to set up one of apache, nginx or lighttpd.
    - Tweaked a few things I've seen users have difficulty with.

This should have no effect on any existing installs, but make the process much simpler for future installs.

Closes T2221.
Closes T2223.
Closes T2228.

Test Plan:
  - Removed my PHABRICATOR_ENV and went through the install process.
  - Generated and read documentation.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2221, T2223, T2228

Differential Revision: https://secure.phabricator.com/D4596
This commit is contained in:
epriestley 2013-01-23 12:03:19 -08:00
parent d1865072ea
commit 7e17acfb68
11 changed files with 220 additions and 313 deletions

1
.gitignore vendored
View file

@ -23,3 +23,4 @@
/conf/custom/* /conf/custom/*
/conf/local/local.json /conf/local/local.json
/conf/local/ENVIRONMENT /conf/local/ENVIRONMENT
/conf/local/VERSION

View file

@ -1,5 +1,9 @@
<?php <?php
// IMPORTANT: DO NOT EDIT THIS FILE.
// This file is no longer read by default, and your efforts will have no effect.
// Follow the instructions in the documentation to configure Phabricator.
return array( return array(
// The root URI which Phabricator is installed on. // The root URI which Phabricator is installed on.
@ -11,10 +15,6 @@ return array(
// contain the right links. // contain the right links.
'phabricator.production-uri' => null, 'phabricator.production-uri' => null,
// Setting this to 'true' will invoke a special setup mode which helps guide
// you through setting up Phabricator.
'phabricator.setup' => false,
// -- IMPORTANT! Security! -------------------------------------------------- // // -- IMPORTANT! Security! -------------------------------------------------- //
// IMPORTANT: By default, Phabricator serves files from the same domain the // IMPORTANT: By default, Phabricator serves files from the same domain the

View file

@ -539,13 +539,6 @@ celerity_register_resource_map(array(
'disk' => '/rsrc/image/texture/table_header_hover.png', 'disk' => '/rsrc/image/texture/table_header_hover.png',
'type' => 'png', 'type' => 'png',
), ),
'/rsrc/image/texture/table_header_tall.png' =>
array(
'hash' => 'b05525601f78d759f1c5e47fd9c1a8aa',
'uri' => '/res/b0552560/rsrc/image/texture/table_header_tall.png',
'disk' => '/rsrc/image/texture/table_header_tall.png',
'type' => 'png',
),
'/rsrc/swf/aphlict.swf' => '/rsrc/swf/aphlict.swf' =>
array( array(
'hash' => '4b9a9d83bebaf254f3790e87b45c1f92', 'hash' => '4b9a9d83bebaf254f3790e87b45c1f92',
@ -600,7 +593,7 @@ celerity_register_resource_map(array(
), ),
'aphront-dialog-view-css' => 'aphront-dialog-view-css' =>
array( array(
'uri' => '/res/215b3ab1/rsrc/css/aphront/dialog-view.css', 'uri' => '/res/0ec64c77/rsrc/css/aphront/dialog-view.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -609,7 +602,7 @@ celerity_register_resource_map(array(
), ),
'aphront-error-view-css' => 'aphront-error-view-css' =>
array( array(
'uri' => '/res/048ed376/rsrc/css/aphront/error-view.css', 'uri' => '/res/410dbe72/rsrc/css/aphront/error-view.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -3254,7 +3247,7 @@ celerity_register_resource_map(array(
), array( ), array(
'packages' => 'packages' =>
array( array(
'4dff6da8' => '2b575971' =>
array( array(
'name' => 'core.pkg.css', 'name' => 'core.pkg.css',
'symbols' => 'symbols' =>
@ -3298,7 +3291,7 @@ celerity_register_resource_map(array(
36 => 'phabricator-object-item-list-view-css', 36 => 'phabricator-object-item-list-view-css',
37 => 'global-drag-and-drop-css', 37 => 'global-drag-and-drop-css',
), ),
'uri' => '/res/pkg/4dff6da8/core.pkg.css', 'uri' => '/res/pkg/2b575971/core.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'c90b892e' => 'c90b892e' =>
@ -3488,19 +3481,19 @@ celerity_register_resource_map(array(
'reverse' => 'reverse' =>
array( array(
'aphront-attached-file-view-css' => '83f07678', 'aphront-attached-file-view-css' => '83f07678',
'aphront-crumbs-view-css' => '4dff6da8', 'aphront-crumbs-view-css' => '2b575971',
'aphront-dialog-view-css' => '4dff6da8', 'aphront-dialog-view-css' => '2b575971',
'aphront-error-view-css' => '4dff6da8', 'aphront-error-view-css' => '2b575971',
'aphront-form-view-css' => '4dff6da8', 'aphront-form-view-css' => '2b575971',
'aphront-headsup-action-list-view-css' => 'ec01d039', 'aphront-headsup-action-list-view-css' => 'ec01d039',
'aphront-headsup-view-css' => '4dff6da8', 'aphront-headsup-view-css' => '2b575971',
'aphront-list-filter-view-css' => '4dff6da8', 'aphront-list-filter-view-css' => '2b575971',
'aphront-pager-view-css' => '4dff6da8', 'aphront-pager-view-css' => '2b575971',
'aphront-panel-view-css' => '4dff6da8', 'aphront-panel-view-css' => '2b575971',
'aphront-table-view-css' => '4dff6da8', 'aphront-table-view-css' => '2b575971',
'aphront-tokenizer-control-css' => '4dff6da8', 'aphront-tokenizer-control-css' => '2b575971',
'aphront-tooltip-css' => '4dff6da8', 'aphront-tooltip-css' => '2b575971',
'aphront-typeahead-control-css' => '4dff6da8', 'aphront-typeahead-control-css' => '2b575971',
'differential-changeset-view-css' => 'ec01d039', 'differential-changeset-view-css' => 'ec01d039',
'differential-core-view-css' => 'ec01d039', 'differential-core-view-css' => 'ec01d039',
'differential-inline-comment-editor' => 'ac53d36a', 'differential-inline-comment-editor' => 'ac53d36a',
@ -3514,7 +3507,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => 'ec01d039', 'differential-table-of-contents-css' => 'ec01d039',
'diffusion-commit-view-css' => 'c8ce2d88', 'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88', 'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '4dff6da8', 'global-drag-and-drop-css' => '2b575971',
'inline-comment-summary-css' => 'ec01d039', 'inline-comment-summary-css' => 'ec01d039',
'javelin-aphlict' => 'c90b892e', 'javelin-aphlict' => 'c90b892e',
'javelin-behavior' => 'fbeded59', 'javelin-behavior' => 'fbeded59',
@ -3584,48 +3577,48 @@ celerity_register_resource_map(array(
'javelin-util' => 'fbeded59', 'javelin-util' => 'fbeded59',
'javelin-vector' => 'fbeded59', 'javelin-vector' => 'fbeded59',
'javelin-workflow' => 'fbeded59', 'javelin-workflow' => 'fbeded59',
'lightbox-attachment-css' => '4dff6da8', 'lightbox-attachment-css' => '2b575971',
'maniphest-task-summary-css' => '83f07678', 'maniphest-task-summary-css' => '83f07678',
'maniphest-transaction-detail-css' => '83f07678', 'maniphest-transaction-detail-css' => '83f07678',
'phabricator-busy' => 'c90b892e', 'phabricator-busy' => 'c90b892e',
'phabricator-content-source-view-css' => 'ec01d039', 'phabricator-content-source-view-css' => 'ec01d039',
'phabricator-core-buttons-css' => '4dff6da8', 'phabricator-core-buttons-css' => '2b575971',
'phabricator-core-css' => '4dff6da8', 'phabricator-core-css' => '2b575971',
'phabricator-crumbs-view-css' => '4dff6da8', 'phabricator-crumbs-view-css' => '2b575971',
'phabricator-directory-css' => '4dff6da8', 'phabricator-directory-css' => '2b575971',
'phabricator-drag-and-drop-file-upload' => 'ac53d36a', 'phabricator-drag-and-drop-file-upload' => 'ac53d36a',
'phabricator-dropdown-menu' => 'c90b892e', 'phabricator-dropdown-menu' => 'c90b892e',
'phabricator-file-upload' => 'c90b892e', 'phabricator-file-upload' => 'c90b892e',
'phabricator-filetree-view-css' => '4dff6da8', 'phabricator-filetree-view-css' => '2b575971',
'phabricator-flag-css' => '4dff6da8', 'phabricator-flag-css' => '2b575971',
'phabricator-form-view-css' => '4dff6da8', 'phabricator-form-view-css' => '2b575971',
'phabricator-header-view-css' => '4dff6da8', 'phabricator-header-view-css' => '2b575971',
'phabricator-jump-nav' => '4dff6da8', 'phabricator-jump-nav' => '2b575971',
'phabricator-keyboard-shortcut' => 'c90b892e', 'phabricator-keyboard-shortcut' => 'c90b892e',
'phabricator-keyboard-shortcut-manager' => 'c90b892e', 'phabricator-keyboard-shortcut-manager' => 'c90b892e',
'phabricator-main-menu-view' => '4dff6da8', 'phabricator-main-menu-view' => '2b575971',
'phabricator-menu-item' => 'c90b892e', 'phabricator-menu-item' => 'c90b892e',
'phabricator-nav-view-css' => '4dff6da8', 'phabricator-nav-view-css' => '2b575971',
'phabricator-notification' => 'c90b892e', 'phabricator-notification' => 'c90b892e',
'phabricator-notification-css' => '4dff6da8', 'phabricator-notification-css' => '2b575971',
'phabricator-notification-menu-css' => '4dff6da8', 'phabricator-notification-menu-css' => '2b575971',
'phabricator-object-item-list-view-css' => '4dff6da8', 'phabricator-object-item-list-view-css' => '2b575971',
'phabricator-object-selector-css' => 'ec01d039', 'phabricator-object-selector-css' => 'ec01d039',
'phabricator-paste-file-upload' => 'c90b892e', 'phabricator-paste-file-upload' => 'c90b892e',
'phabricator-prefab' => 'c90b892e', 'phabricator-prefab' => 'c90b892e',
'phabricator-project-tag-css' => '83f07678', 'phabricator-project-tag-css' => '83f07678',
'phabricator-remarkup-css' => '4dff6da8', 'phabricator-remarkup-css' => '2b575971',
'phabricator-shaped-request' => 'ac53d36a', 'phabricator-shaped-request' => 'ac53d36a',
'phabricator-side-menu-view-css' => '4dff6da8', 'phabricator-side-menu-view-css' => '2b575971',
'phabricator-standard-page-view' => '4dff6da8', 'phabricator-standard-page-view' => '2b575971',
'phabricator-textareautils' => 'c90b892e', 'phabricator-textareautils' => 'c90b892e',
'phabricator-tooltip' => 'c90b892e', 'phabricator-tooltip' => 'c90b892e',
'phabricator-transaction-view-css' => '4dff6da8', 'phabricator-transaction-view-css' => '2b575971',
'phabricator-zindex-css' => '4dff6da8', 'phabricator-zindex-css' => '2b575971',
'sprite-apps-large-css' => '4dff6da8', 'sprite-apps-large-css' => '2b575971',
'sprite-gradient-css' => '4dff6da8', 'sprite-gradient-css' => '2b575971',
'sprite-icon-css' => '4dff6da8', 'sprite-icon-css' => '2b575971',
'sprite-menu-css' => '4dff6da8', 'sprite-menu-css' => '2b575971',
'syntax-highlighting-css' => '4dff6da8', 'syntax-highlighting-css' => '2b575971',
), ),
)); ));

View file

@ -1210,7 +1210,6 @@ phutil_register_library_map(array(
'PhabricatorSettingsPanelProfile' => 'applications/settings/panel/PhabricatorSettingsPanelProfile.php', 'PhabricatorSettingsPanelProfile' => 'applications/settings/panel/PhabricatorSettingsPanelProfile.php',
'PhabricatorSettingsPanelSSHKeys' => 'applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php', 'PhabricatorSettingsPanelSSHKeys' => 'applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php',
'PhabricatorSettingsPanelSearchPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelSearchPreferences.php', 'PhabricatorSettingsPanelSearchPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelSearchPreferences.php',
'PhabricatorSetup' => 'infrastructure/PhabricatorSetup.php',
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php', 'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php', 'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php',
'PhabricatorSetupCheckBaseURI' => 'applications/config/check/PhabricatorSetupCheckBaseURI.php', 'PhabricatorSetupCheckBaseURI' => 'applications/config/check/PhabricatorSetupCheckBaseURI.php',

View file

@ -125,9 +125,6 @@ final class PhabricatorCoreConfigOptions
$this->newOption('phabricator.env', 'string', null) $this->newOption('phabricator.env', 'string', null)
->setLocked(true) ->setLocked(true)
->setDescription(pht('Internal.')), ->setDescription(pht('Internal.')),
$this->newOption('phabricator.setup', 'bool', false)
->setLocked(true)
->setDescription(pht('Internal / deprecated.')),
$this->newOption('test.value', 'wild', null) $this->newOption('test.value', 'wild', null)
->setLocked(true) ->setLocked(true)
->setDescription(pht('Unit test value.')), ->setDescription(pht('Unit test value.')),

View file

@ -8,85 +8,17 @@ This document contains basic configuration instructions for Phabricator.
This document assumes you've already installed all the components you need. This document assumes you've already installed all the components you need.
If you haven't, see @{article:Installation Guide}. If you haven't, see @{article:Installation Guide}.
= Configuring Phabricator = The next steps are:
Create a new file here: - Configure your webserver (Apache, nginx, or lighttpd).
- Access Phabricator with your browser.
path/to/phabricator/conf/custom/myconfig.conf.php - Follow the instructions to complete setup.
...where ##myconfig## is some name which identifies your installation. Put this
in the file:
name=myconfig.conf.php, lang=php
<?php
return array(
// Important! This will put Phabricator into setup mode to help you
// configure things.
'phabricator.setup' => true,
// This will be the base domain for your install, and must be configured.
// Use "https://" if you have SSL. See below for some notes.
'phabricator.base-uri' => 'http://phabricator.example.com/',
// Connection information for MySQL.
'mysql.host' => 'localhost',
'mysql.user' => 'root',
'mysql.pass' => 'trustno1hunter2',
// Basic email domain configuration.
'metamta.default-address' => 'noreply@phabricator.example.com',
'metamta.domain' => 'phabricator.example.com',
// NOTE: Check default.conf.php for detailed explanations of all the
// configuration options, including these.
) + phabricator_read_config_file('production');
For the last line, you can also use ##'development'## instead of
##'production'## if you are planning to develop Phabricator itself. This will
turn on some debugging features.
= PHABRICATOR_ENV Environment Variable =
When running Phabricator scripts, they will ask you to set the `PHABRICATOR_ENV`
environment variable to point at your config. If you put your script in
`custom/myconfig.conf.php`, you can identify the config with
`custom/myconfig`, like this:
$ PHABRICATOR_ENV=custom/myconfig ./some_phabricator_command
NOTE: Make sure you put 'PHABRICATOR_ENV=...' at the beginning of the line, not
in the middle. The shell won't parse environmental variables declared after the
command. You can also ##export PHABRICATOR_ENV=...## in your ~/.bashrc or
~/.profile or similar, depending on which shell you use and how your system is
configured.
= Storage: Configuring MySQL =
Get MySQL running and verify you can connect to it. Consult the MySQL
documentation for help. When MySQL works, you need to load the Phabricator
schemata into it. To do this, run:
phabricator/ $ ./bin/storage upgrade
If your configuration uses an unprivileged user to connect to the database, you
may have to override the default user so the schema changes can be applied with
root or some other admin user:
phabricator/ $ ./bin/storage upgrade --user <user> --password <password>
You can avoid the prompt the script issues by passing the ##--force## flag (for
example, if you are scripting the upgrade process).
phabricator/ $ ./bin/storage upgrade --force
NOTE: When you update Phabricator, run `storage upgrade` again to apply any
new updates.
= Webserver: Configuring Apache = = Webserver: Configuring Apache =
NOTE: Follow these instructions to use Apache. To use nginx or lighttpd, scroll
down to their sections.
Get Apache running and verify it's serving a test page. Consult the Apache Get Apache running and verify it's serving a test page. Consult the Apache
documentation for help. Make sure ##mod_php## and ##mod_rewrite## are enabled, documentation for help. Make sure ##mod_php## and ##mod_rewrite## are enabled,
and ##mod_ssl## if you intend to set up SSL. and ##mod_ssl## if you intend to set up SSL.
@ -104,28 +36,36 @@ this:
name=httpd.conf name=httpd.conf
<VirtualHost *> <VirtualHost *>
# Change this to the domain which points to your host, i.e. the domain # Change this to the domain which points to your host.
# you set as "phabricator.base-uri".
ServerName phabricator.example.com ServerName phabricator.example.com
# Change this to the path where you put 'phabricator' when you checked it # Change this to the path where you put 'phabricator' when you checked it
# out from github when following the Installation Guide. # out from GitHub when following the Installation Guide.
#
# Make sure you include "/webroot" at the end!
DocumentRoot /path/to/phabricator/webroot DocumentRoot /path/to/phabricator/webroot
RewriteEngine on RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA] RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA] RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
# This will use the config file you set up in the previous step. If you
# called it something other than 'myconfig', put that here.
SetEnv PHABRICATOR_ENV custom/myconfig
</VirtualHost> </VirtualHost>
Continue to "Setup" below. If Apache isn't currently configured to serve documents out of the directory
where you put Phabricator, you may also need to add a section like this:
<Directory "/path/to/phabricator/webroot">
Order allow,deny
Allow from all
</Directory>
After making your edits, restart Apache, then continue to "Setup" below.
= Webserver: Configuring nginx = = Webserver: Configuring nginx =
NOTE: Follow these instructions to use nginx. To use Apache or lighttpd, scroll
to their sections.
For nginx, use a configuration like this: For nginx, use a configuration like this:
name=nginx.conf name=nginx.conf
@ -149,9 +89,6 @@ For nginx, use a configuration like this:
fastcgi_pass localhost:9000; fastcgi_pass localhost:9000;
fastcgi_index index.php; fastcgi_index index.php;
#custom environment variable
fastcgi_param PHABRICATOR_ENV "custom/myconfig";
#required if PHP was built with --enable-force-cgi-redirect #required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200; fastcgi_param REDIRECT_STATUS 200;
@ -171,8 +108,13 @@ For nginx, use a configuration like this:
} }
} }
Restart nginx after making your edits, then continue to "Setup" below.
= Webserver: Configuring lighttpd = = Webserver: Configuring lighttpd =
NOTE: Follow these instructions to use lighttpd. To use Apache or niginx, scroll
up to their sections.
For lighttpd, add a section like this to your lighttpd.conf: For lighttpd, add a section like this to your lighttpd.conf:
$HTTP["host"] =~ "phabricator(\.example\.com)?" { $HTTP["host"] =~ "phabricator(\.example\.com)?" {
@ -184,9 +126,6 @@ For lighttpd, add a section like this to your lighttpd.conf:
"^(/[^?]*)\?(.*)" => "/index.php?__path__=$1&$2", "^(/[^?]*)\?(.*)" => "/index.php?__path__=$1&$2",
"^(/.*)$" => "/index.php?__path__=$1", "^(/.*)$" => "/index.php?__path__=$1",
) )
setenv.add-environment = (
"PHABRICATOR_ENV" => "custom/myconfig",
)
} }
You should also ensure the following modules are listed in your You should also ensure the following modules are listed in your
@ -194,57 +133,44 @@ server.modules list:
mod_fastcgi mod_fastcgi
mod_rewrite mod_rewrite
mod_setenv
Finally, you should run the following commands to enable php support: Finally, you should run the following commands to enable php support:
$ sudo apt-get install php5-cgi # for ubuntu; other distros should be similar $ sudo apt-get install php5-cgi # for ubuntu; other distros should be similar
$ sudo lighty-enable-mod fastcgi-php $ sudo lighty-enable-mod fastcgi-php
Restart lighttpd after making your edits, then continue below.
= Setup = = Setup =
Now, restart your webserver and navigate to whichever subdomain you set up. You Now, navigate to whichever subdomain you set up. You should see instructions to
should either see the Phabricator setup screen, which is a simple text page that continue setup. The rest of this document contains additional instructions for
looks something like this: specific setup steps.
PHABRICATOR SETUP When you see the login screen, continue with @{article:Configuring Accounts and
Registration}.
This setup mode will guide you through setting up your Phabricator = Storage: Configuring MySQL =
configuration.
>>> REQUIRED PHP EXTENSIONS ------------------------------------------------ During setup, you'll need to configure MySQL. To do this, get MySQL running and
... verify you can connect to it. Consult the MySQL documentation for help. When
MySQL works, you need to load the Phabricator schemata into it. To do this, run:
If you see this, you're in good shape. Follow the instructions and correct any phabricator/ $ ./bin/storage upgrade
problems setup detects. If you don't see it but you do see a useful error
message, try to fix that. If neither of these cover you, something is wrong.
If you can't figure it out, come get help in IRC or on the mailing list (see
http://phabricator.org/ for links).
= Configuring Phabricator = If your configuration uses an unprivileged user to connect to the database, you
may have to override the default user so the schema changes can be applied with
root or some other admin user:
Now that basic setup is complete, you should configure Phabricator for your phabricator/ $ ./bin/storage upgrade --user <user> --password <password>
installation. Phabricator configuration options which control how the
applications behave are documented here:
/path/to/phabricator/conf/default.conf.php You can avoid the prompt the script issues by passing the ##--force## flag (for
example, if you are scripting the upgrade process).
There are several builtin configurations: phabricator/ $ ./bin/storage upgrade --force
- ##default.conf.php##: root configuration, lists every configuration option NOTE: When you update Phabricator, run `storage upgrade` again to apply any
and sets some default for it. Look in this file to figure out what you can new updates.
configure.
- ##development.conf.php##: pulls in ##default.conf.php##, but overrides some
configuration options to better values for doing development on Phabricator.
You probably don't need to even look at this file unless you're making
changes to Phabricator itself.
- ##production.conf.php##: pulls in ##default.conf.php##, but overrides some
configuration options to provide better values for a production install.
To actually configure your install, edit your ##custom/myconfig.conf.php## file
and override values from either the ##'production'## or ##'development'##
configurations. You should not edit the builtin configurations directly because
that will make upgrading Phabricator more difficult in the future.
= Next Steps = = Next Steps =
@ -252,6 +178,8 @@ Continue by:
- setting up your admin account and login/registration with - setting up your admin account and login/registration with
@{article:Configuring Accounts and Registration}; or @{article:Configuring Accounts and Registration}; or
- understanding advanced configuration topics with
@{article:Configuration User Guide: Advanced Configuration}; or
- configuring where uploaded files and attachments will be stored with - configuring where uploaded files and attachments will be stored with
@{article:Configuring File Storage}; or @{article:Configuring File Storage}; or
- configuring Phabricator so it can send mail with - configuring Phabricator so it can send mail with

View file

@ -0,0 +1,114 @@
@title Configuration User Guide: Advanced Configuration
@group userguide
Configuring Phabricator for multiple environments.
= Overview =
Phabricator reads configuration from multiple sources. This document explains
the configuration stack and how to set up advanced configuration sources, which
may be useful for deployments with multiple environments (e.g., development and
production).
This is a complicated topic for advanced users. You do not need to understand
this topic to install Phabricator.
= Configuration Sources =
Phabricator supports the following configuration sources, from highest priority
to lowest priority:
- **Database**: Values are stored in the database and edited from the web UI
by administrators. They have the highest priority and override other
settings.
- **Local**: Values are stored in `conf/local/config.json` and edited by
running `bin/config`.
- **Config Files**: Values are stored in a config file in `conf/`. The file
to use is selected by writing to `conf/local/ENVIRONMENT`, or setting the
PHABRICATOR_ENV configuration variable. See below for more information.
- **Defaults**: Defaults hard-coded in the Phabricator source, which can not
be edited. They have the lowest priority, and all other settings override
them.
Normally, you install and configure Phabricator by writing enough configuration
into the local config to get access to the database configuration (e.g., the
MySQL username, password, and hostname), then use the web interface to further
configure Phabricator.
= Configuration Files =
Configuration files provide an alternative to database configuration, and may be
appropriate if you want to deploy in multiple environments or create dynamic
configuration. Configuration files are more complicated than database
configuration, which is why they are not used by default.
== Creating a Configuration File ==
To create a configuration file, first choose a name for the config (like
"devserver" or "live"). For the purposes of this section, we'll assume you chose
`exampleconfig`. Replace "exampleconfig" with whatever you actually chose in the
examples below.
First, write an `exampleconfig.conf.php` file here (rename it according to the
name you chose):
phabricator/conf/custom/exampleconfig.conf.php
Its contents should look like this:
<?php
return array(
// Specify whichever keys and values you want to set.
'example.key' => 'examplevalue',
);
For example, to specify MySQL credentials in your config file, you might create
a config like this:
<?php
return array(
'mysql.host' => 'localhost',
'mysql.user' => 'root',
'mysql.pass' => 'hunter2trustno1',
);
== Selecting a Configuration File ==
To select a configuration file, write the name of the file (relative to
`phabricator/conf/`) to `phabricator/conf/local/ENVIRONMENT`. For example, to
select `phabricator/conf/custom/exampleconfig.conf.php`, you would write
"custom/exampleconfig" to `phabrictor/conf/local/ENVIRONMENT`:
phabricator/ $ echo custom/exampleconfig > conf/local/ENVIRONMENT
phabricator/ $ cat conf/local/ENVIRONMENT
custom/exampleconfig
phabricator/ $
You can also set the environmental variable `PHABRICATOR_ENV`. This is more
involved but may be easier in some deployment environments. Note that this needs
to be set in your webserver environment, and also in your shell whenever you
run a script:
# Shell
export PHABRICATOR_ENV=custom/exampleconfig
# Apache
SetEnv PHABRICATOR_ENV custom/exampleconfig
# nginx
fastcgi_param PHABRICATOR_ENV "custom/exampleconfig";
# lighttpd
setenv.add-environment = (
"PHABRICATOR_ENV" => "custom/exampleconfig",
)
After creating and selecting a configuration file, restart your webserver. Any
configuration you set should take effect immediately, and your file should be
visible in the Config application when examining configuration.
= Next Steps =
Return to the @{article:Configuration Guide}.

View file

@ -28,12 +28,6 @@ Phabricator implements realtime notifications using a Node.js server called
- Install node.js. - Install node.js.
- Run `bin/aphlict` (this script must be run as root). - Run `bin/aphlict` (this script must be run as root).
Since the script needs `PHABRICATOR_ENV` to be defined, you may need to use
the `-E` flag to `sudo` to preserve the environment if you have
`PHABRICATOR_ENV` defined in your `.bashrc` or similar:
phabricator/ $ sudo -E ./bin/aphlict
The server must be able to listen on port **843** and port **22280** for Aphlict The server must be able to listen on port **843** and port **22280** for Aphlict
to work. You can change the latter port in the `notification.client-uri` config, to work. You can change the latter port in the `notification.client-uri` config,
but port 843 is used by Flash and can not be changed. In particular, if you're but port 843 is used by Flash and can not be changed. In particular, if you're

View file

@ -1,86 +0,0 @@
<?php
final class PhabricatorSetup {
public static function runSetup() {
header("Content-Type: text/plain");
self::write("PHABRICATOR SETUP\n\n");
// Force browser to stop buffering.
self::write(str_repeat(' ', 2048));
usleep(250000);
self::write("This setup mode will guide you through setting up your ".
"Phabricator configuration.\n");
self::writeHeader("CORE CONFIGURATION");
if (!PhabricatorEnv::getEnvConfig('security.alternate-file-domain')) {
self::write(
"[WARN] You have not configured 'security.alternate-file-domain'. ".
"This makes your installation vulnerable to attack. Make sure you ".
"read the documentation for this parameter and understand the ".
"consequences of leaving it unconfigured.\n");
}
self::write("[OKAY] Core configuration OKAY.\n");
$root = dirname(phutil_get_library_root('phabricator'));
self::writeHeader("BASIC CONFIGURATION");
$env = PhabricatorEnv::getEnvConfig('phabricator.env');
if ($env == 'production' || $env == 'default' || $env == 'development') {
self::writeFailure();
self::write(
"Setup failure! Your PHABRICATOR_ENV is set to '{$env}', which is ".
"a Phabricator environmental default. You should create a custom ".
"environmental configuration instead of editing the defaults ".
"directly. See this document for instructions:\n");
self::writeDoc('article/Configuration_Guide.html');
return;
}
self::write("[OKAY] Basic configuration OKAY\n");
self::writeHeader('SUCCESS!');
self::write(
"Congratulations! Your setup seems mostly correct, or at least fairly ".
"reasonable.\n\n".
"*** NEXT STEP ***\n".
"Edit your configuration file (conf/{$env}.conf.php) and remove the ".
"'phabricator.setup' line to finish installation.");
}
private static function writeFailure() {
self::write("\n\n<<< *** FAILURE! *** >>>\n");
}
private static function write($str) {
echo $str;
ob_flush();
flush();
// This, uh, makes it look cool. -_-
usleep(20000);
}
public static function writeHeader($header) {
$template = '>>>'.str_repeat('-', 77);
$template = substr_replace(
$template,
' '.$header.' ',
3,
strlen($header) + 4);
self::write("\n\n{$template}\n\n");
}
public static function writeDoc($doc) {
self::write(
"\n".
' http://www.phabricator.com/docs/phabricator/'.$doc.
"\n\n");
}
}

View file

@ -58,35 +58,10 @@ final class PhabricatorEnv {
* @phutil-external-symbol class PhabricatorStartup * @phutil-external-symbol class PhabricatorStartup
*/ */
public static function initializeWebEnvironment() { public static function initializeWebEnvironment() {
$env = self::getSelectedEnvironmentName();
if (!$env) {
PhabricatorStartup::didFatal(
"The 'PHABRICATOR_ENV' environmental variable is not defined. Modify ".
"your httpd.conf to include 'SetEnv PHABRICATOR_ENV <env>', where ".
"'<env>' is one of 'development', 'production', or a custom ".
"environment.");
}
self::initializeCommonEnvironment(); self::initializeCommonEnvironment();
} }
public static function initializeScriptEnvironment() { public static function initializeScriptEnvironment() {
$env = self::getSelectedEnvironmentName();
if (!$env) {
echo phutil_console_wrap(
phutil_console_format(
"**ERROR**: PHABRICATOR_ENV Not Set\n\n".
"Define the __PHABRICATOR_ENV__ environment variable before ".
"running this script. You can do it on the command line like ".
"this:\n\n".
" $ PHABRICATOR_ENV=__custom/myconfig__ %s ...\n\n".
"Replace __custom/myconfig__ with the path to your configuration ".
"file. For more information, see the 'Configuration Guide' in the ".
"Phabricator documentation.\n\n",
$GLOBALS['argv'][0]));
exit(1);
}
self::initializeCommonEnvironment(); self::initializeCommonEnvironment();
// NOTE: This is dangerous in general, but we know we're in a script context // NOTE: This is dangerous in general, but we know we're in a script context
@ -139,14 +114,16 @@ final class PhabricatorEnv {
$stack = new PhabricatorConfigStackSource(); $stack = new PhabricatorConfigStackSource();
self::$sourceStack = $stack; self::$sourceStack = $stack;
$defaultSource = id(new PhabricatorConfigDefaultSource()) $default_source = id(new PhabricatorConfigDefaultSource())
->setName(pht('Global Default')); ->setName(pht('Global Default'));
$stack->pushSource($defaultSource); $stack->pushSource($default_source);
$env = self::getSelectedEnvironmentName(); $env = self::getSelectedEnvironmentName();
$stack->pushSource( if ($env) {
id(new PhabricatorConfigFileSource($env)) $stack->pushSource(
->setName(pht("File '%s'", $env))); id(new PhabricatorConfigFileSource($env))
->setName(pht("File '%s'", $env)));
}
$stack->pushSource( $stack->pushSource(
id(new PhabricatorConfigLocalSource()) id(new PhabricatorConfigLocalSource())
@ -162,7 +139,7 @@ final class PhabricatorEnv {
// If custom libraries specify config options, they won't get default // If custom libraries specify config options, they won't get default
// values as the Default source has already been loaded, so we get it to // values as the Default source has already been loaded, so we get it to
// pull in all options from non-phabricator libraries now they are loaded. // pull in all options from non-phabricator libraries now they are loaded.
$defaultSource->loadExternalOptions(); $default_source->loadExternalOptions();
try { try {
$stack->pushSource( $stack->pushSource(

View file

@ -28,16 +28,6 @@ try {
$sink = new AphrontPHPHTTPSink(); $sink = new AphrontPHPHTTPSink();
if (PhabricatorEnv::getEnvConfig('phabricator.setup')) {
try {
PhabricatorSetup::runSetup();
} catch (Exception $ex) {
echo "EXCEPTION!\n";
echo $ex;
}
return;
}
$response = PhabricatorSetupCheck::willProcessRequest(); $response = PhabricatorSetupCheck::willProcessRequest();
if ($response) { if ($response) {
$sink->writeResponse($response); $sink->writeResponse($response);