### Get All Deployer Deployments Sample Source: https://craftercms.com/docs/current/_static/api/deployer.html Example response for retrieving all deployments for a target. This shows the structure of deployment objects, including target details and change sets. ```json [ { "mode": "PUBLISH", "status": null, "running": false, "duration": null, "start": null, "end": null, "target": { "env": "preview", "site_name": "ed", "load_date": "2025-03-10T11:44:03.613404-04:00", "status": "INIT_COMPLETED", "id": "ed-preview" }, "changeSet": { "created_files": [ ], "updated_files": [ ], "deleted_files": [ ] }, "processorExecutions": [ ] }, { "mode": "PUBLISH", "status": null, "running": false, "duration": null, "start": null, "end": null, "target": { "env": "preview", "site_name": "ed", "load_date": "2025-03-10T11:44:03.613404-04:00", "status": "INIT_COMPLETED", "id": "ed-preview" }, "changeSet": { "created_files": [ ], "updated_files": [ ], "deleted_files": [ ] }, "processorExecutions": [ ] } ] ``` -------------------------------- ### Start CrafterCMS Authoring Environment Source: https://craftercms.com/docs/current/reference/index.html Navigate to the bin directory of your CrafterCMS authoring installation and execute this script to start the authoring environment services. ```bash cd crafter-authoring/bin ./startup.sh ``` -------------------------------- ### Get All Crafter Deployer Targets Source: https://craftercms.com/docs/current/_static/api/deployer.html Example response for retrieving a list of all configured deployment targets (200 OK). ```json [ { "load_date": "2023-03-30T13:24:36.042181-04:00", "env": "preview", "siteName": "hi", "status": "INIT_COMPLETED", "id": "hi-preview" }, { "load_date": "2023-03-31T09:48:48.214383-04:00", "env": "preview", "siteName": "third", "status": "INIT_COMPLETED", "id": "third-preview" } ] ``` -------------------------------- ### Response Sample for Rebuild All Site Contexts Source: https://craftercms.com/docs/current/_static/api/engine.html Example JSON response indicating the start of a rebuild for all site contexts. ```json { "message": "Started rebuild of all site contexts" } ``` -------------------------------- ### Run CrafterCMS Start Upgrade Script Source: https://craftercms.com/docs/current/by-role/system-admin/upgrade/upgrading-server.html Execute the start-upgrade script to download and prepare the new version's bundle for installation. This script initiates the download and extraction process. ```bash #!/bin/bash ./start-upgrade.sh -v 4.1.1 ``` -------------------------------- ### Setup Auto-wiring for Preview App Plugin Source: https://craftercms.com/docs/current/by-role/developer/composable/extensions/plugins.html Configure a plugin for auto-wiring in Studio's preview app section. This example shows how to add a React component plugin to the ToolsPanel. ```yaml 1installation: 2 - type: preview-app 3 parentXpath: //widget[@id='craftercms.components.ToolsPanel'] 4 elementXpath: //plugin[@id='org.craftercms.sampleComponentLibraryPlugin.components.reactComponent'] 5 element: 6 name: configuration 7 children: 8 - name: widgets 9 children: 10 - name: widget 11 attributes: 12 - name: id 13 value: org.craftercms.sampleComponentLibraryPlugin.components.reactComponent 14 children: 15 - name: plugin 16 attributes: 17 - name: id 18 value: org.craftercms.plugin.sidebar 19 - name: type 20 value: sidebar 21 - name: name 22 value: react-sample 23 - name: file 24 value: index.modern.js ``` -------------------------------- ### Start Docker Compose Environment Source: https://craftercms.com/docs/current/by-role/system-admin/upgrade/upgrading-container.html Run this command to start all services after completing the upgrade steps. ```bash docker-compose up ``` -------------------------------- ### Studio Configuration Override Example Source: https://craftercms.com/docs/current/by-role/system-admin/security/configure-studio-saml-4-0-2-and-earlier.html An example of how to override studio configuration settings, including SAML-related properties, in the `studio-config-override.yaml` file. ```yaml _CRAFTER_HOME/bin/apache-tomcat/shared/classes/crafter/studio/extension/studio-config-override.yaml_ ``` -------------------------------- ### Start React Application Source: https://craftercms.com/docs/current/reference/modules/engine.html Start the React application development server. This will typically open the app in a browser at http://localhost:3000. ```bash ➜ app git:(master) yarn start VITE v4.5.0 ready in 242 ms ➜ Local: http://localhost:3000/ ➜ Network: http://192.168.1.8:3000/ ➜ press h to show help ``` -------------------------------- ### Install Grapes from Command Line Source: https://craftercms.com/docs/current/reference/modules/deployer.html Install new grapes from the command line by navigating to `CRAFTER_HOME/bin` and using the `grape install` command with the group ID, artifact ID, and version. ```bash ./groovy/bin/grape -Dgrape.root=. install ``` ```bash ./groovy/bin/grape -Dgrape.root=. install com.vdurmont semver4j 3.1.0 ``` -------------------------------- ### Start Next.js Development Server Source: https://craftercms.com/docs/current/reference/modules/engine.html Start the Next.js development server to run the application on localhost:3000. ```bash yarn dev ▲ Next.js 14.0.1 - Local: http://localhost:3000 - Environments: .env.local ✓ Ready in 9.6s ``` -------------------------------- ### Example Response for Get Children Request Source: https://craftercms.com/docs/current/getting-started/your-first-project/headless.html This is an example of the JSON response you will receive when using the Get Children API to retrieve product information. It includes details like name, URL, and content type. ```json [ { "name": "0f08bd09-622d-816f-4f81-f3975947d9af.xml", "url": "/site/items/products/0f08bd09-622d-816f-4f81-f3975947d9af.xml", "descriptorUrl": "/site/items/products/0f08bd09-622d-816f-4f81-f3975947d9af.xml", "descriptorDom": { "component": { "content-type": "/component/product", "display-template": null, "merge-strategy": "inherit-levels", "objectGroupId": "0f08", "objectId": "0f08bd09-622d-816f-4f81-f3975947d9af", "file-name": "0f08bd09-622d-816f-4f81-f3975947d9af.xml", "internal-name": "Cards", "name_s": "Cards", "price_d": "10.5", "categories_o": { "item": { "key": "board", "value_smv": "Board" } }, "tags_o": { "item": { "key": "groups", "value_smv": "Groups" } }, "image_s": "/static-assets/images/products/cards.jpeg", "company_o": { "item": { "key": "/site/items/companies/9ea03b5c-e199-5e07-aa60-1997dcefbd4c.xml", "value": "Company 2", "include": "/site/items/companies/9ea03b5c-e199-5e07-aa60-1997dcefbd4c.xml", "disableFlattening": "false" } }, "description_html": "

