|
| 1 | +# Basic Configuration |
| 2 | + |
| 3 | +For most basic setups, you can use environment variables to configure the Phabricator image to your liking. This works well with tools like `docker-compose`. |
| 4 | + |
| 5 | +A full list of all available environment variables can be found in the [Full Environment Variable List](ENV-LIST.md). |
| 6 | + |
| 7 | +# Configuring GIT user |
| 8 | + |
| 9 | +``` |
| 10 | +docker run ... \ |
| 11 | + --env GIT_USER="John Doe" \ |
| 12 | + --env GIT_EMAIL="jd@foo.com" \ |
| 13 | + --env GIT_EDITOR=/usr/bin/vim \ |
| 14 | + ... |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | +# Configuring MySQL |
| 19 | + |
| 20 | +You need to do this before running the container, or things won't work. If you have MySQL running in another container, you can use `MYSQL_HOST`, like so: |
| 21 | + |
| 22 | +``` |
| 23 | +docker run ... \ |
| 24 | + --env MYSQL_HOST=mysql \ |
| 25 | + --env MYSQL_USER=phabricator \ |
| 26 | + --env MYSQL_PASS=password \ |
| 27 | + --link somecontainer:mysql \ |
| 28 | + ... |
| 29 | +``` |
| 30 | + |
| 31 | +If your instance of MySQL is running on the host or some external system, you can connect to it using the `MYSQL_USER` and associated variables like so: |
| 32 | + |
| 33 | +``` |
| 34 | +docker run \ |
| 35 | + --env MYSQL_HOST=externalhost.com \ |
| 36 | + --env MYSQL_PORT=3306 \ |
| 37 | + --env MYSQL_USER=phabricator \ |
| 38 | + --env MYSQL_PASS=password \ |
| 39 | + ... |
| 40 | +``` |
| 41 | + |
| 42 | +The `MYSQL_PORT` environment variable is set to a sensible default, so normally you don't need to explicitly provide it. |
| 43 | + |
| 44 | +# Configuring Phabricator |
| 45 | + |
| 46 | +Phabricator needs some basic information about how clients will connect to it. You can provide the base URI for Phabricator with the `PHABRICATOR_HOST` environment variable, like so: |
| 47 | + |
| 48 | +``` |
| 49 | +docker run ... \ |
| 50 | + --env PHABRICATOR_HOST=myphabricator.com \ |
| 51 | + ... |
| 52 | +``` |
| 53 | + |
| 54 | +It's recommended that you specify an alternate domain to serve files and other user content from. This will make Phabricator more secure. You can configure this using the `PHABRICATOR_CDN` option, like so: |
| 55 | + |
| 56 | +``` |
| 57 | +docker run ... \ |
| 58 | + --env PHABRICATOR_CDN=altdomain.com \ |
| 59 | + ... |
| 60 | +``` |
| 61 | + |
| 62 | +When using the Let's Encrypt SSL configuration, it will automatically register both domains. |
| 63 | + |
| 64 | +You also need to configure a place to store repository data. This should be a volume mapped from the host, for example: |
| 65 | + |
| 66 | +``` |
| 67 | +docker run ... \ |
| 68 | + --env PHABRICATOR_REPOSITORY_PATH=/repos \ |
| 69 | + -v /path/on/host:/repos \ |
| 70 | + ... |
| 71 | +``` |
| 72 | + |
| 73 | +To provide SSH access to repositories, you need to set a path to store the SSH host keys in. If you are not baking a derived image (see [Advanced Configuration](ADVANCED-CONFIG.md)), then you need to map that path to a location on the host. If you are baking an image, you can omit the mapping and the SSH keys will form part of your derived image. You can configure SSH access to repositories like so: |
| 74 | + |
| 75 | +``` |
| 76 | +docker run ... \ |
| 77 | + --env PHABRICATOR_HOST_KEYS_PATH=/hostkeys/persisted \ |
| 78 | + -v /path/on/host:/hostkeys \ |
| 79 | + ... |
| 80 | +``` |
| 81 | + |
| 82 | +By default, Phabricator stores file data in MySQL. You can change this with the `PHABRICATOR_STORAGE_TYPE` option, which can be either `mysql` (the default), `disk` or `s3`. |
| 83 | + |
| 84 | +You can configure Phabricator to store files on disk by selecting the `disk` option, mapping a volume and configuring the path: |
| 85 | + |
| 86 | +``` |
| 87 | +docker run ... \ |
| 88 | + --env PHABRICATOR_STORAGE_TYPE=disk \ |
| 89 | + --env PHABRICATOR_STORAGE_PATH=/files \ |
| 90 | + -v /path/on/host:/files \ |
| 91 | + ... |
| 92 | +``` |
| 93 | + |
| 94 | +Alternatively if you want to store file data in S3, you can do so by selecting the `s3` option, configuring the bucket and setting the AWS access and secret keys to use: |
| 95 | + |
| 96 | +``` |
| 97 | +docker run ... \ |
| 98 | + --env PHABRICATOR_STORAGE_TYPE=s3 \ |
| 99 | + --env PHABRICATOR_STORAGE_BUCKET=mybucket \ |
| 100 | + --env AWS_S3_ACCESS_KEY=... \ |
| 101 | + --env AWS_S3_SECRET_KEY=... \ |
| 102 | + ... |
| 103 | +``` |
| 104 | + |
| 105 | +# Configuring SSL |
| 106 | + |
| 107 | +You can configure SSL in one of three ways: you can omit it entirely, you can turn on the automatic Let's Encrypt registration or you can provide SSL certificates. |
| 108 | + |
| 109 | +## No SSL |
| 110 | + |
| 111 | +This is the default. If you provide no SSL related options, this image doesn't serve anything on port 443 (HTTPS). |
| 112 | + |
| 113 | +## Load Balancer terminated SSL |
| 114 | + |
| 115 | +If your load balancer is terminating SSL, you should set `SSL_TYPE` to `external` so that Phabricator will render out all links as HTTPS. Without doing this (i.e. if you left the default of `none`), all of the Phabricator URLs would be prefixed with `http://` instead of `https://`. |
| 116 | + |
| 117 | +**NOTE:** If you use Load Balancer terminated SSL, things like real-time notifications are unlikely to work correctly. It's recommended that you let the Docker instance terminate the SSL connection, and use TCP forwarding in any load balancer configuration you might have set up. |
| 118 | + |
| 119 | +``` |
| 120 | +docker run ... \ |
| 121 | + --env SSL_TYPE=external \ |
| 122 | + ... |
| 123 | +``` |
| 124 | + |
| 125 | +## Automatic SSL via Let's Encrypt |
| 126 | + |
| 127 | +For this to work, you need to provide a volume mapped to `/config`, so that the image can store certificates across restarts. You also need to set `PHABRICATOR_HOST` and optionally `PHABRICATOR_CDN` as documented above. |
| 128 | + |
| 129 | +To enable automated SSL via Let's Encrypt, provide the following environment variables: |
| 130 | + |
| 131 | +``` |
| 132 | +docker run ... \ |
| 133 | + --env SSL_TYPE=letsencrypt \ |
| 134 | + --env SSL_EMAIL='youremail@domain.com' \ |
| 135 | + --env PHABRICATOR_HOST=myphabricator.com \ |
| 136 | + --env PHABRICATOR_CDN=altdomain.com \ |
| 137 | + -v /some/host/path:/config \ |
| 138 | + ... |
| 139 | +``` |
| 140 | + |
| 141 | +## Manual SSL |
| 142 | + |
| 143 | +If you want to provide your own certificates, map a volume containing your certificates and set the appropriate environment variables: |
| 144 | + |
| 145 | +``` |
| 146 | +docker run ... \ |
| 147 | + --env SSL_TYPE=manual \ |
| 148 | + --env SSL_CERTIFICATE=/ssl/cert.pem \ |
| 149 | + --env SSL_PRIVATE_KEY=/ssl/cert.key \ |
| 150 | + -v /host/folder/containing/certs:/ssl \ |
| 151 | + ... |
| 152 | +``` |
0 commit comments