Page MenuHomeDevCentral

Initialize Phabricator at first container run
ClosedPublic

Authored by dereckson on Nov 8 2015, 23:55.
Referenced Files
Unknown Object (File)
Thu, Dec 12, 22:37
Unknown Object (File)
Thu, Dec 12, 19:14
Unknown Object (File)
Wed, Dec 11, 03:12
Unknown Object (File)
Tue, Dec 10, 10:14
Unknown Object (File)
Sun, Dec 8, 11:50
Unknown Object (File)
Sat, Dec 7, 15:05
Unknown Object (File)
Tue, Dec 3, 09:02
Unknown Object (File)
Tue, Dec 3, 09:02
Subscribers
None

Details

Summary

When we start the container for the first time, a series of tasks
are run to setup the environment. It allows to configure the part
not stored at database level, and the part required to get a working
setup.

We introduce some environment variables to pass to docker run to
specify the configuration:

  • PHABRICATOR_URL: the base URL
  • PHABRICATOR_DOMAIN: the same, without http:// or https://
  • PHABRICATOR_ALT_FILE_DOMAIN: the domain to serve static files (facultative)
  • PHABRICATOR_STORAGE_NAMESPACE: the storage namespace, when not 'phabricator' (facultative)
  • PHABRICATOR_USE_MAILGUN: if set, use mailgun as mail provider and set domain

We also rely on the environment of the container linked as 'mysql':

  • MYSQL_ROOT_PASSWORD: the root password of the MySQL server

These tasks are stored in /usr/local/bin/setup-phabricator. After
successful run, it creates a .initialized file. A service is added
to only call setup-phabricator if this file doesn't exist.

We use a bash script instead of a pure sh one to use pushd and popd.
See http://stackoverflow.com/a/5193087/1930997.

Test Plan
  1. Build a new image
  2. Run a container, passing sensible environment variables with the P123 script
  3. Ensure docker logs output looks good
  4. Ensure .initialized exists and settings are applied

Diff Detail

Repository
rDPHAB Docker image for Phabricator
Lint
No Lint Coverage
Unit
No Test Coverage
Branch
initialize
Build Status
Buildable 26
Build 26: arc lint + arc unit

Event Timeline

dereckson retitled this revision from to Initialize Phabricator at first container run.
dereckson updated this object.
dereckson edited the test plan for this revision. (Show Details)
dereckson added a reviewer: Sandlayth.

Some whitespace issues.

files/usr/local/bin/setup-phabricator
1

Add a whitespace line between the shebang and the actual code

8

4 spaces or a tab expected, not two spaces

files/usr/local/sbin/init-container
5

Whitespace issue?

Should be a tab or 4 spaces everywhere, not both.

dereckson marked 2 inline comments as done.

Fixed whitespace issues

dereckson marked an inline comment as done.EditedNov 9 2015, 00:06

Other done too.

Tabs are used for bash/sh scripts.

Sandlayth edited edge metadata.
This revision is now accepted and ready to land.Nov 10 2015, 09:22
This revision was automatically updated to reflect the committed changes.