Docker Compose
To provide stability and scalability, we recommend using container orchestration in production.
Check the Kubernetes with Helm example to learn how to run CKEditor AI On-Premises in a cluster.
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.
Follow the steps below to install CKEditor AI On-Premises using the Docker container.
- 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.
- Containerize the application using
dockerordocker-compose. - Create the
Environmentwith anAccess Keyvia the Management Panel – see Create an Environment and Access Key. Use this data to create the token endpoint. - Run the smoke test to verify if the system works properly – see the Quickstart checklist.
- Configure CKEditor 5 to communicate with the CKEditor AI On-Premises application – see Configure CKEditor 5.
Use the steps below to containerize the application using docker-compose.
Please bear in mind that docker-compose is useful for development purposes. This, however, does not fulfill our architecture recommendations for production environments.
- Create the
docker-compose.ymlfile:
Copy codeservices: 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 - Create the
init.sqlfile:
Copy codeCREATE DATABASE `ai-service-on-premises` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin; - Run:
Copy codedocker-compose up
- Create the
docker-compose.ymlfile:
Copy codeservices: 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 - Create the
init.sqlfile:
Copy codeCREATE DATABASE "cksource"; \connect "cksource"; CREATE SCHEMA "ai-service-on-premises"; - Run:
Copy codedocker-compose up
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.
- Create the
docker-compose.ymlfile:
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_keyCopy codeThe version of cs and ai-service images should be the same.
You should also connect the services to the same Redis and SQL databases.
-
Create the
init.sqlfile:
Copy codeCREATE DATABASE `cs-on-premises` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin; -
Run:
Copy codedocker-compose up
- Use environment variables to configure the application. See the Required configuration guide.
- You should override the
ENVIRONMENTS_MANAGEMENT_SECRET_KEYvariable 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. Setai.serviceUrlin the CKEditor 5 configuration tohttp://localhost:8001/v1.
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 codeNotes:
- 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 theDATABASE_HOSTandREDIS_HOSTvariables:
Copy codedocker 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] - If you want to change the port on which the application will be served to
5000, change the exposed ports:
Copy codedocker 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]
- If an SQL database and Redis are hosted on
- You should override the
ENVIRONMENTS_MANAGEMENT_SECRET_KEYvariable using a unique and hard to guess string due to security reasons. - The application will not start without a correct
LICENSE_KEY.