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.