WARNING: Work in progress (hence the dev branch).
This is NOT ready for prime time yet.
A container based on dansdans/docker-confd with php-fpm.
This container provides an etcd-aware PHP-FPM 5.6 server.
I'm not actually a big personal fan of PHP itself, this image is more of a means to an end - specifically, being able to build a phabricator image on top of it. And I'll probably end up doing a Wordpress one as well, I guess. Apparently that's where all the cool kids hang out these days. ;)
- Create a unit in CoreOS that uses the docker image.
- Pass ETCD_SRV_RECORD, ETCD_SRV_DOMAIN, or ETCD_NODE as an env variable.
- Pass ETCD_PREFIX pointing to the branch in your etcd tree where this container is to be configured.
- Inside the ETCD_PREFIX branch, configure the desired etcd key-value pairs (see below for more information).
- Optionally, set SRCREPO to the git repo to deploy the website from, and SRCREF to the branch or tag to deploy from. If these are not set, the values will be retrieved from etcd.
Etcd configuration values
At this point in time, minimal configuration is passed through etcd, however ideally this will change over time.
The etcd key-value pairs are under the ETCD_PREFIX (the container environment variable).
The structure of the key-value pairs is as follows:
/<prefix> /srcrepo=<URI of git repository> /branch=<branch or tag name>
- If the SRCREPO environment variable is set, the etcd value will be ignored.
- If the SRCREF environment variable is set, the etcd value will be ignored.
- The git repository needs to be set up in the correct way. See the section below on source repository.
- Private repos aren't supported right now.
- Persistent data isn't supported (file uploads, etc)
The git source repository needs to be laid out in a specific way, to enable the deployment functionality.
The following directories must exist:
- /bin - Directory containing some scripts used as part of the deployment.
- /webroot - The base directory of static and PHP files.
The following scripts must exist and execute:
- /bin/deploy - executed when we first deploy.
- /bin/upgrade - executed when we deploy a new ref. Called with the previous and new commit ID as arguments.
Improvements to be made
This area is to some extent a dumping ground for my own ideas on improving this image.
- Add support for relevant php config values in etcd.
- Add support for github/gitlab private repos (via an API token value, probably)
- Add polling and/or git hooks to watch for repository updates, for auto-deploy purposes (automatically deploy updates).
- Add a way to handle persistent data (file uploads, etc)
- Logging to central location (see dansdans/docker-confd)
- Alerts and instrumentation to central location (see dansdans/docker-confd)