Castle CMS on Docker
CastleCMS is an enhanced distribution of Plone,
the open source web CMS that was created in 2001 and that has an unparalleled security track record.
$ docker run -d -p 6379:6379 redis
$ docker run -d -p 9200:9200 elasticsearch:2.3.5
Dockerfile
links for CastleCMSMake sure you have Docker installed and running for your platform. You can download Docker from https://hub.docker.com.
Choose either single Castle instance or ZEO cluster.
It is inadvisable to use following configurations for production.
Castle standalone instances are best suited for testing Castle and development.
Download and start the latest Castle 5 container, based on Debian.
$ docker run -p 8080:8080 castlecms
This image includes EXPOSE 8080
(the Castle port), so standard container linking will make it automatically available to the linked containers. Now you can add a Castle Site at http://localhost:8080 - default Zope user and password are admin/admin
.
ZEO cluster are best suited for production setups, you will need a loadbalancer.
Start ZEO server in the background
$ docker run -d --name=zeo castlecms zeo
Start 2 Castle clients (also in the background)
$ docker run -d --name=instance1 --link=zeo -e ZEO_ADDRESS=zeo:8080 -p 8081:8080 castlecms
$ docker run -d --name=instance2 --link=zeo -e ZEO_ADDRESS=zeo:8080 -p 8082:8080 castlecms
You can also start Castle in debug mode (fg
) by running
$ docker run -p 8080:8080 castlecms fg
Debug mode may also be used with ZEO
$ docker run --link=zeo -e ZEO_ADDRESS=zeo:8080 -p 8080:8080 castlecms fg
The Castle image uses several environment variable that allow to specify a more specific setup.
ADDONS
- Customize Castle via Castle add-ons using this environment variableZEO_ADDRESS
- This environment variable allows you to run Castle image as a ZEO client.SITE
- Add Castle with this id to Data.fs
on first run. If NOT provided, you’ll have to manually add a Castle Site via web UIVERSIONS
- Use specific versions of Castle Add-on or python librariesRun Castle and install two addons (eea.facetednavigation and collective.easyform)
$ docker run -p 8080:8080 -e SITE="mysite" -e ADDONS="eea.facetednavigation collective.easyform" castlecms
To use specific add-ons versions:
-e ADDONS="eea.facetednavigation collective.easyform" -e VERSIONS="eea.facetednavigation=13.3 collective.easyform=2.1.0"
RestAPI:
$ docker run -p 8080:8080 -e SITE=castle castlecms
$ curl -H 'Accept: application/json' http://localhost:8080/castle
Castle:
PLONE_ADDONS
, ADDONS
- Customize Castle via Castle add-ons using this environment variablePLONE_SITE
, SITE
- Add Castle with this id to Data.fs
on first run. If NOT provided, you’ll have to manually add a Castle Site via web UIPLONE_VERSIONS
, VERSIONS
- Use specific versions of Castle Add-on or python librariesPLONE_PROFILES, PROFILES
- GenericSetup profiles to include when SITE
environment provided.PLONE_ZCML
, ZCML
- Include custom Castle add-ons ZCML filesPLONE_DEVELOP
, DEVELOP
- Develop new or existing Castle add-onsZEO:
ZEO_ADDRESS
- This environment variable allows you to run Castle image as a ZEO client.ZEO_READ_ONLY
- Run Castle as a read-only ZEO client. Defaults to off
.ZEO_CLIENT_READ_ONLY_FALLBACK
- A flag indicating whether a read-only remote storage should be acceptable as a fallback when no writable storages are available. Defaults to false
.ZEO_SHARED_BLOB_DIR
- Set this to on if the ZEO server and the instance have access to the same directory. Defaults to off
.ZEO_STORAGE
- Set the storage number of the ZEO storage. Defaults to 1
.ZEO_CLIENT_CACHE_SIZE
- Set the size of the ZEO client cache. Defaults to 128MB
.ZEO_PACK_KEEP_OLD
- Can be set to false to disable the creation of *.fs.old files before the pack is run. Defaults to true.CORS:
CORS_ALLOW_ORIGIN
- Origins that are allowed access to the resource. Either a comma separated list of origins, e.g. http://example.net,http://mydomain.com
or *
. Defaults to http://localhost:3000,http://127.0.0.1:3000
CORS_ALLOW_METHODS
- A comma separated list of HTTP method names that are allowed by this CORS policy, e.g. DELETE,GET,OPTIONS,PATCH,POST,PUT
. Defaults to DELETE,GET,OPTIONS,PATCH,POST,PUT
CORS_ALLOW_CREDENTIALS
- Indicates whether the resource supports user credentials in the request. Defaults to true
CORS_EXPOSE_HEADERS
- A comma separated list of response headers clients can access, e.g. Content-Length,X-My-Header
. Defaults to Content-Length,X-My-Header
CORS_ALLOW_HEADERS
- A comma separated list of request headers allowed to be sent by the client, e.g. X-My-Header
. Defaults to Accept,Authorization,Content-Type,X-Custom-Header
CORS_MAX_AGE
- Indicates how long the results of a preflight request can be cached. Defaults to 3600
New images can be generated by running the following command:
./generate-template.sh 2.5 0 6
Using the root files as templates for each version of Castle CMS,
the command above will generate several subfolders representing version 2.5.0 to 2.5.6.
The structure of the command is as the following:
# ./generate-template.sh <major>.<minor> <start-patch-range> <end-patch-range>
Once generated, you can modify each Docker version.
Each docker image can be tested by running the following command:
./test-template.sh
If you are having issues, please let us know at https://community.plone.org
The project is licensed under the GPLv2.