Installation with Docker

This is an installation guide for Cradle CMS with 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!

Docker swarm service

Installation using docker swarm and settings.conf with optional configuration. Configuration options: site, frontend and admin.

Note that this installation procedure pulls in the latest version 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 the storage files for it to work properly.

docker swarm init
docker secret create settings.v1 settings.conf
docker service create --name cradle-cms --user 1000 --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

Admin is reached at /admin with username admin and password admin password.

When you browse the server using the domain name, cradle-cms negotiates a SSL-certificate from letsencrypt. You can also get certificates from other ACME compatible providers by using -e ACME_DIRECTORY configuration option. Server configuration options

Single instance

We use --replicas 1 to only allow for one running instance. If you want more instances you’d need to run the frontend, admin, and site as separate services on separate servers.

Read more about Docker swarm Join nodes

Update service

To update the service you first need to pull the latest version from our registry.

docker pull registry.cradlecms.com/cradle-cms:latest

Then you restart the docker service.

docker service update cradle-cms --force

You can verify the update process and check the version number using docker logs cradle-cms.

Update service settings

To apply new service 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.

Then update the docker service using the new secret settings version.

docker secret create settings.v2 my_new_settings.conf
docker service update --secret-rm settings.v1 --secret-add source=settings.v2,target=settings cradle-cms

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.