Sign up (with export icon)

Docker Compose

Show the table of contents
Note

A valid license key is needed in order to install CKEditor AI On-Premises.
Contact us for a trial license key.

For evaluation and testing purposes, you can follow the Quickstart checklist, where we provide an easy-to-use way for setting up all necessary infrastructure for CKEditor AI On-Premises on your local machine.

Setting up the application using the Docker container

Copy link

Follow the steps below to install CKEditor AI On-Premises using the Docker container.

  1. Use the instructions from the Deployment guide to get a download token from the Customer Portal, log into the CKEditor AI On-Premises Docker Registry, and pull the Docker image.
  2. Containerize the application using docker or docker-compose.
  3. Create the Environment with an Access Key via the Management Panel – see Create an Environment and Access Key. Use this data to create the token endpoint.
  4. Run the smoke test to verify if the system works properly – see the Quickstart checklist.
  5. Configure CKEditor 5 to communicate with the CKEditor AI On-Premises application – see Configure CKEditor 5.

Containerize example using docker-compose

Copy link

Use the steps below to containerize the application using docker-compose.

Example with MySQL

Copy link
  1. Create the docker-compose.yml file:
    services:
      mysql-database:
    	image: mysql:8.4
    	environment:
    	  MYSQL_ROOT_PASSWORD: password
    	volumes:
    	  - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    	healthcheck: # Define healthcheck to be able to use the `service_healthy` condition.
    	  test: ["CMD-SHELL", "exit | mysql -h localhost -P 3306 -u root -p$$MYSQL_ROOT_PASSWORD"]
    	  interval: 10s
    	  timeout: 30s
    	  retries: 5
    
      redis:
    	image: redis:7.4
    
      ckeditor-ai:
    	image: docker.cke-cs.com/ai-service:[version]
    	depends_on:
    	  redis:
    		condition: service_started
    	  mysql-database:
    		condition: service_healthy # Make sure your database is ready for migration.
    	ports:
    	  - "8000:8000"
    	restart: always
    	init: true
    	environment:
    	  DATABASE_DRIVER: mysql
    	  DATABASE_HOST: mysql-database
    	  DATABASE_USER: root
    	  DATABASE_PASSWORD: password
    	  DATABASE_DATABASE: ai-service-on-premises
    	  REDIS_HOST: redis
    	  STORAGE_DRIVER: database
    	  PROVIDERS: '{"openai":{"type":"openai","apiKeys":["your-api-key"]}}'
    	  ENVIRONMENTS_MANAGEMENT_SECRET_KEY: secret
    	  LICENSE_KEY: your_license_key
    Copy code
  2. Create the init.sql file:
    CREATE DATABASE `ai-service-on-premises`
      DEFAULT CHARACTER SET utf8mb4
      DEFAULT COLLATE utf8mb4_bin;
    Copy code
  3. Run:
    docker-compose up
    Copy code

Example with PostgreSQL

Copy link
  1. Create the docker-compose.yml file:
    services:
      postgres-database:
    	image: postgres:17
    	environment:
    	  - POSTGRES_PASSWORD=password
    	volumes:
    	  - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    	healthcheck: # Define healthcheck to be able to use the `service_healthy` condition.
    	  test: pg_isready -U postgres
    	  interval: 10s
    	  timeout: 30s
    	  retries: 5
    
      redis:
    	image: redis:7.4
    
      ckeditor-ai-postgres:
    	image: docker.cke-cs.com/ai-service:[version]
    	depends_on:
    	  redis:
    		condition: service_started
    	  postgres-database:
    		condition: service_healthy # Make sure your database is ready for migration.
    	ports:
    	  - "8000:8000"
    	restart: always
    	init: true
    	environment:
    	  DATABASE_DRIVER: postgres
    	  DATABASE_HOST: postgres-database
    	  DATABASE_PORT: 5432
    	  DATABASE_USER: postgres
    	  DATABASE_PASSWORD: password
    	  DATABASE_DATABASE: cksource
    	  DATABASE_SCHEMA: ai-service-on-premises
    	  REDIS_HOST: redis
    	  STORAGE_DRIVER: database
    	  PROVIDERS: '{"openai":{"type":"openai","apiKeys":["your-api-key"]}}'
    	  ENVIRONMENTS_MANAGEMENT_SECRET_KEY: secret
    	  LICENSE_KEY: your_license_key
    Copy code
  2. Create the init.sql file:
    CREATE DATABASE "cksource";
    \connect "cksource";
    CREATE SCHEMA "ai-service-on-premises";
    Copy code
  3. Run:
    docker-compose up
    Copy code

Example with Collaboration Server

Copy link

CKEditor AI On-Premises can share the SQL database and Redis with Collaboration Server On-Premises 5.0.0 or newer. Both services then use the same environments. See Collaboration Server integration for details.

  1. Create the docker-compose.yml file:
