This is an installation guide for Cradle CMS and eCommerce using Docker Swarm.
Server requirements: Linux server (ARM or AMD 64-bit): 1 CPU, 512MB RAM, 3GB storage (storage can be a mix of local/shared disk or on S3 compatible storage).
Our guide on installing the service locally uses regular docker.
Login with Docker
The docker username is the licence key which you find under Licences on your account page. Password is your customer account password.
docker login registry.cradlecms.com
Username: <your licence key>
Password: <your password>
Login Succeeded!
On
windowsyou might have to useregistry.cradlecms.com:5000
Docker swarm service
Installation using docker swarm and settings.conf containing configuration overrides. Configuration options: site, frontend and admin.
Note that this installation procedure pulls in the
latestversion and that we pass in--user 1000(optional) to make the service run as a low privileged system user, but you need to create that unix user and give it permission to access thestoragefiles for it to work properly. On debian based distros like ubuntu you can use--user 33as that already exists for thewww-datauser.
docker swarm init
docker secret create settings.v1 settings.conf
CMS
docker service create --name cradle-cms --mount type=bind,source=/storage,destination=/storage --secret-add source=settings.v1,target=settings --publish published=443,target=4040,mode=host -p 80:8080 --replicas 1 registry.cradlecms.com/cradle-cms
eCommerce
docker service create --name cradle-ecommerce --mount type=bind,source=/storage,destination=/storage --secret-add source=settings.v1,target=settings --publish published=443,target=4040,mode=host -p 80:8080 --replicas 1 registry.cradlecms.com/cradle-ecommerce
We don’t specify a
:tagto pull from which means you get the:latestrelease. Ontestreleases you need to include the:testtagregistry.cradlecms.com/cradle-ecommerce:test.
When started the admin interface can be reached at /admin on the published port. You login with username admin and password admin password.
When you access the server using https and a domain name, the server negotiates a SSL-certificate from letsencrypt. You can get certificates from other ACME compatible providers using the
-e ACME_DIRECTORYconfiguration option. Server configuration options
Single server instance
Use --replicas 1 to restrict to one running instance on single server setups. If you want to use multiple instances you’d need to run the frontend, admin, and site (also shop, order for eCommerce) on separate servers/instances. In that scenario you also should use postgres or cockroachDB for the backend and have a dedicated nats server or cluster.
Read more about Docker swarm Join nodes
Update service
To update the service you first need to pull the latest version from our registry.
CMS
docker pull registry.cradlecms.com/cradle-cms:latest
eCommerce
docker pull registry.cradlecms.com/cradle-ecommercelatest
You may also want to pull a specific software version i.e use :0.14 to pull the latest 0.14.x release.
We don’t support backward migrations so you should only install later versions or use backups and restore to an earlier version.
Then you restart the docker service.
CMS
docker service update cradle-cms --force
eCommerce
docker service update cradle-ecommerce --force
You can verify the update process and check the version number using
docker logs cradle-cmsordocker logs cradle-ecommerce.
Update service configuration
To apply new settings you can save your settings into a file and add that to docker secrets. The settings file must be in toml format as shown in our documentation and you only need to include settings you want to override.
As an example, to configure a log server (victoralogs) setting.
[site.log]
server = "http://internal.victorialogs.server:9428"
Save that snippet into a my_new_settings.conf file.
Then update the docker service with a new settings version.
Remember to include all your previous settings.
docker secret create settings.v2 my_new_settings.conf
And restart the instance using service update
CMS
docker service update --secret-rm settings.v1 --secret-add source=settings.v2,target=settings cradle-cms
eCommerce
docker service update --secret-rm settings.v1 --secret-add source=settings.v2,target=settings cradle-ecommerce
Logs
The system log is written to standard out in json format so you can use tools such as jq to filter log messages. To see the log output you need to use docker logs as shown in the example.
docker logs -f <container id>
You can also subscribe to a log event stream using the nats client.
nats subscribe "logs.>"
[#6] Received on "logs.frontend"
{"time":"2024-09-28T08:54:26.176Z","level":"INFO","service":"frontend","msg":"render","host":"localhost:5000","site":"17427f63-e498-4654-bcaa-a6f24afabeef","path":"/","type":"index","handle":"","lang":"en"}
Use the log stream if you want to store the log on another server or monitor it in real time.
You can configure the system to forward logs to a log server such as VictoriaLogs or QuestDB.