Classic Cards

", "createdDate": "2017-05-12T16:47:33.000Z", "createdDate_dt": "2017-05-12T16:47:33.000Z", "lastModifiedDate": "2017-05-15T17:19:26.000Z", "lastModifiedDate_dt": "2017-05-15T17:19:26.000Z", "disabled": "false" } }, "properties": null, "folder": false }, { "name": "11cc0cd3-55e4-ae2e-6f2d-a349486c0b84.xml", "url": "/site/items/products/11cc0cd3-55e4-ae2e-6f2d-a349486c0b84.xml", "descriptorUrl": "/site/items/products/11cc0cd3-55e4-ae2e-6f2d-a349486c0b84.xml", "descriptorDom": { "component": { "content-type": "/component/product", "display-template": null, "merge-strategy": "inherit-levels", "objectGroupId": "11cc", "objectId": "11cc0cd3-55e4-ae2e-6f2d-a349486c0b84", "file-name": "11cc0cd3-55e4-ae2e-6f2d-a349486c0b84.xml", "internal-name": "Plane", "name_s": "Plane", "price_d": "5.5", "image_s": "/static-assets/images/products/toy-plane.jpeg", "categories_o": { "item": { "key": "cars", "value_smv": "Cars" } }, "tags": null, "company_o": { "item": { "key": "/site/items/companies/8b868a29-3b70-a461-efa1-7b4555bdc60c.xml", "value": "Company 1", "include": "/site/items/companies/8b868a29-3b70-a461-efa1-7b4555bdc60c.xml", "disableFlattening": "false" } }, "description_html": "

Small toy plane