services:
  mysql-database:
	image: mysql:8.4
	environment:
	  MYSQL_ROOT_PASSWORD: password
	volumes:
	  - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
	healthcheck: # Define healthcheck to be able to use the `service_healthy` condition.
	  test: ["CMD-SHELL", "exit | mysql -h localhost -P 3306 -u root -p$$MYSQL_ROOT_PASSWORD"]
	  interval: 10s
	  timeout: 30s
	  retries: 5

  redis:
	image: redis:7.4

  ckeditor-cs:
	image: docker.cke-cs.com/cs:[version]
	depends_on:
	  redis:
		condition: service_started
	  mysql-database:
		condition: service_healthy # Make sure your database is ready for migration.
	ports:
	  - "8000:8000"
	restart: always
	init: true
	environment:
	  DATABASE_DRIVER: mysql
	  DATABASE_HOST: mysql-database
	  DATABASE_USER: root
	  DATABASE_PASSWORD: password
	  DATABASE_DATABASE: cs-on-premises
	  REDIS_HOST: redis
	  AI_API_BASE_URL: http://ckeditor-ai:8000 # The address Collaboration Server, including its Management Panel, uses to reach CKEditor AI.
	  ENVIRONMENTS_MANAGEMENT_SECRET_KEY: secret
	  LICENSE_KEY: your_collaboration_server_license_key

  ckeditor-ai:
	image: docker.cke-cs.com/ai-service:[version]
	depends_on:
	  ckeditor-cs:
		condition: service_started
	ports:
	  - "8001:8000"
	restart: always
	init: true
	environment:
	  DATABASE_DRIVER: mysql
	  DATABASE_HOST: mysql-database
	  DATABASE_USER: root
	  DATABASE_PASSWORD: password
	  DATABASE_DATABASE: cs-on-premises
	  REDIS_HOST: redis
	  STORAGE_DRIVER: database
	  PROVIDERS: '{"openai":{"type":"openai","apiKeys":["your-api-key"]}}'
	  ENVIRONMENTS_MANAGEMENT_SECRET_KEY: secret
	  LICENSE_KEY: your_ckeditor_ai_license_key
Copy code
Note

The version of cs and ai-service images should be the same.
You should also connect the services to the same Redis and SQL databases.

  1. Create the init.sql file:

    CREATE DATABASE `cs-on-premises`
      DEFAULT CHARACTER SET utf8mb4
      DEFAULT COLLATE utf8mb4_bin;
    Copy code
  2. Run:

    docker-compose up
    Copy code

Notes

Copy link
  • Use environment variables to configure the application. See the Required configuration guide.
  • You should override the ENVIRONMENTS_MANAGEMENT_SECRET_KEY variable using a unique and hard to guess string due to security reasons.
  • The application will not start without a correct LICENSE_KEY.
  • The application will not start without at least one LLM provider in PROVIDERS – see LLM providers.
  • In the example with Collaboration Server, CKEditor AI On-Premises is served on port 8001. Set ai.serviceUrl in the CKEditor 5 configuration to http://localhost:8001/v1.

Containerize example using Docker

Copy link

Launch the Docker container:

docker run --init -p 8000:8000 -e DATABASE_HOST=[your_mysql_host] -e DATABASE_USER=[your_mysql_user] -e DATABASE_PASSWORD=[your_mysql_password] -e DATABASE_DATABASE=[your_database_name] -e REDIS_HOST=[your_redis_host] -e STORAGE_DRIVER=database -e PROVIDERS='{"openai":{"type":"openai","apiKeys":["your-api-key"]}}' -e ENVIRONMENTS_MANAGEMENT_SECRET_KEY=[your_management_secret] -e LICENSE_KEY=[your_license_key] docker.cke-cs.com/ai-service:[version]
Copy code

Notes:

  • Use environment variables to configure the application. See the Required configuration guide, or generate the command with the Setup wizard. Examples:
    • If an SQL database and Redis are hosted on 192.168.118.27, you should pass the address through the DATABASE_HOST and REDIS_HOST variables:
      docker run --init -p 8000:8000 -e DATABASE_HOST=192.168.118.27 -e REDIS_HOST=192.168.118.27 -e DATABASE_USER=root -e DATABASE_PASSWORD=root_password -e DATABASE_DATABASE=ai-service-on-premises -e STORAGE_DRIVER=database -e PROVIDERS='{"openai":{"type":"openai","apiKeys":["your-api-key"]}}' -e ENVIRONMENTS_MANAGEMENT_SECRET_KEY=[your_management_secret] -e LICENSE_KEY=[your_license_key] docker.cke-cs.com/ai-service:[version]
      Copy code
    • If you want to change the port on which the application will be served to 5000, change the exposed ports:
      docker run --init -p 5000:8000 -e DATABASE_HOST=192.168.118.27 -e REDIS_HOST=192.168.118.27 -e DATABASE_USER=root -e DATABASE_PASSWORD=root_password -e DATABASE_DATABASE=ai-service-on-premises -e STORAGE_DRIVER=database -e PROVIDERS='{"openai":{"type":"openai","apiKeys":["your-api-key"]}}' -e ENVIRONMENTS_MANAGEMENT_SECRET_KEY=[your_management_secret] -e LICENSE_KEY=[your_license_key] docker.cke-cs.com/ai-service:[version]
      Copy code
  • You should override the ENVIRONMENTS_MANAGEMENT_SECRET_KEY variable using a unique and hard to guess string due to security reasons.
  • The application will not start without a correct LICENSE_KEY.