Craft CMS Base Image
sealink/craft:0.1 is mapped to Craft CMS 2.6.x. You can expect it to contain
the latest Craft patch version of 2.6.
The only requirement is Docker.
docker build --rm . in a terminal
About the Craft configuration files in
config/craft, you can override
overrides/general.php in your project as per your project
rediscache.php should never be overridden
because they are fully controlled via the environment variables.
Support zero-downtime deployment
When upgrading Craft schema or plugins, i.e. data migration, the default Craft
behaviour requires us to press a button on the admin page. This base image
automates that so that upgrading Craft schema and plugins is done automatically
before starting the web server.
Parallel deployment is supported. When deploying a new version to multiple
instances at the same time, one of the instances will start the data migration;
all other instances will wait for the data migration to finish first before
continuing to prevent race conditions.
This logic is as follows.
- Obtain the Redis lock.
- Halt the deployment if the previous migration failed.
- Mark the migration failed first as a precaution against extreme cases, e.g.
complete network failure.
- Run the migration task.
- If the task failed, halt the deployment.
- Remove the failure marker from Redis.
- Release the lock.
- Start the webserver.
In case of migration failure, all the other deployment will not start because
Redis will have a key named as
migration-failed as the failure marker.
/container-scripts/synchronised-migration/clear-error can be used to remove
the failure marker after the issue is fixed manually.