", "createdDate": "2017-05-11T20:6:23.000Z", "createdDate_dt": "2017-05-11T20:6:23.000Z", "lastModifiedDate": "2017-05-12T16:27:53.000Z", "lastModifiedDate_dt": "2017-05-12T16:27:53.000Z" } }, "properties": null, "folder": false }, { "name": "167f4a61-a9a2-54ec-a87d-6195634c65dd.xml", "url": "/site/items/products/167f4a61-a9a2-54ec-a87d-6195634c65dd.xml", "descriptorUrl": "/site/items/products/167f4a61-a9a2-54ec-a87d-6195634c65dd.xml", "descriptorDom": { "component": { "content-type": "/component/product", "display-template": null, "merge-strategy": "inherit-levels", "objectGroupId": "167f", "objectId": "167f4a61-a9a2-54ec-a87d-6195634c65dd", "file-name": "167f4a61-a9a2-54ec-a87d-6195634c65dd.xml", "internal-name": "Rubik's", "name_s": "Rubik's", "price_d": "15", "categories_o": { "item": { "key": "board", "value_smv": "Board" } }, "tags_o": { "item": { "key": "learning", "value_smv": "Learning" } }, "image_s": "/static-assets/images/products/cube.jpg", "company_o": { "item": { "key": "/site/items/companies/9ea03b5c-e199-5e07-aa60-1997dcefbd4c.xml", "value": "Company 2", ``` -------------------------------- ### init-site.sh Examples Source: https://craftercms.com/docs/current/reference/modules/engine.html Provides examples of how to use the `init-site.sh` script for various deployment scenarios, including local and remote repositories with different authentication methods. ```bash init-site mysite ``` ```bash init-site mysite /opt/crafter/authoring/data/repos/sites/mysite/published ``` ```bash init-site -b master mysite /opt/crafter/authoring/data/repos/sites/mysite/published ``` ```bash init-site -u jdoe -p jdoe1234 mysite https://github.com/jdoe/mysite.git ``` ```bash init-site -k ~/.ssh/jdoe_key mysite ssh://myserver/opt/crater/sites/mysite ``` ```bash init-site -k ~/.ssh/jdoe_key -f jdoe123 mysite ssh://myserver/opt/crater/sites/mysite ``` -------------------------------- ### Example Project Initialization Source: https://craftercms.com/docs/current/by-role/system-admin/installation.html An example of initializing the 'editorial' project on the delivery server, connecting to the authoring server via SSH and specifying the repository path. ```bash init-site.sh -b live editorial ssh://crafter@ec2-3-93-34-40.compute-1.amazonaws.com:/opt/crafter/data/repos/sites/editorial/published ``` -------------------------------- ### Get Active Environment Response Example Source: https://craftercms.com/docs/current/_static/api/studio.html Example of a JSON response for retrieving the current active environment for the system. Includes response status and environment information. ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "environment": "string" } ``` -------------------------------- ### Setup Project for Delivery Source: https://craftercms.com/docs/current/by-role/system-admin/installation.html Execute the 'init-site.sh' script from the 'scripts' folder to set up your project for delivery. Replace '' with your actual project name. ```bash ./scripts/init-site.sh ``` -------------------------------- ### Usage of start-upgrade script Source: https://craftercms.com/docs/current/by-role/system-admin/upgrade/upgrading-server.html Displays the available options for the `start-upgrade` script. Use this to understand how to specify the binary archive. ```bash usage: start-upgrade [options] -h,--help Show usage information -p,--bundle-path The path of the Crafter binary archive in the filesystem. If you specify this path the URL and version parameter will be ignored -u,--bundle-url The URL of the Crafter binary archive to download. If you specify this URL the version parameter will be ignored -v,--version The community version of the Crafter binary archive to download ``` -------------------------------- ### Get Comment Flags Response Example Source: https://craftercms.com/docs/current/_static/api/social.html This is an example response when retrieving flags for a comment. It includes details about the comment, its attachments, moderation status, votes, and flags. ```json { "ancestors": [ ], "targetId": "Welcome", "subject": "", "body": "This was the first comment in the site!", "createdBy": "59667e8abd4787992596ba6b", "lastModifiedBy": "59667e8abd4787992596ba6b", "createdDate": "2017-07-13T09:09Z", "lastModifiedDate": "2017-07-13T15:17Z", "anonymousFlag": false, "attributes": { }, "attachments": [ { "md5": "c86b6b1607621afff04b6a9b9048e87b", "fileId": "5967c9dd300426156e21df53", "contentType": "image/png", "fileSize": "144.5 KB", "storeName": "/f5b143c2-f1c0-4a10-b56e-f485f00d3fe9/59678d3f300426156e21df50/person1.png", "fileName": "person1.png", "savedDate": "2017-07-13T13:28Z", "fileSizeBytes": 147970, "attributes": { "owner": "59678d3f300426156e21df50" } } ], "moderationStatus": "APPROVED", "votesUp": [ ], "votesDown": [ ], "flags": [ { "reason": "Contains offensive language", "userId": "59667e8abd4787992596ba6b", "_id": "5967e35f300426156e21df58" } ], "_id": "59678d3f300426156e21df50" } ``` -------------------------------- ### Get the list of marketplace plugins installed in the given site Source: https://craftercms.com/docs/current/_static/api/studio.html Retrieves a list of all marketplace plugins currently installed in a specified site. Requires 'list_plugins' permission. Supports JWT and Basic Authentication. ```APIDOC ## GET /api/2/marketplace/installed ### Description Retrieves a list of marketplace plugins installed in the given site. ### Method GET ### Endpoint /api/2/marketplace/installed ### Parameters #### Query Parameters - **siteId** (string) - Required - The ID of the site. ### Responses #### Success Response (200) OK #### Error Responses - **400** Invalid request - **401** Unauthorized - **403** Forbidden - **500** Internal system failure ### Response Example (200) ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "plugins": [ { "id": "string", "version": { "major": 0, "minor": 0, "patch": 0 }, "pluginUrl": "string", "installationDate": "2019-08-24T14:15:22Z", "files": [ { "path": "string" } ] } ] } ``` ``` -------------------------------- ### Initialize Site with Staging Branch Source: https://craftercms.com/docs/current/by-role/common/staging.html Use the `init-site.sh` script to set up your project for delivery with the staging preview. Ensure your project is published to the `staging` target before running this script. ```bash ./init-site.sh -b staging mysite-staging /path/to/published/repo ``` -------------------------------- ### Initialize Site with Deployer Source: https://craftercms.com/docs/current/by-role/system-admin/installation.html Use this command to create a Deployer target that pulls published content for a newly created project. Replace placeholders with your internal LB domain name and site name. ```bash ./bin/init-site.sh -u crafter -p crafter editorial https:///repos/sites//published ``` -------------------------------- ### Get Global Menu Items Response Example Source: https://craftercms.com/docs/current/_static/api/studio.html Example of a JSON response for retrieving global menu items available to the current user. Includes response status and menu item details. ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "menuItems": [ { "id": "string", "label": "string", "icon": "string" } ] } ``` -------------------------------- ### Configure Toolbar Plugin Installation Source: https://craftercms.com/docs/current/by-role/developer/composable/extensions/resources/plugin-toolbar-example.html Define the plugin's installation parameters in `craftercms-plugin.yaml` to automatically wire it into the Studio UI. This example shows how to add a React component to the preview toolbar's right section. ```yaml 1installation: 2 - type: preview-app 3 parentXpath: //widget[@id='craftercms.components.PreviewToolbar'] 4 elementXpath: //plugin[@id='org.craftercms.sampleToolbarPlugin.components.reactComponent'] 5 element: 6 name: configuration 7 children: 8 - name: rightSection 9 children: 10 - name: widgets 11 children: 12 - name: widget 13 attributes: 14 - name: id 15 value: org.craftercms.sampleToolbarPlugin.components.reactComponent 16 children: 17 - name: plugin 18 attributes: 19 - name: id 20 value: org.craftercms.plugin.exampletoolbar 21 - name: type 22 value: toolbar 23 - name: name 24 value: test-toolbar 25 - name: file 26 value: index.js ``` -------------------------------- ### Initialize Site with Staging Branch and Private Key Authentication Source: https://craftercms.com/docs/current/by-role/common/staging.html When using private key SSH authentication for `init-site.sh`, specify the private key path using the `-k` option. ```bash init-site -k ~/.ssh/jdoe_key myeditorial ssh://myserver/opt/crater/sites/myeditorial ``` -------------------------------- ### Example UI Configuration for Role Targeting Source: https://craftercms.com/docs/current/by-role/developer/common/targeting.html This XML snippet shows an example of setting up targeting based on roles within the ui.xml file, specifically within the PreviewAudiencesPanel configuration. ```xml 1 2 3 4 5 ... 6 7 8 9 10 <icon id="@mui/icons-material/EmojiPeopleRounded"/> 11 <widgets> 12 <widget id="craftercms.components.PreviewAudiencesPanel"> 13 <configuration> 14 <fields> 15 <segment> 16 <id>segment</id> 17 ... 18 </segment> 19 <name> 20 <id>name</id> 21 <name>Name</name> 22 <description>User's first and last name.</description> 23 <type>input</type> 24 <helpText>Enter user's first and last name.</helpText> 25 </name> 26 <roles> 27 <id>roles</id> 28 <name>Role</name> 29 <description>User role, e.g. ROLE_admin</description> 30 <type>input</type> <!-- valid types: dropdown, checkboxes, input --> 31 <helpText>Setting the role will change content available based on role selected.</helpText> 32 </roles> 33 </fields> 34 </configuration> 35 </widget> 36 ... ``` -------------------------------- ### Sample Authentication Chain Configuration Source: https://craftercms.com/docs/current/reference/modules/studio.html This configuration demonstrates setting up an authentication chain with Headers, two LDAP providers, and an Internal Database provider. Ensure to enable the desired providers by setting `enabled: true`. ```yaml 1# Studio authentication chain configuration 2studio.authentication.chain: 3# Authentication provider type 4- provider: HEADERS 5# Authentication via headers enabled 6 enabled: true 7 # Authentication header for secure key 8 secureKeyHeader: secure_key 9 # Authentication headers secure key that is expected to match secure key value from headers 10 # Typically this is placed in the header by the authentication agent 11 secureKeyHeaderValue: secure 12 # Authentication header for username 13 usernameHeader: username 14 # Authentication header for first name 15 firstNameHeader: firstname 16 # Authentication header for last name 17 lastNameHeader: lastname 18 # Authentication header for email 19 emailHeader: email 20 # Authentication header for groups: comma separated list of groups 21 # Example: 22 # site_author,site_xyz_developer 23 groupsHeader: groups 24 # Enable/disable logout for headers authenticated users (SSO) 25 # logoutEnabled: false 26 # If logout is enabled for headers authenticated users (SSO), set the endpoint of the SP or IdP logout, which should 27 # be called after local logout. The {baseUrl} macro is provided so that the browser is redirected back to Studio 28 # after logout (https://STUDIO_SERVER:STUDIO_PORT/studio) 29 # logoutUrl: /YOUR_DOMAIN/logout?ReturnTo={baseUrl} 30# Authentication provider type 31- provider: LDAP 32 # Authentication via LDAP enabled 33 enabled: false 34 # LDAP Server url 35 ldapUrl: ldap://localhost:389 36 # LDAP bind DN (user) 37 ldapUsername: cn=Manager,dc=my-domain,dc=com 38 # LDAP bind password 39 ldapPassword: secret 40 # LDAP base context (directory root) 41 ldapBaseContext: dc=my-domain,dc=com 42 # LDAP username attribute 43 usernameLdapAttribute: uid 44 # LDAP first name attribute 45 firstNameLdapAttribute: cn 46 # LDAP last name attribute 47 lastNameLdapAttribute: sn 48 # Authentication header for email 49 emailLdapAttribute: mail 50 # LDAP groups attribute 51 groupNameLdapAttribute: crafterGroup 52 # LDAP groups attribute name regex 53 groupNameLdapAttributeRegex: .* 54 # LDAP groups attribute match index 55 groupNameLdapAttributeMatchIndex: 0 56# Authentication provider type 57- provider: LDAP 58 # Authentication via LDAP enabled 59 enabled: false 60 # LDAP Server url 61 ldapUrl: ldap://localhost:390 62 # LDAP bind DN (user) 63 ldapUsername: cn=Manager,dc=my-domain,dc=com 64 # LDAP bind password 65 ldapPassword: secret 66 # LDAP base context (directory root) 67 ldapBaseContext: dc=my-domain,dc=com 68 # LDAP username attribute 69 usernameLdapAttribute: uid 70 # LDAP first name attribute 71 firstNameLdapAttribute: cn 72 # LDAP last name attribute 73 lastNameLdapAttribute: sn 74 # Authentication header for email 75 emailLdapAttribute: mail 76 # LDAP groups attribute 77 groupNameLdapAttribute: crafterGroup 78 # LDAP groups attribute name regex 79 groupNameLdapAttributeRegex: .* 80 # LDAP groups attribute match index 81 groupNameLdapAttributeMatchIndex: 0 82# Authentication provider type 83- provider: DB 84 # Authentication via DB enabled 85 enabled: true ``` -------------------------------- ### Get Crafter Deployer Target Details Source: https://craftercms.com/docs/current/_static/api/deployer.html Example response for retrieving details of a specific deployment target (200 OK). ```json { "env": "dev", "siteName": "editorial", "id": "editorial-dev", "load_date": "2023-01-26T10:00:01.234-05:00", "status": "INIT_COMPLETED" } ``` -------------------------------- ### Initialize Site in CrafterCMS Delivery Source: https://craftercms.com/docs/current/getting-started/your-first-project/templated.html Run this script from the delivery instance's bin directory to set up your project in delivery. Replace 'my-awesome-editorial' with your project name and provide the absolute path to your authoring published repository. ```bash ./init-site my-awesome-editorial /absolute/path/to/authoring/published/repo ``` -------------------------------- ### Get All Social Contexts Source: https://craftercms.com/docs/current/_static/api/social.html Retrieves a list of all available social contexts. This is useful for understanding the current social context setup. ```json [ { "contextName": "Default", "_id": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9" } ] ``` -------------------------------- ### Initialize Project with Live Branch Source: https://craftercms.com/docs/current/by-role/system-admin/installation.html Initialize a project on the delivery server, specifying the 'live' branch, site ID, and the SSH connection details for the authoring server's repository. ```bash init-site.sh -b live [SITE_ID] ssh://crafter@[DNS_NAME_OF_AUTHORING_SERVER]:/opt/crafter/data/repos/sites/[SITE_ID]/published ``` -------------------------------- ### Get Deployer Target Response (200 OK) Source: https://craftercms.com/docs/current/reference/modules/deployer.html Example response when successfully retrieving a specific deployment target's details. ```json { "env": "dev", "siteName": "editorial", "id": "editorial-dev", "load_date": "2023-01-26T10:00:01.234-05:00", "status": "INIT_COMPLETED" } ``` -------------------------------- ### Start Project Publishing Request Source: https://craftercms.com/docs/current/_static/api/studio.html Use this to initiate the publishing process for a specific project or site. Requires Admin or Site Admin roles. ```json { "site_id": "my-editorial", "environment": "live", "commit_ids": [ "c89ee1cb2be4b41b0966d20c12d53b68ca70d74a", "0664df1ad04a9627dccb55a51ebf3704e313e40b", "93ae0e5e8d084fa9b7723cf3cf7ce526f47af0a9" ], "comment": "My submission comment" } ``` -------------------------------- ### Example JSON Response for Get Profile Source: https://craftercms.com/docs/current/reference/api/rest-content-retrieval-api.html This JSON object represents a user profile, including age, username, and last name. ```json { "age": 30, "username": "john", "lastname": "doe" } ``` -------------------------------- ### Sample application.yaml with Deployment and Task Scheduler Pools Source: https://craftercms.com/docs/current/reference/modules/deployer.html A comprehensive sample of `application.yaml` showing configurations for both the deployment pool and the task scheduler pool, along with other deployer settings. ```yaml deployer: main: taskScheduler: # Thread pool size of the task scheduler poolSize: 20 config: environment: active: ${CRAFTER_ENVIRONMENT} targets: config: folderPath: ${targets.dir} deployments: pool: # Thread pool core size size: 25 # Thread pool max size max: 100 # Thread pool queue size queue: 100 folderPath: ${deployments.dir} output: folderPath: ${logs.dir} processedCommits: folderPath: ${processedCommits.dir} logging: folderPath: ${logs.dir} management: # Deployer management authorization token authorizationToken: ${DEPLOYER_MANAGEMENT_TOKEN} security: encryption: # The key used for encryption of configuration properties key: ${CRAFTER_ENCRYPTION_KEY} # The salt used for encryption of configuration properties salt: ${CRAFTER_ENCRYPTION_SALT} ssh: # The path of the folder used for the SSH configuration config: ${CRAFTER_SSH_CONFIG} ``` -------------------------------- ### Response Sample for Rebuild GraphQL Schema Source: https://craftercms.com/docs/current/_static/api/engine.html Example JSON response confirming the start of a GraphQL schema rebuild for a given site. ```json { "message": "Rebuild of GraphQL schema started for 'sample'" } ``` -------------------------------- ### Example Auto-wiring for Data Source Plugin Source: https://craftercms.com/docs/current/by-role/developer/composable/extensions/plugins.html Configure a plugin for auto-wiring as a data source in Studio. This example includes details for the plugin ID, type, name, associated file, and an optional icon. ```yaml 1installation: 2 - type: form-datasource 3 elementXpath: //datasource/plugin[pluginId='org.craftercms.plugin.datasource'] 4 element: 5 name: datasource 6 children: 7 - name: plugin 8 children: 9 - name: pluginId 10 value: org.craftercms.plugin.datasource 11 - name: type 12 value: datasource 13 - name: name 14 value: text-input 15 - name: filename 16 value: main.js 17 - name: icon 18 children: 19 - name: class 20 value: fa-pencil-square-o ``` -------------------------------- ### Get Pages for a Given Site Source: https://craftercms.com/docs/current/reference/api/rest-content-retrieval-api.html Retrieves a list of pages within a specified site, with options to control the starting point and depth of the search. ```APIDOC ## GET /api/1/services/get-pages.json ### Description Retrieves a list of pages within a site, with optional path and depth parameters. ### Method GET ### Endpoint /api/1/services/get-pages.json ### Parameters #### Query Parameters - **path** (string) - Optional - The starting path within the site to search for pages. - **depth** (integer) - Optional - The depth to search for pages, starting from the specified path. Defaults to 2 if not provided and path is not specified. ``` -------------------------------- ### init-site.sh Usage Information Source: https://craftercms.com/docs/current/reference/modules/engine.html Displays the usage information for the `init-site.sh` script, outlining available options and their purposes. ```bash usage: init-site [options] [site] [repo-path] -a,--notification-addresses <addresses> A comma-separated list of email addresses that should receive deployment notifications -b,--branch <branch> The name of the branch to clone (live by default) -f,--passphrase <passphrase> The passphrase of the private key (when the key is passphrase protected) -h,--help Show usage information -k,--private-key <path> The path to the private key, when using private-key authentication through SSH to the remote Git repo -p,--password <password> The password for the remote Git repo, when using basic authentication -u,--username <username> The username for the remote Git repo, when using basic authentication --addresses <> A comma-separated list of email addresses that should receive deployment notifications ``` -------------------------------- ### Get Publishing History Response (Deprecated) Source: https://craftercms.com/docs/current/_static/api/studio.html Example response structure for retrieving publishing history. Note: This endpoint is deprecated and replaced by /api/2/dashboard/publishing/history. ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "publishingStatus": { "internalName": "string", "numberOfChildren": 0, "children": [ { } ], "publishingTarget": "string" } } ``` -------------------------------- ### Upgrade using a binary archive URL Source: https://craftercms.com/docs/current/by-role/system-admin/upgrade/upgrading-server.html This example shows how to initiate an upgrade by providing a URL to the CrafterCMS binary archive. The script will download the archive from the specified URL. ```bash $ ./start-upgrade.sh -u https://download/url/to/binary/archive $ cd ../../temp/upgrade $ ./upgrade.sh ``` -------------------------------- ### Run CrafterCMS Locally with Docker Source: https://craftercms.com/docs/current/by-role/system-admin/installation.html Use this command to quickly start a local instance of CrafterCMS for evaluation purposes. Ensure Docker is installed on your system. ```bash docker run -p 8080:8080 craftercms/authoring_local:latest ``` -------------------------------- ### Basic Serverless Deployment Configuration Example Source: https://craftercms.com/docs/current/reference/modules/engine.html An example configuration for a serverless deployment with a single authoring instance and no specific domain name requirements. ```yaml ########################################################## ``` -------------------------------- ### Get Available Publishing Targets Response Source: https://craftercms.com/docs/current/_static/api/studio.html Example response structure for listing available publishing targets for a site. Includes target names and their order. ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "publishingTargets": [ { "name": "string", "order": 0 } ], "published": true } ``` -------------------------------- ### Start MariaDB Database Instance Source: https://craftercms.com/docs/current/by-role/system-admin/performance-and-scaling.html Run this command to start the MariaDB database instance when encountering DB sync failures. Ensure CRAFTER_HOME is correctly set. ```bash CRAFTER_HOME/bin/dbms/bin/mysqld --no-defaults --console --basedir=CRAFTER_HOME/bin/dbms --datadir=CRAFTER_HOME/data/db --port=33306 --socket=/tmp/MariaDB4j.33306.sock --max_allowed_packet=128M --max-connections=500 ``` -------------------------------- ### Get an Item from the Content Store Source: https://craftercms.com/docs/current/reference/api/rest-content-retrieval-api.html This example demonstrates how to retrieve a specific item from the content store. Ensure the `crafterSite` parameter is included to specify the project. ```APIDOC ## GET /api/1/site/content_store/item.json ### Description Retrieves a specific item from the content store. ### Method GET ### Endpoint /api/1/site/content_store/item.json ### Parameters #### Query Parameters - **url** (string) - Required - The URL path to the content item. - **crafterSite** (string) - Required - The name of the CrafterCMS site. ### Response #### Success Response (200) Returns the content of the specified item in JSON format. #### Response Example ```json { "example": "<!-- Feature Component -->\n <article class=\"feature\" data-craftercms-model-path=\"/site/components/features/4be0a368-783c-8f73-7469-63a62636bd4c.xml\" data-craftercms-model-id=\"4be0a368-783c-8f73-7469-63a62636bd4c\" > <span class=\"icon fa-smile far\" data-craftercms-model-path=\"/site/components/features/4be0a368-783c-8f73-7469-63a62636bd4c.xml\" data-craftercms-model-id=\"4be0a368-783c-8f73-7469-63a62636bd4c\" data-craftercms-field-id=\"icon_s\" ></span> <div class=\"content\"> <h3 data-craftercms-model-path=\"/site/components/features/4be0a368-783c-8f73-7469-63a62636bd4c.xml\" data-craftercms-model-id=\"4be0a368-783c-8f73-7469-63a62636bd4c\" data-craftercms-field-id=\"title_t\" > Smile </h3> <div data-craftercms-model-path=\"/site/components/features/4be0a368-783c-8f73-7469-63a62636bd4c.xml\" data-craftercms-model-id=\"4be0a368-783c-8f73-7469-63a62636bd4c\" data-craftercms-field-id=\"body_html\" > <p>Smile, aenean ornare velit lacus, ac varius enim lorem ullamcorper dolore. Proin aliquam facilisis ante interdum. Sed nulla amet lorem feugiat tempus aliquam.</p> </div> </div> </article> <!-- /Feature Component -->" } ``` ``` -------------------------------- ### Clear Docker Data Source: https://craftercms.com/docs/current/by-role/developer/common/local-dev-with-docker.html Use this command to remove all volumes and associated data for the current Docker Compose setup. This is useful for starting with a clean slate. ```bash docker-compose down -v ``` -------------------------------- ### Copy Environment File Source: https://craftercms.com/docs/current/reference/modules/engine.html Create a copy of the example environment file to configure the Next.js application. ```bash cp .env.local.example .env.local ``` -------------------------------- ### Full Serverless Delivery Pipeline Example Source: https://craftercms.com/docs/current/reference/modules/deployer.html An extensive example demonstrating a full deployment pipeline for a serverless site using various AWS services and Crafter Deployer processors. ```yaml 1pipeline: 2 # -------------------- START OF MAIN PIPELINE -------------------- 3 4 # First clone or update the local repository from github 5 - processorName: gitPullProcessor 6 remoteRepo: 7 url: https://github.com/myuser/mysite.git 8 branch: live 9 username: myuser 10 password: my_secret_password 11 12 # Then find the added/changed/deleted files since the previous pull (if any) 13 14 - processorName: gitDiffProcessor 15 16 # Change all references to static-assets to use a CDN URL instead of the local URL 17 - processorName: findAndReplaceProcessor 18 includeFiles: ['^/site/.*$', '^/templates/.*$', '^/static-assets/.*(js|css|html)$'] 19 textPattern: (/static-assets/[^"<]+) 20 replacement: 'http://d111111abcdef8.cloudfront.net$1' 21 22 # Index the changes in search 23 - processorName: searchIndexingProcessor 24 25 # Sync the changes in a S3 bucket 26 - processorName: s3SyncProcessor 27 url: s3://serverless-sites/site/mysite 28 29 # Add a small delay to allow the S3 changes to propagate 30 - processorName: delayProcessor 31 32 # Invalidate the changed files in the CDN 33 - processorName: cloudfrontInvalidationProcessor 34 includeFiles: ['^/static-assets/.*$'] 35 distributions: 36 - E15UHQPTKROC8Z 37 38 # Trigger deployment events so any Crafter Engine listening can update accordingly: 39 # Rebuild the site context if any config or script has changed 40 - processorName: fileBasedDeploymentEventProcessor 41 includeFiles: ["^/?config/.*$", "^/?scripts/.*$"] 42 excludeFiles: ['^/config/studio/content-types/.*$'] 43 eventName: 'events.deployment.rebuildContext' 44 45 # Clear the cache if any static-asset has changed 46 - processorName: fileBasedDeploymentEventProcessor 47 excludeFiles: ['^/static-assets/.*$'] 48 eventName: 'events.deployment.clearCache' 49 50 # Rebuild the GraphQL schema if any content-type has changed 51 - processorName: fileBasedDeploymentEventProcessor 52 includeFiles: ['^/config/studio/content-types/.*$'] 53 eventName: 'events.deployment.rebuildGraphQL' 54 55 # Push the updated events to the S3 bucket 56 - processorName: s3SyncProcessor 57 includeFiles: ['^/?deployment-events\.properties$'] 58 url: s3://serverless-sites/site/mysite 59 60 # -------------------- END OF MAIN PIPELINE -------------------- 61 # Only Post Processors can be in this section 62 63 # Record the result of the deployment to a CSV file 64 - processorName: fileOutputProcessor 65 66 # Notify the site admin & an author if there were any failures during the deployment 67 - processorName: mailNotificationProcessor 68 to: 69 - admin@example.com 70 - author@example.com 71 status: ON_ANY_FAILURE ``` -------------------------------- ### Get Publishing Status Response Source: https://craftercms.com/docs/current/_static/api/studio.html Example response structure for retrieving the publishing status of a site. Includes general response information and detailed publishing status. ```json { "response": { "code": 0, "message": "string", "remedialAction": "string", "documentationUrl": "string" }, "publishingStatus": { "enabled": true, "status": "string", "lockOwner": "string", "lockTTL": "string", "totalItems": 0, "numberOfItems": 0, "submissionId": "string", "publishingTarget": "string", "published": true } } ```