Initialize Phabricator at first container run
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:
- Build a new image
- Run a container, passing sensible environment variables with the P123 script
- Ensure docker logs output looks good
- Ensure .initialized exists and settings are applied
Reviewers: Kaliiixx
Projects: Nasqueron Docker deployment squad
Differential Revision: http://devcentral.nasqueron.org/D39